@uniqbit/mate-core 1.0.0-canary.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +5 -4
  3. package/src/cli/commands/artifact/delivery/link.ts +1 -1
  4. package/src/cli/commands/artifact/delivery/output.ts +10 -1
  5. package/src/cli/commands/artifact/delivery/resolve.ts +3 -2
  6. package/src/cli/commands/artifact/delivery/submit.ts +9 -4
  7. package/src/cli/commands/artifact/delivery/take.ts +12 -9
  8. package/src/cli/commands/artifact/finish/command.ts +16 -14
  9. package/src/cli/commands/artifact/finish/engine.ts +8 -8
  10. package/src/cli/commands/artifact/project/command.ts +2 -3
  11. package/src/cli/commands/companion/hub.ts +11 -6
  12. package/src/cli/commands/companion/link.ts +173 -46
  13. package/src/cli/commands/doctor.ts +17 -0
  14. package/src/cli/commands/report/contract.ts +0 -17
  15. package/src/cli/commands/studio/access.ts +4 -0
  16. package/src/cli/commands/studio/actions.ts +35 -2
  17. package/src/cli/commands/studio/mcp-manager.ts +162 -0
  18. package/src/cli/commands/studio/routes.ts +12 -0
  19. package/src/cli/commands/studio/selection.ts +44 -11
  20. package/src/cli/commands/studio/server.ts +246 -2
  21. package/src/cli/commands/studio/services.ts +26 -0
  22. package/src/cli/commands/studio/terminal-launch.ts +21 -4
  23. package/src/cli/commands/studio/terminal.ts +3 -14
  24. package/src/cli/commands/studio/work-requests.ts +9 -0
  25. package/src/cli/commands/studio/work.ts +473 -0
  26. package/src/cli/commands/vscode/release-vsix.json +2 -2
  27. package/src/cli/commands/working/cleanup.ts +1 -18
  28. package/src/cli/companion-link-wizard.tsx +158 -91
  29. package/src/cli/usage.ts +1 -1
  30. package/src/create-mate.ts +4 -1
  31. package/src/lib/agent-credential.ts +131 -0
  32. package/src/lib/credential-kinds.ts +7 -0
  33. package/src/lib/delivery/merge-git.ts +16 -0
  34. package/src/lib/delivery/record-delivery.ts +12 -6
  35. package/src/lib/delivery/record.ts +5 -0
  36. package/src/lib/delivery/refresh.ts +34 -6
  37. package/src/lib/delivery/staging/refs.ts +9 -4
  38. package/src/lib/delivery/staging/submit.ts +81 -22
  39. package/src/lib/mcp-manager/resolve.ts +88 -0
  40. package/src/lib/mcp-manager/store.ts +133 -0
  41. package/src/lib/mcp-manager/types.ts +72 -0
  42. package/src/lib/mcp-manager/validate.ts +242 -0
  43. package/src/lib/opencode-server.ts +2 -17
  44. package/src/lib/orchestrator/config-store.ts +30 -7
  45. package/src/lib/orchestrator/engine-floor.ts +16 -4
  46. package/src/lib/orchestrator/engine-guard.ts +7 -1
  47. package/src/lib/orchestrator/repo-local-store.ts +14 -0
  48. package/src/lib/orchestrator/repository-link.ts +80 -52
  49. package/src/lib/orchestrator/root-context.ts +17 -1
  50. package/src/lib/orchestrator/types.ts +4 -0
  51. package/src/lib/studio-chat/agent.ts +139 -0
  52. package/src/lib/studio-chat/companion-context.ts +136 -0
  53. package/src/lib/studio-chat/credential.ts +79 -0
  54. package/src/lib/studio-chat/harness-chat-agent.ts +334 -0
  55. package/src/lib/studio-chat/host-sandbox.ts +578 -0
  56. package/src/lib/studio-chat/prepare-bridges.ts +95 -0
  57. package/src/lib/studio-chat/session.ts +15 -0
  58. package/src/lib/studio-chat/turns.ts +112 -0
  59. package/src/lib/workset/claims.ts +85 -0
  60. package/src/lib/workset/execution.ts +71 -0
  61. package/src/lib/workset/git-transaction.ts +74 -0
  62. package/src/lib/workset/groups.ts +176 -0
  63. package/src/lib/workset/inventory.ts +196 -0
  64. package/src/lib/workset/projection.ts +237 -0
  65. package/src/lib/workset/record.ts +101 -36
  66. package/src/lib/workset/repositories.ts +24 -0
  67. package/src/lib/workset/sharing.ts +951 -0
  68. package/src/lib/workset/stages.ts +50 -14
  69. package/src/lib/workset/transactions.ts +158 -0
  70. package/src/runtime/companion-git-state.ts +1 -0
  71. package/src/runtime/companion-guidance.ts +2 -2
  72. package/src/runtime/forge-remote.ts +6 -0
  73. package/src/runtime/host-process.ts +28 -0
  74. package/src/runtime/secret-guard.ts +18 -1
  75. package/src/runtime/secret-patterns.ts +4 -3
  76. package/src/runtime/submitted-arrivals.ts +28 -2
  77. package/src/runtime/workflow/turn.ts +14 -12
  78. package/src/runtime/write-atomic.ts +2 -2
  79. package/src/studio.ts +61 -0
  80. package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +1 -1
  81. package/src/templates/capabilities/openspec-cap/mate-full/templates/proposal.md +1 -1
  82. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +3 -2
  83. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +5 -3
  84. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +3 -2
  85. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +5 -3
  86. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +12 -12
  87. package/src/tools/setup/capabilities/mcp-manager.ts +73 -0
  88. package/src/tools/setup/context-services.ts +35 -6
  89. package/src/tools/setup/dynamic-plugins/audiences.ts +3 -2
  90. package/src/tools/setup/dynamic-plugins/declarations.ts +0 -26
  91. package/src/tools/setup/engine.ts +55 -3
  92. package/src/tools/setup/plugin.ts +14 -0
  93. package/src/tools/setup/plugins/gitignore.ts +1 -0
  94. package/src/tools/setup/providers/claude-format.ts +40 -7
  95. package/src/tools/setup/providers/claude.ts +38 -3
  96. package/src/tools/setup/providers/opencode-format.ts +13 -3
  97. package/src/tools/setup/providers/opencode.ts +7 -18
  98. package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
  99. package/studio-dist/THIRD-PARTY-NOTICES.md +297 -0
  100. package/studio-dist/client/THIRD-PARTY-LICENSES.md +4294 -0
  101. package/studio-dist/client/assets/DialogTitle-DOhjDa7H.js +1 -0
  102. package/studio-dist/client/assets/app-CG3vCgyA.css +2 -0
  103. package/studio-dist/client/assets/bundle-mjs-CdK3cBzO.js +1 -0
  104. package/studio-dist/client/assets/button-upSzkd-q.js +1 -0
  105. package/studio-dist/client/assets/chat-DbaMXb8H.js +157 -0
  106. package/studio-dist/client/assets/cn-BCnYnarL.js +1 -0
  107. package/studio-dist/client/assets/combobox-cP9OsRf2.js +1 -0
  108. package/studio-dist/client/assets/{companion-view-C_N237bf.js → companion-view-B54_Lj0S.js} +1 -1
  109. package/studio-dist/client/assets/fields-DNZ4a89M.js +1 -0
  110. package/studio-dist/client/assets/friction-DgEimeDB.js +1 -0
  111. package/studio-dist/client/assets/getting-started-BTfYCt5s.js +1 -0
  112. package/studio-dist/client/assets/{getting-started-djaQeWlu.js → getting-started-CAszmdDJ.js} +1 -1
  113. package/studio-dist/client/assets/getting-started._topic-CHJMf0pa.js +1 -0
  114. package/studio-dist/client/assets/getting-started.index-MR6HftWs.js +1 -0
  115. package/studio-dist/client/assets/{graph-canvas-ySGKMhmk.js → graph-canvas-BdNk2F9O.js} +1 -1
  116. package/studio-dist/client/assets/graph-hRijsC89.js +2 -0
  117. package/studio-dist/client/assets/guides-CwFnh08E.js +1 -0
  118. package/studio-dist/client/assets/highlighted-body-JLMTFACH-BcroQey-.js +1 -0
  119. package/studio-dist/client/assets/index-D5oGyvG8.js +41 -0
  120. package/studio-dist/client/assets/{markdown-view-jMiaBTSO.js → markdown-view-CJ8JsLb7.js} +1 -1
  121. package/studio-dist/client/assets/marked.esm-vFuq1cCd.js +65 -0
  122. package/studio-dist/client/assets/mcp-BE9M-bkO.js +4 -0
  123. package/studio-dist/client/assets/mermaid-WFAXDIZX-BjSsakrn.js +1 -0
  124. package/studio-dist/client/assets/panel-CDQ6Lryw.js +1 -0
  125. package/studio-dist/client/assets/plugins._service._view-DRVPUAWN.js +1 -0
  126. package/studio-dist/client/assets/{prepaint-CKsXyJOR.js → prepaint-sD_LlrDN.js} +1 -1
  127. package/studio-dist/client/assets/{queries-Dfp5deWj.js → queries-COL925ML.js} +1 -1
  128. package/studio-dist/client/assets/react-dom-K3Hp2Cdj.js +1 -0
  129. package/studio-dist/client/assets/{react-BYUSgtBs.js → react-h2xQ_NSp.js} +1 -1
  130. package/studio-dist/client/assets/reports-BClsojkb.js +1 -0
  131. package/studio-dist/client/assets/routes-CJQ2MAej.js +1 -0
  132. package/studio-dist/client/assets/search-DhWdEiKT.js +1 -0
  133. package/studio-dist/client/assets/select-B2FsN9FY.js +1 -0
  134. package/studio-dist/client/assets/skills-SoUHk77W.js +1 -0
  135. package/studio-dist/client/assets/{specs-BrCOjOch.js → specs-C_tZnAvF.js} +1 -1
  136. package/studio-dist/client/assets/specs-view-C6t3Y5IT.js +1 -0
  137. package/studio-dist/client/assets/steps-CF3-Zpmh.js +1 -0
  138. package/studio-dist/client/assets/{store-C3vJq8Wj.js → store-pY9gU4uS.js} +1 -1
  139. package/studio-dist/client/assets/studio-X7bnFrRe.js +36 -0
  140. package/studio-dist/client/assets/studio-queries-CKtAnIKP.js +2 -0
  141. package/studio-dist/client/assets/usage-BaaqUpTG.js +55 -0
  142. package/studio-dist/client/assets/useAnchoredPopupScrollLock-BspHR7Wt.js +1 -0
  143. package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
  144. package/studio-dist/client/assets/useMutation-DKeEoP5S.js +1 -0
  145. package/studio-dist/client/assets/useOpenInteractionType-CtaZCaFT.js +1 -0
  146. package/studio-dist/client/assets/usePopupHandleStore-Bc7Q4bnF.js +1 -0
  147. package/studio-dist/client/assets/vault-sAPFUnPN.js +1 -0
  148. package/studio-dist/client/assets/{warnings-CqOOGlPD.js → warnings-D7YY1HSG.js} +1 -1
  149. package/studio-dist/client/assets/work-BZek_LGB.js +5 -0
  150. package/studio-dist/client/assets/workflow-N5boHXFz.js +1 -0
  151. package/studio-dist/server/THIRD-PARTY-LICENSES.md +4371 -0
  152. package/studio-dist/server/assets/DialogTitle-DnKSl2V0.js +421 -0
  153. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-gVfW5vIV.js → __23tanstack-start-server-fn-resolver-Bli9bpSB.js} +38 -18
  154. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +91 -59
  155. package/studio-dist/server/assets/{actions-D8erOphH.js → actions-CHEFA1i9.js} +33 -1
  156. package/studio-dist/server/assets/{cn-FXJAM0KO.js → bundle-mjs-Ot6dQ8Pq.js} +1 -2056
  157. package/studio-dist/server/assets/{button-D6bvrFmm.js → button-BqA1urbl.js} +14 -7
  158. package/studio-dist/server/assets/chat-zl332Tvu.js +49486 -0
  159. package/studio-dist/server/assets/cn-B0fl6NWK.js +2057 -0
  160. package/studio-dist/server/assets/{combobox-D2MbYV1O.js → combobox-iTjvPCtS.js} +7 -6
  161. package/studio-dist/server/assets/{companion-view-Mf1ANbMb.js → companion-view-DIQ6AFIY.js} +2 -2
  162. package/studio-dist/server/assets/{companions-Dr6IpNAb.js → companions-aVwjRL8j.js} +1 -1
  163. package/studio-dist/server/assets/{fields-B4mAPETz.js → fields-BMap2_Ju.js} +10 -3
  164. package/studio-dist/server/assets/{friction-CWOTjpCV.js → friction-BER50hoD.js} +2 -2
  165. package/studio-dist/server/assets/{friction-9a5S1m7U.js → friction-BPs9KWdq.js} +8 -8
  166. package/studio-dist/server/assets/{getting-started-RU6tYU2Q.js → getting-started-DGfRVmZ_.js} +2 -2
  167. package/studio-dist/server/assets/{getting-started._topic-C02HGrC6.js → getting-started._topic-BgrBA4Vj.js} +2 -2
  168. package/studio-dist/server/assets/{getting-started.index-EzLRosbb.js → getting-started.index-BaFfQ9Mn.js} +2 -2
  169. package/studio-dist/server/assets/{graph-CZ2H9Fzr.js → graph-Cgzlrv3P.js} +8 -8
  170. package/studio-dist/server/assets/{graph-B11ITte0.js → graph-DODpuOy_.js} +1 -1
  171. package/studio-dist/server/assets/{graph-canvas-rP5TT14Z.js → graph-canvas-DW_zU1nA.js} +2 -2
  172. package/studio-dist/server/assets/{guides-BGftp4wf.js → guides-CA_EMG7E.js} +1 -1
  173. package/studio-dist/server/assets/{guides-B8HdeK_C.js → guides-D0SpoD32.js} +1 -1
  174. package/studio-dist/server/assets/{guides.server-DqFQAStf.js → guides.server-DJjQuy03.js} +1 -1
  175. package/studio-dist/server/assets/highlighted-body-JLMTFACH-BeHllu-r.js +41 -0
  176. package/studio-dist/server/assets/{markdown-view-CArpV-CS.js → markdown-view-CvVBGMZV.js} +1 -1
  177. package/studio-dist/server/assets/mcp-BU0fLYyJ.js +1103 -0
  178. package/studio-dist/server/assets/mcp-manager-D9YctTQe.js +50 -0
  179. package/studio-dist/server/assets/mermaid-WFAXDIZX-B1yDN6vG.js +1 -0
  180. package/studio-dist/server/assets/{panel-DR0iq46J.js → panel-D1K6Bsux.js} +4 -32
  181. package/studio-dist/server/assets/{plugins._service._view-n7u2k5dF.js → plugins._service._view-DdO1nELF.js} +4 -4
  182. package/studio-dist/server/assets/{prepaint-B28ClcPN.js → prepaint-BB3dwSmz.js} +1 -1
  183. package/studio-dist/server/assets/{queries-D-yVP9i0.js → queries-BwiDxQy5.js} +1 -1
  184. package/studio-dist/server/assets/{react-CiBZPDs8.js → react-B2cLiz-i.js} +1 -1
  185. package/studio-dist/server/assets/{reports-C2SmTgqh.js → reports-9Pr7Bz6o.js} +7 -7
  186. package/studio-dist/server/assets/{reports-B9k98oE6.js → reports-Cc9M3phM.js} +1 -1
  187. package/studio-dist/server/assets/{router-CPt0TAk_.js → router-DcWe0J7Y.js} +827 -548
  188. package/studio-dist/server/assets/{routes-CwH8LEy2.js → routes-BEXxl0py.js} +8 -8
  189. package/studio-dist/server/assets/{search-b-yQesv3.js → search-bltT7gwy.js} +39 -7
  190. package/studio-dist/server/assets/{select-C3i6TTX-.js → select-CZvHgGCi.js} +7 -6
  191. package/studio-dist/server/assets/{shell-CagqZZMZ.js → shell-BQ0vMKXN.js} +13 -4
  192. package/studio-dist/server/assets/{skills-DGg0mWDM.js → skills-Be_52h0i.js} +1 -1
  193. package/studio-dist/server/assets/{skills-C21Mg_8-.js → skills-BpGGUl6L.js} +8 -8
  194. package/studio-dist/server/assets/{specs-DetoMiaB.js → specs-CCGgXE-V.js} +5 -5
  195. package/studio-dist/server/assets/{specs-view-CmbfLDwN.js → specs-view-DtL5JxYM.js} +12 -11
  196. package/studio-dist/server/assets/{steps-D1tYAyWZ.js → steps-BWFSO6dM.js} +1 -1
  197. package/studio-dist/server/assets/{store-aC-I6f6o.js → store-X7yLPp7v.js} +1 -1
  198. package/studio-dist/server/assets/{studio-queries-Dqf-3nzj.js → studio-queries-ur1ygXi3.js} +117 -13
  199. package/studio-dist/server/assets/{studio-qRvQjRpz.js → studio-qzH-UETC.js} +1555 -179
  200. package/studio-dist/server/assets/{usage-Cwle9-xY.js → usage-C1o0DLzS.js} +1 -1
  201. package/studio-dist/server/assets/{usage-CS4CBK9D.js → usage-DWbSPrPD.js} +10 -9
  202. package/studio-dist/server/assets/{useAnchoredPopupScrollLock-BjMNgXv9.js → useAnchoredPopupScrollLock-DLDmv6kM.js} +4 -135
  203. package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
  204. package/studio-dist/server/assets/{useMutation-DpBIuWXt.js → useMutation-NjlA8oFY.js} +2 -2
  205. package/studio-dist/server/assets/useOpenInteractionType-CZYscfOb.js +136 -0
  206. package/studio-dist/server/assets/usePopupHandleStore-DEEXJYv0.js +26 -0
  207. package/studio-dist/server/assets/{vault-CEBBRLMb.js → vault-B_kfi1h-.js} +1 -1
  208. package/studio-dist/server/assets/{vault-DVQidlId.js → vault-dL79JlKH.js} +8 -115
  209. package/studio-dist/server/assets/{views-UgO0Qz_g.js → views-BSGH56lb.js} +3 -3
  210. package/studio-dist/server/assets/{warnings-C7hgXpdk.js → warnings-DtUVPV-k.js} +2 -2
  211. package/studio-dist/server/assets/work-D789VXGH.js +110 -0
  212. package/studio-dist/server/assets/work-DsCEfhmK.js +3817 -0
  213. package/studio-dist/server/assets/work-requests-BLhOmQFO.js +11 -0
  214. package/studio-dist/server/assets/{workflow-6dZZ1ofw.js → workflow-BOZ2sRYg.js} +9 -9
  215. package/studio-dist/server/server.js +3 -3
  216. package/wrappers/bin/openspec +87 -2
  217. package/studio-dist/client/assets/app-ggXJ_QVh.css +0 -2
  218. package/studio-dist/client/assets/button-amJ3g5oD.js +0 -1
  219. package/studio-dist/client/assets/cn-BQPKiwI4.js +0 -1
  220. package/studio-dist/client/assets/combobox-CJ7aGFid.js +0 -1
  221. package/studio-dist/client/assets/fields-BAiGkJ5N.js +0 -1
  222. package/studio-dist/client/assets/friction-DqOU59v7.js +0 -1
  223. package/studio-dist/client/assets/getting-started-yp42dj5S.js +0 -1
  224. package/studio-dist/client/assets/getting-started._topic-C9zVXz_m.js +0 -1
  225. package/studio-dist/client/assets/getting-started.index-DWbDKICP.js +0 -1
  226. package/studio-dist/client/assets/graph-BYaD_5Bq.js +0 -2
  227. package/studio-dist/client/assets/guides-D6T6W_jV.js +0 -1
  228. package/studio-dist/client/assets/index-Qx7reRPD.js +0 -40
  229. package/studio-dist/client/assets/panel-C4bf_h2W.js +0 -1
  230. package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +0 -1
  231. package/studio-dist/client/assets/reports-JFSwSueq.js +0 -1
  232. package/studio-dist/client/assets/routes-BdOWSgzK.js +0 -1
  233. package/studio-dist/client/assets/search-CXosfvYh.js +0 -1
  234. package/studio-dist/client/assets/select-BHYYWPhK.js +0 -1
  235. package/studio-dist/client/assets/skills-Bo9FLsBd.js +0 -1
  236. package/studio-dist/client/assets/specs-view-CdE2rlli.js +0 -1
  237. package/studio-dist/client/assets/steps-CKUno4lh.js +0 -1
  238. package/studio-dist/client/assets/studio-0ueISxwP.js +0 -100
  239. package/studio-dist/client/assets/studio-queries-BflKt9va.js +0 -2
  240. package/studio-dist/client/assets/usage-BLsLy0nN.js +0 -55
  241. package/studio-dist/client/assets/useAnchoredPopupScrollLock-DC7f8GOp.js +0 -1
  242. package/studio-dist/client/assets/useMutation-uJUrejsi.js +0 -1
  243. package/studio-dist/client/assets/vault-BB1B_OhR.js +0 -1
  244. package/studio-dist/client/assets/workflow-BFzmI-06.js +0 -1
@@ -0,0 +1,157 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-JLMTFACH-BcroQey-.js","assets/jsx-runtime-MZURdZre.js"])))=>i.map(i=>d[i]);
2
+ import{At as e,C as t,Dt as n,It as r,Lt as i,Mt as a,Nt as o,Ot as s,S as c,St as l,_ as u,b as d,jt as f,kt as p,w as m,x as h,y as g,yt as _}from"./index-D5oGyvG8.js";import{E as v,P as y,T as b,d as x,ut as ee}from"./studio-queries-CKtAnIKP.js";import{a as S,i as C,n as w,r as T,t as te}from"./jsx-runtime-MZURdZre.js";import"./studio-X7bnFrRe.js";import{n as E,r as D}from"./react-h2xQ_NSp.js";import{Ar as ne,Br as re,C as ie,Fr as ae,G as oe,J as se,Lr as ce,Or as le,S as ue,U as de,Yn as fe,ar as pe,bn as me,cr as he,er as ge,it as _e,lr as ve,nr as ye,q as be,r as O,sr as xe,t as Se,vn as Ce,vr as we,w as Te,zr as Ee}from"./button-upSzkd-q.js";import{t as k}from"./cn-BCnYnarL.js";import{n as De,t as Oe}from"./bundle-mjs-CdK3cBzO.js";import{t as ke}from"./react-dom-K3Hp2Cdj.js";import{t as Ae}from"./marked.esm-vFuq1cCd.js";import{t as je}from"./preload-helper-BLdHbfdN.js";import{_ as Me,b as Ne,d as Pe,f as Fe,g as Ie,h as Le,i as Re,m as ze,n as Be,r as Ve,v as He,y as Ue}from"./select-B2FsN9FY.js";import{i as We,n as Ge}from"./fields-DNZ4a89M.js";var Ke=(function(e){if(e==null)return Ze;if(typeof e==`function`)return Xe(e);if(typeof e==`object`)return Array.isArray(e)?qe(e):Je(e);if(typeof e==`string`)return Ye(e);throw Error(`Expected function, string, or object as test`)});function qe(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ke(e[n]);return Xe(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Je(e){let t=e;return Xe(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Ye(e){return Xe(t);function t(t){return t&&t.type===e}}function Xe(e){return t;function t(t,n,r){return!!(Qe(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Ze(){return!0}function Qe(e){return typeof e==`object`&&!!e&&`type`in e}function $e(e){return e}var et=[],tt=`skip`;function nt(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ke(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+$e(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=et,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=rt(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function rt(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?et:[e]}function it(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),nt(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var A=S(w(),1),j=te(),at={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function ot({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=at.indicator,imageBlockPolicy:c=at.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=_t(e,t,n,r,i,a,o,s,c);pt(l),it(l,u)}}function st(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function ct(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}function lt(e){let t=e.pathname+e.search+e.hash;return e.pathname.startsWith(`//`)?`/.`+t:t}var ut=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),dt=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function ft(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=st(e,n);if(!o||dt.has(o.protocol)||!(ut.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=ct(e);return o&&t.some(e=>{let t=st(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?lt(o):o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?lt(o):o.href:null}function pt(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)pt(t)}}var mt=Symbol(`node-seen`);function ht(e,t,n){return t===at.remove?{type:`remove`}:t===at.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function gt(e,t,n){if(t===at.remove)return{type:`remove`};if(t===at.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var _t=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[mt])return!0;if(u.tagName===`a`){let n=ft(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[mt]=!0,it(u,l),f&&typeof d==`number`){let e=ht(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[tt,d];f.children[d]=e.element}return tt}return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=ft(u.properties.src,n,e,r,!0,i);if(t===null){if(u[mt]=!0,it(u,l),f&&typeof d==`number`){let e=gt(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[tt,d];f.children[d]=e.element}return tt}return u.properties.src=t,!0}return!0};return l},vt=typeof self==`object`?self:globalThis,yt=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new vt[e](t)},bt=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof vt[e]==`function`?yt(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(yt(a,o),i)};return r},xt=e=>bt(new Map,e)(0),St=``,{toString:Ct}={},{keys:wt}=Object,Tt=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Ct.call(e).slice(8,-1);switch(n){case`Array`:return[1,St];case`Object`:return[2,St];case`Date`:return[3,St];case`RegExp`:return[4,St];case`Map`:return[5,St];case`Set`:return[6,St];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Et=([e,t])=>e===0&&(t===`function`||t===`symbol`),Dt=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Tt(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of wt(r))(e||!Et(Tt(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?St:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Et(Tt(n))||Et(Tt(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Et(Tt(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Ot=(e,{json:t,lossy:n}={})=>{let r=[];return Dt(!(t||n),!!t,new Map,r)(e),r},kt=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?xt(Ot(e,t)):structuredClone(e):(e,t)=>xt(Ot(e,t)),At=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};At.prototype.normal={},At.prototype.property={},At.prototype.space=void 0;function jt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new At(n,r,t)}function Mt(e){return e.toLowerCase()}var Nt=class{constructor(e,t){this.attribute=t,this.property=e}};Nt.prototype.attribute=``,Nt.prototype.booleanish=!1,Nt.prototype.boolean=!1,Nt.prototype.commaOrSpaceSeparated=!1,Nt.prototype.commaSeparated=!1,Nt.prototype.defined=!1,Nt.prototype.mustUseProperty=!1,Nt.prototype.number=!1,Nt.prototype.overloadedBoolean=!1,Nt.prototype.property=``,Nt.prototype.spaceSeparated=!1,Nt.prototype.space=void 0;var Pt=C({boolean:()=>M,booleanish:()=>It,commaOrSpaceSeparated:()=>Bt,commaSeparated:()=>zt,number:()=>N,overloadedBoolean:()=>Lt,spaceSeparated:()=>Rt}),Ft=0,M=Vt(),It=Vt(),Lt=Vt(),N=Vt(),Rt=Vt(),zt=Vt(),Bt=Vt();function Vt(){return 2**++Ft}var Ht=Object.keys(Pt),Ut=class extends Nt{constructor(e,t,n,r){let i=-1;if(super(e,t),Wt(this,`space`,r),typeof n==`number`)for(;++i<Ht.length;){let e=Ht[i];Wt(this,Ht[i],(n&Pt[e])===Pt[e])}}};Ut.prototype.defined=!0;function Wt(e,t,n){n&&(e[t]=n)}function Gt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ut(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Mt(r)]=r,n[Mt(a.attribute)]=r}return new At(t,n,e.space)}var Kt=Gt({properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:N,ariaColIndex:N,ariaColSpan:N,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:It,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:Rt,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:N,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:N,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:Rt,ariaRowCount:N,ariaRowIndex:N,ariaRowSpan:N,ariaSelected:It,ariaSetSize:N,ariaSort:null,ariaValueMax:N,ariaValueMin:N,ariaValueNow:N,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function qt(e,t){return t in e?e[t]:t}function Jt(e,t){return qt(e,t.toLowerCase())}var Yt=Gt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:zt,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:M,allowPaymentRequest:M,allowUserMedia:M,alpha:M,alt:null,as:null,async:M,autoCapitalize:null,autoComplete:Rt,autoFocus:M,autoPlay:M,blocking:Rt,capture:null,charSet:null,checked:M,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:N,colSpan:N,command:null,commandFor:null,content:null,contentEditable:It,controls:M,controlsList:Rt,coords:N|zt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:M,defer:M,dir:null,dirName:null,disabled:M,download:Lt,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:M,formTarget:null,headers:Rt,height:N,hidden:Lt,high:N,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:M,inputMode:null,integrity:null,is:null,isMap:M,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:M,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:M,low:N,manifest:null,max:null,maxLength:N,media:null,method:null,min:null,minLength:N,multiple:M,muted:M,name:null,nonce:null,noModule:M,noValidate:M,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:M,optimum:N,pattern:null,ping:Rt,placeholder:null,playsInline:M,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:M,referrerPolicy:null,rel:Rt,required:M,reversed:M,rows:N,rowSpan:N,sandbox:Rt,scope:null,scoped:M,seamless:M,selected:M,shadowRootClonable:M,shadowRootCustomElementRegistry:M,shadowRootDelegatesFocus:M,shadowRootMode:null,shadowRootSerializable:M,shape:null,size:N,sizes:null,slot:null,span:N,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:N,step:null,style:null,tabIndex:N,target:null,title:null,translate:null,type:null,typeMustMatch:M,useMap:null,value:It,width:N,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:N,borderColor:null,bottomMargin:N,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:M,declare:M,event:null,face:null,frame:null,frameBorder:null,hSpace:N,leftMargin:N,link:null,longDesc:null,lowSrc:null,marginHeight:N,marginWidth:N,noResize:M,noHref:M,noShade:M,noWrap:M,object:null,profile:null,prompt:null,rev:null,rightMargin:N,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:N,valueType:null,version:null,vAlign:null,vLink:null,vSpace:N,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:M,disablePictureInPicture:M,disableRemotePlayback:M,exportParts:zt,part:Rt,prefix:null,property:null,results:N,security:null,unselectable:null},space:`html`,transform:Jt}),Xt=Gt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Bt,accentHeight:N,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:N,amplitude:N,arabicForm:null,ascent:N,attributeName:null,attributeType:null,azimuth:N,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:N,by:null,calcMode:null,capHeight:N,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:N,diffuseConstant:N,direction:null,display:null,dur:null,divisor:N,dominantBaseline:null,download:M,dx:null,dy:null,edgeMode:null,editable:null,elevation:N,enableBackground:null,end:null,event:null,exponent:N,externalResourcesRequired:null,fill:null,fillOpacity:N,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zt,g2:zt,glyphName:zt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:N,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:N,horizOriginX:N,horizOriginY:N,id:null,ideographic:N,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:N,k:N,k1:N,k2:N,k3:N,k4:N,kernelMatrix:Bt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:N,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:N,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:N,overlineThickness:N,paintOrder:null,panose1:null,path:null,pathLength:N,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:N,pointsAtY:N,pointsAtZ:N,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bt,rev:Bt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bt,requiredFeatures:Bt,requiredFonts:Bt,requiredFormats:Bt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:N,specularExponent:N,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:N,strikethroughThickness:N,string:null,stroke:null,strokeDashArray:Bt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:N,strokeOpacity:N,strokeWidth:null,style:null,surfaceScale:N,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bt,tabIndex:N,tableValues:null,target:null,targetX:N,targetY:N,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:N,underlineThickness:N,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:N,values:null,vAlphabetic:N,vMathematical:N,vectorEffect:null,vHanging:N,vIdeographic:N,version:null,vertAdvY:N,vertOriginX:N,vertOriginY:N,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:N,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:qt}),Zt=Gt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Qt=Gt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Jt}),$t=Gt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),en={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},tn=/[A-Z]/g,nn=/-[a-z]/g,rn=/^data[-\w.:]+$/i;function an(e,t){let n=Mt(t),r=t,i=Nt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&rn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(nn,sn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!nn.test(e)){let n=e.replace(tn,on);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ut}return new i(r,t)}function on(e){return`-`+e.toLowerCase()}function sn(e){return e.charAt(1).toUpperCase()}var cn=jt([Kt,Yt,Zt,Qt,$t],`html`),ln=jt([Kt,Xt,Zt,Qt,$t],`svg`);function un(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function dn(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var fn=/[#.]/g;function pn(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){fn.lastIndex=i;let e=fn.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function mn(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function hn(e){return e.join(` `).trim()}function gn(e,t,n){let r=n?Sn(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=pn(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,_n(i))a.unshift(i);else for(let[t,n]of Object.entries(i))vn(e,o.properties,t,n)}for(let e of a)yn(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function _n(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function vn(e,t,n,r){let i=an(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?mn(r):i.commaSeparated?un(r):i.commaOrSpaceSeparated?mn(un(r).join(` `)):bn(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?xn(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(bn(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function yn(e,t){if(t!=null){if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)yn(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?yn(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}}function bn(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||Mt(n)===Mt(t)))return!0}return n}function xn(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function Sn(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var Cn=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),wn=gn(cn,`div`),Tn=gn(ln,`g`,Cn);function En(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=Dn(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=Dn(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function Dn(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
3
+ `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var On={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},kn={}.hasOwnProperty,An=Object.prototype;function jn(e,t){let n=t||{};return Mn({file:n.file||void 0,location:!1,schema:n.space===`svg`?ln:cn,verbose:n.verbose||!1},e)}function Mn(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},Fn(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:Nn(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=En(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},Fn(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},Fn(e,r,n),n}default:return n=Pn(e,t),n}}function Nn(e,t){let n=-1,r=[];for(;++n<t.length;){let i=Mn(e,t[n]);r.push(i)}return r}function Pn(e,t){let n=e.schema;e.schema=t.namespaceURI===On.svg?ln:cn;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;kn.call(An,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?Tn:wn)(t.tagName,i,Nn(e,t.childNodes));if(Fn(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&Ln(r.startTag),o=r&&r.endTag&&Ln(r.endTag),s=Mn(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function Fn(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=In(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function In(e,t,n){let r=Ln(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)kn.call(n.attrs,i)&&(r[an(e.schema,i).property]=Ln(n.attrs[i]));n.startTag;let a=Ln(n.startTag),o=n.endTag?Ln(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function Ln(e){let t=Rn({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=Rn({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function Rn(e){return e.line&&e.column?e:void 0}var zn={}.hasOwnProperty;function Bn(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&zn.call(t,e)){let n=String(t[e]);i=zn.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Vn={},Hn={}.hasOwnProperty,Un=Bn(`type`,{handlers:{root:Gn,element:Xn,text:Jn,comment:Yn,doctype:qn}});function Wn(e,t){let n=(t||Vn).space;return Un(e,n===`svg`?ln:cn)}function Gn(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=Qn(e.children,n,t),$n(e,n),n}function Kn(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=Qn(e.children,n,t),$n(e,n),n}function qn(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return $n(e,t),t}function Jn(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return $n(e,t),t}function Yn(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return $n(e,t),t}function Xn(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=ln);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&Hn.call(e.properties,a)){let t=Zn(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:On[o],childNodes:[],parentNode:null};return s.childNodes=Qn(e.children,s,r),$n(e,s),e.tagName===`template`&&e.content&&(s.content=Kn(e.content,r)),s}function Zn(e,t,n){let r=an(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?dn(n):hn(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=On[r.space]}return i}function Qn(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=Un(e[r],n);a.parentNode=t,i.push(a)}return i}function $n(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var er=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],tr=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]),P;(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`})(P||={});var nr={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function rr(e){return e>=55296&&e<=57343}function ir(e){return e>=56320&&e<=57343}function ar(e,t){return(e-55296)*1024+9216+t}function or(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function sr(e){return e>=64976&&e<=65007||tr.has(e)}var F;(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`})(F||={});var cr=65536,lr=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=cr,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(ir(t))return this.pos++,this._addGap(),ar(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,P.EOF;return this._err(F.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,P.EOF;let n=this.html.charCodeAt(t);return n===P.CARRIAGE_RETURN?P.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,P.EOF;let e=this.html.charCodeAt(this.pos);return e===P.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,P.LINE_FEED):e===P.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,rr(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===P.LINE_FEED||e===P.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){or(e)?this._err(F.controlCharacterInInputStream):sr(e)&&this._err(F.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},I;(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`})(I||={});function ur(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var dr=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肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ā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))),fr=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function pr(e){return e>=55296&&e<=57343||e>1114111?65533:fr.get(e)??e}var mr;(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`})(mr||={});var hr=32,gr;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(gr||={});function _r(e){return e>=mr.ZERO&&e<=mr.NINE}function vr(e){return e>=mr.UPPER_A&&e<=mr.UPPER_F||e>=mr.LOWER_A&&e<=mr.LOWER_F}function yr(e){return e>=mr.UPPER_A&&e<=mr.UPPER_Z||e>=mr.LOWER_A&&e<=mr.LOWER_Z||_r(e)}function br(e){return e===mr.EQUALS||yr(e)}var xr;(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`})(xr||={});var Sr;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Sr||={});var Cr=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=xr.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Sr.Strict}startEntity(e){this.decodeMode=e,this.state=xr.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case xr.EntityStart:return e.charCodeAt(t)===mr.NUM?(this.state=xr.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=xr.NamedEntity,this.stateNamedEntity(e,t));case xr.NumericStart:return this.stateNumericStart(e,t);case xr.NumericDecimal:return this.stateNumericDecimal(e,t);case xr.NumericHex:return this.stateNumericHex(e,t);case xr.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|hr)===mr.LOWER_X?(this.state=xr.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=xr.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_r(r)||vr(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_r(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===mr.SEMI)this.consumed+=1;else if(this.decodeMode===Sr.Strict)return 0;return this.emitCodePoint(pr(this.result),this.consumed),this.errors&&(e!==mr.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&gr.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=wr(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Sr.Attribute&&(i===0||br(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&gr.VALUE_LENGTH)>>14,i!==0){if(a===mr.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Sr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&gr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~gr.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case xr.NamedEntity:return this.result!==0&&(this.decodeMode!==Sr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case xr.NumericDecimal:return this.emitNumericEntity(0,2);case xr.NumericHex:return this.emitNumericEntity(0,3);case xr.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case xr.EntityStart:return 0}}};function wr(e,t,n,r){let i=(t&gr.BRANCH_LENGTH)>>7,a=t&gr.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var L;(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/`})(L||={});var Tr;(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`})(Tr||={});var Er;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Er||={});var R;(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`})(R||={});var z;(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`})(z||={});var Dr=new Map([[R.A,z.A],[R.ADDRESS,z.ADDRESS],[R.ANNOTATION_XML,z.ANNOTATION_XML],[R.APPLET,z.APPLET],[R.AREA,z.AREA],[R.ARTICLE,z.ARTICLE],[R.ASIDE,z.ASIDE],[R.B,z.B],[R.BASE,z.BASE],[R.BASEFONT,z.BASEFONT],[R.BGSOUND,z.BGSOUND],[R.BIG,z.BIG],[R.BLOCKQUOTE,z.BLOCKQUOTE],[R.BODY,z.BODY],[R.BR,z.BR],[R.BUTTON,z.BUTTON],[R.CAPTION,z.CAPTION],[R.CENTER,z.CENTER],[R.CODE,z.CODE],[R.COL,z.COL],[R.COLGROUP,z.COLGROUP],[R.DD,z.DD],[R.DESC,z.DESC],[R.DETAILS,z.DETAILS],[R.DIALOG,z.DIALOG],[R.DIR,z.DIR],[R.DIV,z.DIV],[R.DL,z.DL],[R.DT,z.DT],[R.EM,z.EM],[R.EMBED,z.EMBED],[R.FIELDSET,z.FIELDSET],[R.FIGCAPTION,z.FIGCAPTION],[R.FIGURE,z.FIGURE],[R.FONT,z.FONT],[R.FOOTER,z.FOOTER],[R.FOREIGN_OBJECT,z.FOREIGN_OBJECT],[R.FORM,z.FORM],[R.FRAME,z.FRAME],[R.FRAMESET,z.FRAMESET],[R.H1,z.H1],[R.H2,z.H2],[R.H3,z.H3],[R.H4,z.H4],[R.H5,z.H5],[R.H6,z.H6],[R.HEAD,z.HEAD],[R.HEADER,z.HEADER],[R.HGROUP,z.HGROUP],[R.HR,z.HR],[R.HTML,z.HTML],[R.I,z.I],[R.IMG,z.IMG],[R.IMAGE,z.IMAGE],[R.INPUT,z.INPUT],[R.IFRAME,z.IFRAME],[R.KEYGEN,z.KEYGEN],[R.LABEL,z.LABEL],[R.LI,z.LI],[R.LINK,z.LINK],[R.LISTING,z.LISTING],[R.MAIN,z.MAIN],[R.MALIGNMARK,z.MALIGNMARK],[R.MARQUEE,z.MARQUEE],[R.MATH,z.MATH],[R.MENU,z.MENU],[R.META,z.META],[R.MGLYPH,z.MGLYPH],[R.MI,z.MI],[R.MO,z.MO],[R.MN,z.MN],[R.MS,z.MS],[R.MTEXT,z.MTEXT],[R.NAV,z.NAV],[R.NOBR,z.NOBR],[R.NOFRAMES,z.NOFRAMES],[R.NOEMBED,z.NOEMBED],[R.NOSCRIPT,z.NOSCRIPT],[R.OBJECT,z.OBJECT],[R.OL,z.OL],[R.OPTGROUP,z.OPTGROUP],[R.OPTION,z.OPTION],[R.P,z.P],[R.PARAM,z.PARAM],[R.PLAINTEXT,z.PLAINTEXT],[R.PRE,z.PRE],[R.RB,z.RB],[R.RP,z.RP],[R.RT,z.RT],[R.RTC,z.RTC],[R.RUBY,z.RUBY],[R.S,z.S],[R.SCRIPT,z.SCRIPT],[R.SEARCH,z.SEARCH],[R.SECTION,z.SECTION],[R.SELECT,z.SELECT],[R.SOURCE,z.SOURCE],[R.SMALL,z.SMALL],[R.SPAN,z.SPAN],[R.STRIKE,z.STRIKE],[R.STRONG,z.STRONG],[R.STYLE,z.STYLE],[R.SUB,z.SUB],[R.SUMMARY,z.SUMMARY],[R.SUP,z.SUP],[R.TABLE,z.TABLE],[R.TBODY,z.TBODY],[R.TEMPLATE,z.TEMPLATE],[R.TEXTAREA,z.TEXTAREA],[R.TFOOT,z.TFOOT],[R.TD,z.TD],[R.TH,z.TH],[R.THEAD,z.THEAD],[R.TITLE,z.TITLE],[R.TR,z.TR],[R.TRACK,z.TRACK],[R.TT,z.TT],[R.U,z.U],[R.UL,z.UL],[R.SVG,z.SVG],[R.VAR,z.VAR],[R.WBR,z.WBR],[R.XMP,z.XMP]]);function Or(e){return Dr.get(e)??z.UNKNOWN}var B=z,kr={[L.HTML]:new Set([B.ADDRESS,B.APPLET,B.AREA,B.ARTICLE,B.ASIDE,B.BASE,B.BASEFONT,B.BGSOUND,B.BLOCKQUOTE,B.BODY,B.BR,B.BUTTON,B.CAPTION,B.CENTER,B.COL,B.COLGROUP,B.DD,B.DETAILS,B.DIR,B.DIV,B.DL,B.DT,B.EMBED,B.FIELDSET,B.FIGCAPTION,B.FIGURE,B.FOOTER,B.FORM,B.FRAME,B.FRAMESET,B.H1,B.H2,B.H3,B.H4,B.H5,B.H6,B.HEAD,B.HEADER,B.HGROUP,B.HR,B.HTML,B.IFRAME,B.IMG,B.INPUT,B.LI,B.LINK,B.LISTING,B.MAIN,B.MARQUEE,B.MENU,B.META,B.NAV,B.NOEMBED,B.NOFRAMES,B.NOSCRIPT,B.OBJECT,B.OL,B.P,B.PARAM,B.PLAINTEXT,B.PRE,B.SCRIPT,B.SECTION,B.SELECT,B.SOURCE,B.STYLE,B.SUMMARY,B.TABLE,B.TBODY,B.TD,B.TEMPLATE,B.TEXTAREA,B.TFOOT,B.TH,B.THEAD,B.TITLE,B.TR,B.TRACK,B.UL,B.WBR,B.XMP]),[L.MATHML]:new Set([B.MI,B.MO,B.MN,B.MS,B.MTEXT,B.ANNOTATION_XML]),[L.SVG]:new Set([B.TITLE,B.FOREIGN_OBJECT,B.DESC]),[L.XLINK]:new Set,[L.XML]:new Set,[L.XMLNS]:new Set},Ar=new Set([B.H1,B.H2,B.H3,B.H4,B.H5,B.H6]);R.STYLE,R.SCRIPT,R.XMP,R.IFRAME,R.NOEMBED,R.NOFRAMES,R.PLAINTEXT;var V;(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`})(V||={});var jr={DATA:V.DATA,RCDATA:V.RCDATA,RAWTEXT:V.RAWTEXT,SCRIPT_DATA:V.SCRIPT_DATA,PLAINTEXT:V.PLAINTEXT,CDATA_SECTION:V.CDATA_SECTION};function Mr(e){return e>=P.DIGIT_0&&e<=P.DIGIT_9}function Nr(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_Z}function Pr(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_Z}function Fr(e){return Pr(e)||Nr(e)}function Ir(e){return Fr(e)||Mr(e)}function Lr(e){return e+32}function Rr(e){return e===P.SPACE||e===P.LINE_FEED||e===P.TABULATION||e===P.FORM_FEED}function zr(e){return Rr(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN}function Br(e){return e===P.NULL?F.nullCharacterReference:e>1114111?F.characterReferenceOutsideUnicodeRange:rr(e)?F.surrogateCharacterReference:sr(e)?F.noncharacterCharacterReference:or(e)||e===P.CARRIAGE_RETURN?F.controlCharacterReference:null}var Vr=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=V.DATA,this.returnState=V.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new lr(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Cr(dr,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(F.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(F.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=Br(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,this.inLoop||(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:I.START_TAG,tagName:``,tagID:z.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:I.END_TAG,tagName:``,tagID:z.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:I.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:I.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(ur(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(F.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=Or(e.tagName),e.type===I.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(F.endTagWithAttributes),e.selfClosing&&this._err(F.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case I.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case I.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case I.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:I.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){let t=Rr(e)?I.WHITESPACE_CHARACTER:e===P.NULL?I.NULL_CHARACTER:I.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(I.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=V.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Sr.Attribute:Sr.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===V.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case V.DATA:this._stateData(e);break;case V.RCDATA:this._stateRcdata(e);break;case V.RAWTEXT:this._stateRawtext(e);break;case V.SCRIPT_DATA:this._stateScriptData(e);break;case V.PLAINTEXT:this._statePlaintext(e);break;case V.TAG_OPEN:this._stateTagOpen(e);break;case V.END_TAG_OPEN:this._stateEndTagOpen(e);break;case V.TAG_NAME:this._stateTagName(e);break;case V.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case V.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case V.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case V.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case V.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case V.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case V.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case V.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case V.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case V.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case V.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case V.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case V.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case V.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case V.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case V.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case V.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case V.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case V.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case V.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case V.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case V.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case V.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case V.BOGUS_COMMENT:this._stateBogusComment(e);break;case V.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case V.COMMENT_START:this._stateCommentStart(e);break;case V.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case V.COMMENT:this._stateComment(e);break;case V.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case V.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case V.COMMENT_END:this._stateCommentEnd(e);break;case V.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case V.DOCTYPE:this._stateDoctype(e);break;case V.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case V.DOCTYPE_NAME:this._stateDoctypeName(e);break;case V.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case V.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case V.CDATA_SECTION:this._stateCdataSection(e);break;case V.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case V.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case V.CHARACTER_REFERENCE:this._stateCharacterReference();break;case V.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case P.LESS_THAN_SIGN:this.state=V.TAG_OPEN;break;case P.AMPERSAND:this._startCharacterReference();break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitCodePoint(e);break;case P.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case P.AMPERSAND:this._startCharacterReference();break;case P.LESS_THAN_SIGN:this.state=V.RCDATA_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case P.LESS_THAN_SIGN:this.state=V.RAWTEXT_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Fr(e))this._createStartTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case P.EXCLAMATION_MARK:this.state=V.MARKUP_DECLARATION_OPEN;break;case P.SOLIDUS:this.state=V.END_TAG_OPEN;break;case P.QUESTION_MARK:this._err(F.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e);break;case P.EOF:this._err(F.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(F.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=V.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Fr(e))this._createEndTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case P.GREATER_THAN_SIGN:this._err(F.missingEndTagName),this.state=V.DATA;break;case P.EOF:this._err(F.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(F.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.BEFORE_ATTRIBUTE_NAME;break;case P.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case P.NULL:this._err(F.unexpectedNullCharacter),t.tagName+=`�`;break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Nr(e)?Lr(e):e)}}_stateRcdataLessThanSign(e){e===P.SOLIDUS?this.state=V.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=V.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Fr(e)?(this.state=V.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=V.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=V.BEFORE_ATTRIBUTE_NAME,!1;case P.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=V.SELF_CLOSING_START_TAG,!1;case P.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=V.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=V.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===P.SOLIDUS?this.state=V.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Fr(e)?(this.state=V.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case P.SOLIDUS:this.state=V.SCRIPT_DATA_END_TAG_OPEN;break;case P.EXCLAMATION_MARK:this.state=V.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=V.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Fr(e)?(this.state=V.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===P.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===P.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case P.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case P.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case P.HYPHEN_MINUS:this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case P.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(`>`);break;case P.NULL:this._err(F.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===P.SOLIDUS?this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Fr(e)?(this._emitChars(`<`),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Fr(e)?(this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(nr.SCRIPT,!1)&&zr(this.preprocessor.peek(nr.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<nr.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case P.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case P.NULL:this._err(F.unexpectedNullCharacter),this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case P.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case P.NULL:this._err(F.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case P.HYPHEN_MINUS:this._emitChars(`-`);break;case P.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case P.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(`>`);break;case P.NULL:this._err(F.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case P.EOF:this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===P.SOLIDUS?(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(nr.SCRIPT,!1)&&zr(this.preprocessor.peek(nr.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<nr.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.SOLIDUS:case P.GREATER_THAN_SIGN:case P.EOF:this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case P.EQUALS_SIGN:this._err(F.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=V.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:case P.SOLIDUS:case P.GREATER_THAN_SIGN:case P.EOF:this._leaveAttrName(),this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case P.EQUALS_SIGN:this._leaveAttrName(),this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case P.QUOTATION_MARK:case P.APOSTROPHE:case P.LESS_THAN_SIGN:this._err(F.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case P.NULL:this._err(F.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Nr(e)?Lr(e):e)}}_stateAfterAttributeName(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case P.EQUALS_SIGN:this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.QUOTATION_MARK:this.state=V.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case P.APOSTROPHE:this.state=V.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case P.GREATER_THAN_SIGN:this._err(F.missingAttributeValue),this.state=V.DATA,this.emitCurrentTagToken();break;default:this.state=V.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case P.QUOTATION_MARK:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case P.AMPERSAND:this._startCharacterReference();break;case P.NULL:this._err(F.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case P.APOSTROPHE:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case P.AMPERSAND:this._startCharacterReference();break;case P.NULL:this._err(F.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case P.AMPERSAND:this._startCharacterReference();break;case P.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case P.NULL:this._err(F.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case P.QUOTATION_MARK:case P.APOSTROPHE:case P.LESS_THAN_SIGN:case P.EQUALS_SIGN:case P.GRAVE_ACCENT:this._err(F.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case P.SOLIDUS:this._leaveAttrValue(),this.state=V.SELF_CLOSING_START_TAG;break;case P.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this._err(F.missingWhitespaceBetweenAttributes),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case P.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=V.DATA,this.emitCurrentTagToken();break}case P.EOF:this._err(F.eofInTag),this._emitEOFToken();break;default:this._err(F.unexpectedSolidusInTag),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case P.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case P.NULL:this._err(F.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(nr.DASH_DASH,!0)?(this._createCommentToken(nr.DASH_DASH.length+1),this.state=V.COMMENT_START):this._consumeSequenceIfMatch(nr.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(nr.DOCTYPE.length+1),this.state=V.DOCTYPE):this._consumeSequenceIfMatch(nr.CDATA_START,!0)?this.inForeignNode?this.state=V.CDATA_SECTION:(this._err(F.cdataInHtmlContent),this._createCommentToken(nr.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=V.BOGUS_COMMENT):this._ensureHibernation()||(this._err(F.incorrectlyOpenedComment),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case P.HYPHEN_MINUS:this.state=V.COMMENT_START_DASH;break;case P.GREATER_THAN_SIGN:{this._err(F.abruptClosingOfEmptyComment),this.state=V.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case P.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case P.GREATER_THAN_SIGN:this._err(F.abruptClosingOfEmptyComment),this.state=V.DATA,this.emitCurrentComment(t);break;case P.EOF:this._err(F.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=V.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case P.HYPHEN_MINUS:this.state=V.COMMENT_END_DASH;break;case P.LESS_THAN_SIGN:t.data+=`<`,this.state=V.COMMENT_LESS_THAN_SIGN;break;case P.NULL:this._err(F.unexpectedNullCharacter),t.data+=`�`;break;case P.EOF:this._err(F.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case P.EXCLAMATION_MARK:t.data+=`!`,this.state=V.COMMENT_LESS_THAN_SIGN_BANG;break;case P.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===P.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=V.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===P.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=V.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==P.GREATER_THAN_SIGN&&e!==P.EOF&&this._err(F.nestedComment),this.state=V.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case P.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case P.EOF:this._err(F.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case P.EXCLAMATION_MARK:this.state=V.COMMENT_END_BANG;break;case P.HYPHEN_MINUS:t.data+=`-`;break;case P.EOF:this._err(F.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case P.HYPHEN_MINUS:t.data+=`--!`,this.state=V.COMMENT_END_DASH;break;case P.GREATER_THAN_SIGN:this._err(F.incorrectlyClosedComment),this.state=V.DATA,this.emitCurrentComment(t);break;case P.EOF:this._err(F.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=V.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.BEFORE_DOCTYPE_NAME;break;case P.GREATER_THAN_SIGN:this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case P.EOF:{this._err(F.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(F.missingWhitespaceBeforeDoctypeName),this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Nr(e))this._createDoctypeToken(String.fromCharCode(Lr(e))),this.state=V.DOCTYPE_NAME;else switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.NULL:this._err(F.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=V.DOCTYPE_NAME;break;case P.GREATER_THAN_SIGN:{this._err(F.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=V.DATA;break}case P.EOF:{this._err(F.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=V.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.AFTER_DOCTYPE_NAME;break;case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.NULL:this._err(F.unexpectedNullCharacter),t.name+=`�`;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Nr(e)?Lr(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(nr.PUBLIC,!1)?this.state=V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(nr.SYSTEM,!1)?this.state=V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(F.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case P.QUOTATION_MARK:this._err(F.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:this._err(F.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case P.GREATER_THAN_SIGN:this._err(F.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.QUOTATION_MARK:t.publicId=``,this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:t.publicId=``,this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case P.GREATER_THAN_SIGN:this._err(F.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case P.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case P.NULL:this._err(F.unexpectedNullCharacter),t.publicId+=`�`;break;case P.GREATER_THAN_SIGN:this._err(F.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case P.APOSTROPHE:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case P.NULL:this._err(F.unexpectedNullCharacter),t.publicId+=`�`;break;case P.GREATER_THAN_SIGN:this._err(F.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case P.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.QUOTATION_MARK:this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.QUOTATION_MARK:t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:this.state=V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case P.QUOTATION_MARK:this._err(F.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:this._err(F.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case P.GREATER_THAN_SIGN:this._err(F.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.QUOTATION_MARK:t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case P.APOSTROPHE:t.systemId=``,this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case P.GREATER_THAN_SIGN:this._err(F.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case P.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case P.NULL:this._err(F.unexpectedNullCharacter),t.systemId+=`�`;break;case P.GREATER_THAN_SIGN:this._err(F.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case P.APOSTROPHE:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case P.NULL:this._err(F.unexpectedNullCharacter),t.systemId+=`�`;break;case P.GREATER_THAN_SIGN:this._err(F.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case P.SPACE:case P.LINE_FEED:case P.TABULATION:case P.FORM_FEED:break;case P.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.EOF:this._err(F.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(F.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case P.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case P.NULL:this._err(F.unexpectedNullCharacter);break;case P.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case P.RIGHT_SQUARE_BRACKET:this.state=V.CDATA_SECTION_BRACKET;break;case P.EOF:this._err(F.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===P.RIGHT_SQUARE_BRACKET?this.state=V.CDATA_SECTION_END:(this._emitChars(`]`),this.state=V.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case P.GREATER_THAN_SIGN:this.state=V.DATA;break;case P.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=V.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(P.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Ir(this.preprocessor.peek(1))?V.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Ir(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===P.SEMICOLON&&this._err(F.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Hr=new Set([z.DD,z.DT,z.LI,z.OPTGROUP,z.OPTION,z.P,z.RB,z.RP,z.RT,z.RTC]),Ur=new Set([...Hr,z.CAPTION,z.COLGROUP,z.TBODY,z.TD,z.TFOOT,z.TH,z.THEAD,z.TR]),Wr=new Set([z.APPLET,z.CAPTION,z.HTML,z.MARQUEE,z.OBJECT,z.TABLE,z.TD,z.TEMPLATE,z.TH]),Gr=new Set([...Wr,z.OL,z.UL]),Kr=new Set([...Wr,z.BUTTON]),qr=new Set([z.ANNOTATION_XML,z.MI,z.MN,z.MO,z.MS,z.MTEXT]),Jr=new Set([z.DESC,z.FOREIGN_OBJECT,z.TITLE]),Yr=new Set([z.TR,z.TEMPLATE,z.HTML]),Xr=new Set([z.TBODY,z.TFOOT,z.THEAD,z.TEMPLATE,z.HTML]),Zr=new Set([z.TABLE,z.TEMPLATE,z.HTML]),Qr=new Set([z.TD,z.TH]),$r=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=z.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===z.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===L.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==L.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Ar,L.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Qr,L.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Zr,L.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Xr,L.HTML)}clearBackToTableRowContext(){this.clearBackTo(Yr,L.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===z.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===z.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case L.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case L.SVG:if(Jr.has(r))return!1;break;case L.MATHML:if(qr.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Wr)}hasInListItemScope(e){return this.hasInDynamicScope(e,Gr)}hasInButtonScope(e){return this.hasInDynamicScope(e,Kr)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case L.HTML:if(Ar.has(t))return!0;if(Wr.has(t))return!1;break;case L.SVG:if(Jr.has(t))return!1;break;case L.MATHML:if(qr.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===L.HTML)switch(this.tagIDs[t]){case e:return!0;case z.TABLE:case z.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===L.HTML)switch(this.tagIDs[e]){case z.TBODY:case z.THEAD:case z.TFOOT:return!0;case z.TABLE:case z.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===L.HTML)switch(this.tagIDs[t]){case e:return!0;case z.OPTION:case z.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Hr.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Ur.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Ur.has(this.currentTagId);)this.pop()}},ei=3,ti;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(ti||={});var ni={type:ti.Marker},ri=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===ti.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<ei)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<ei)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=ei&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(ni)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:ti.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:ti.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(ni);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===ti.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===ti.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===ti.Element&&t.element===e)}},ii={createDocument(){return{nodeName:`#document`,mode:Er.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};ii.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(ii.isTextNode(n)){n.value+=t;return}}ii.appendChild(e,ii.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&ii.isTextNode(r)?r.value+=t:ii.insertBefore(e,ii.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},ai=`html`,oi=`about:legacy-compat`,si=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,ci=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),li=[...ci,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],ui=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),di=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],fi=[...di,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function pi(e,t){return t.some(t=>e.startsWith(t))}function mi(e){return e.name===ai&&e.publicId===null&&(e.systemId===null||e.systemId===oi)}function hi(e){if(e.name!==ai)return Er.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===si)return Er.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),ui.has(n))return Er.QUIRKS;let e=t===null?li:ci;if(pi(n,e))return Er.QUIRKS;if(e=t===null?di:fi,pi(n,e))return Er.LIMITED_QUIRKS}return Er.NO_QUIRKS}var gi={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},_i=`definitionurl`,vi=`definitionURL`,yi=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),bi=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:L.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:L.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:L.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:L.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:L.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:L.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:L.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:L.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:L.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:L.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:L.XMLNS}]]),xi=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Si=new Set([z.B,z.BIG,z.BLOCKQUOTE,z.BODY,z.BR,z.CENTER,z.CODE,z.DD,z.DIV,z.DL,z.DT,z.EM,z.EMBED,z.H1,z.H2,z.H3,z.H4,z.H5,z.H6,z.HEAD,z.HR,z.I,z.IMG,z.LI,z.LISTING,z.MENU,z.META,z.NOBR,z.OL,z.P,z.PRE,z.RUBY,z.S,z.SMALL,z.SPAN,z.STRONG,z.STRIKE,z.SUB,z.SUP,z.TABLE,z.TT,z.U,z.UL,z.VAR]);function Ci(e){let t=e.tagID;return t===z.FONT&&e.attrs.some(({name:e})=>e===Tr.COLOR||e===Tr.SIZE||e===Tr.FACE)||Si.has(t)}function wi(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===_i){e.attrs[t].name=vi;break}}function Ti(e){for(let t=0;t<e.attrs.length;t++){let n=yi.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Ei(e){for(let t=0;t<e.attrs.length;t++){let n=bi.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 Di(e){let t=xi.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Or(e.tagName))}function Oi(e,t){return t===L.MATHML&&(e===z.MI||e===z.MO||e===z.MN||e===z.MS||e===z.MTEXT)}function ki(e,t,n){if(t===L.MATHML&&e===z.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===Tr.ENCODING){let t=n[e].value.toLowerCase();return t===gi.TEXT_HTML||t===gi.APPLICATION_XML}}return t===L.SVG&&(e===z.FOREIGN_OBJECT||e===z.DESC||e===z.TITLE)}function Ai(e,t,n,r){return(!r||r===L.HTML)&&ki(e,t,n)||(!r||r===L.MATHML)&&Oi(e,t)}var ji=`hidden`,Mi=8,Ni=3,H;(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`})(H||={});var Pi={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Fi=new Set([z.TABLE,z.TBODY,z.TFOOT,z.THEAD,z.TR]),Ii={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:ii,onParseError:null},Li=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=H.INITIAL,this.originalInsertionMode=H.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={...Ii,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Vr(this.options,this),this.activeFormattingElements=new ri(this.treeAdapter),this.fragmentContextID=n?Or(this.treeAdapter.getTagName(n)):z.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new $r(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...Ii,...t};e??=n.treeAdapter.createElement(R.TEMPLATE,L.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,L.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===z.TEMPLATE&&i.tmplInsertionModeStack.unshift(H.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??Pi,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===L.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,L.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=H.TEXT}switchToPlaintextParsing(){this.insertionMode=H.TEXT,this.originalInsertionMode=H.IN_BODY,this.tokenizer.state=jr.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===R.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===L.HTML)switch(this.fragmentContextID){case z.TITLE:case z.TEXTAREA:this.tokenizer.state=jr.RCDATA;break;case z.STYLE:case z.XMP:case z.IFRAME:case z.NOEMBED:case z.NOFRAMES:case z.NOSCRIPT:this.tokenizer.state=jr.RAWTEXT;break;case z.SCRIPT:this.tokenizer.state=jr.SCRIPT_DATA;break;case z.PLAINTEXT:this.tokenizer.state=jr.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,L.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,L.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(R.HTML,L.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,z.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===I.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===z.SVG&&this.treeAdapter.getTagName(t)===R.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===L.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===z.MGLYPH||e.tagID===z.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,L.HTML)}_processToken(e){switch(e.type){case I.CHARACTER:this.onCharacter(e);break;case I.NULL_CHARACTER:this.onNullCharacter(e);break;case I.COMMENT:this.onComment(e);break;case I.DOCTYPE:this.onDoctype(e);break;case I.START_TAG:this._processStartTag(e);break;case I.END_TAG:this.onEndTag(e);break;case I.EOF:this.onEof(e);break;case I.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return Ai(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===ti.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=H.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(z.P),this.openElements.popUntilTagNamePopped(z.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case z.TR:this.insertionMode=H.IN_ROW;return;case z.TBODY:case z.THEAD:case z.TFOOT:this.insertionMode=H.IN_TABLE_BODY;return;case z.CAPTION:this.insertionMode=H.IN_CAPTION;return;case z.COLGROUP:this.insertionMode=H.IN_COLUMN_GROUP;return;case z.TABLE:this.insertionMode=H.IN_TABLE;return;case z.BODY:this.insertionMode=H.IN_BODY;return;case z.FRAMESET:this.insertionMode=H.IN_FRAMESET;return;case z.SELECT:this._resetInsertionModeForSelect(e);return;case z.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case z.HTML:this.insertionMode=this.headElement?H.AFTER_HEAD:H.BEFORE_HEAD;return;case z.TD:case z.TH:if(e>0){this.insertionMode=H.IN_CELL;return}break;case z.HEAD:if(e>0){this.insertionMode=H.IN_HEAD;return}}this.insertionMode=H.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===z.TEMPLATE)break;if(e===z.TABLE){this.insertionMode=H.IN_SELECT_IN_TABLE;return}}this.insertionMode=H.IN_SELECT}_isElementCausesFosterParenting(e){return Fi.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case z.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===L.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case z.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return kr[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)ns(this,e);else switch(this.insertionMode){case H.INITIAL:Xi(this,e);break;case H.BEFORE_HTML:$i(this,e);break;case H.BEFORE_HEAD:na(this,e);break;case H.IN_HEAD:oa(this,e);break;case H.IN_HEAD_NO_SCRIPT:la(this,e);break;case H.AFTER_HEAD:fa(this,e);break;case H.IN_BODY:case H.IN_CAPTION:case H.IN_CELL:case H.IN_TEMPLATE:ha(this,e);break;case H.TEXT:case H.IN_SELECT:case H.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case H.IN_TABLE:case H.IN_TABLE_BODY:case H.IN_ROW:uo(this,e);break;case H.IN_TABLE_TEXT:wo(this,e);break;case H.IN_COLUMN_GROUP:jo(this,e);break;case H.AFTER_BODY:qo(this,e);break;case H.AFTER_AFTER_BODY:$o(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)ts(this,e);else switch(this.insertionMode){case H.INITIAL:Xi(this,e);break;case H.BEFORE_HTML:$i(this,e);break;case H.BEFORE_HEAD:na(this,e);break;case H.IN_HEAD:oa(this,e);break;case H.IN_HEAD_NO_SCRIPT:la(this,e);break;case H.AFTER_HEAD:fa(this,e);break;case H.TEXT:this._insertCharacters(e);break;case H.IN_TABLE:case H.IN_TABLE_BODY:case H.IN_ROW:uo(this,e);break;case H.IN_COLUMN_GROUP:jo(this,e);break;case H.AFTER_BODY:qo(this,e);break;case H.AFTER_AFTER_BODY:$o(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML)Gi(this,e);else switch(this.insertionMode){case H.INITIAL:case H.BEFORE_HTML:case H.BEFORE_HEAD:case H.IN_HEAD:case H.IN_HEAD_NO_SCRIPT:case H.AFTER_HEAD:case H.IN_BODY:case H.IN_TABLE:case H.IN_CAPTION:case H.IN_COLUMN_GROUP:case H.IN_TABLE_BODY:case H.IN_ROW:case H.IN_CELL:case H.IN_SELECT:case H.IN_SELECT_IN_TABLE:case H.IN_TEMPLATE:case H.IN_FRAMESET:case H.AFTER_FRAMESET:Gi(this,e);break;case H.IN_TABLE_TEXT:To(this,e);break;case H.AFTER_BODY:Ki(this,e);break;case H.AFTER_AFTER_BODY:case H.AFTER_AFTER_FRAMESET:qi(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case H.INITIAL:Yi(this,e);break;case H.BEFORE_HEAD:case H.IN_HEAD:case H.IN_HEAD_NO_SCRIPT:case H.AFTER_HEAD:this._err(e,F.misplacedDoctype);break;case H.IN_TABLE_TEXT:To(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,F.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?is(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case H.INITIAL:Xi(this,e);break;case H.BEFORE_HTML:Zi(this,e);break;case H.BEFORE_HEAD:ea(this,e);break;case H.IN_HEAD:ra(this,e);break;case H.IN_HEAD_NO_SCRIPT:sa(this,e);break;case H.AFTER_HEAD:ua(this,e);break;case H.IN_BODY:Ja(this,e);break;case H.IN_TABLE:bo(this,e);break;case H.IN_TABLE_TEXT:To(this,e);break;case H.IN_CAPTION:Do(this,e);break;case H.IN_COLUMN_GROUP:ko(this,e);break;case H.IN_TABLE_BODY:Mo(this,e);break;case H.IN_ROW:Po(this,e);break;case H.IN_CELL:Io(this,e);break;case H.IN_SELECT:Ro(this,e);break;case H.IN_SELECT_IN_TABLE:Bo(this,e);break;case H.IN_TEMPLATE:Ho(this,e);break;case H.AFTER_BODY:Go(this,e);break;case H.IN_FRAMESET:Jo(this,e);break;case H.AFTER_FRAMESET:Xo(this,e);break;case H.AFTER_AFTER_BODY:Qo(this,e);break;case H.AFTER_AFTER_FRAMESET:es(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?as(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case H.INITIAL:Xi(this,e);break;case H.BEFORE_HTML:Qi(this,e);break;case H.BEFORE_HEAD:ta(this,e);break;case H.IN_HEAD:ia(this,e);break;case H.IN_HEAD_NO_SCRIPT:ca(this,e);break;case H.AFTER_HEAD:da(this,e);break;case H.IN_BODY:oo(this,e);break;case H.TEXT:co(this,e);break;case H.IN_TABLE:xo(this,e);break;case H.IN_TABLE_TEXT:To(this,e);break;case H.IN_CAPTION:Oo(this,e);break;case H.IN_COLUMN_GROUP:Ao(this,e);break;case H.IN_TABLE_BODY:No(this,e);break;case H.IN_ROW:Fo(this,e);break;case H.IN_CELL:Lo(this,e);break;case H.IN_SELECT:zo(this,e);break;case H.IN_SELECT_IN_TABLE:Vo(this,e);break;case H.IN_TEMPLATE:Uo(this,e);break;case H.AFTER_BODY:Ko(this,e);break;case H.IN_FRAMESET:Yo(this,e);break;case H.AFTER_FRAMESET:Zo(this,e);break;case H.AFTER_AFTER_BODY:$o(this,e)}}onEof(e){switch(this.insertionMode){case H.INITIAL:Xi(this,e);break;case H.BEFORE_HTML:$i(this,e);break;case H.BEFORE_HEAD:na(this,e);break;case H.IN_HEAD:oa(this,e);break;case H.IN_HEAD_NO_SCRIPT:la(this,e);break;case H.AFTER_HEAD:fa(this,e);break;case H.IN_BODY:case H.IN_TABLE:case H.IN_CAPTION:case H.IN_COLUMN_GROUP:case H.IN_TABLE_BODY:case H.IN_ROW:case H.IN_CELL:case H.IN_SELECT:case H.IN_SELECT_IN_TABLE:so(this,e);break;case H.TEXT:lo(this,e);break;case H.IN_TABLE_TEXT:To(this,e);break;case H.IN_TEMPLATE:Wo(this,e);break;case H.AFTER_BODY:case H.IN_FRAMESET:case H.AFTER_FRAMESET:case H.AFTER_AFTER_BODY:case H.AFTER_AFTER_FRAMESET:Ji(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===P.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(e);else switch(this.insertionMode){case H.IN_HEAD:case H.IN_HEAD_NO_SCRIPT:case H.AFTER_HEAD:case H.TEXT:case H.IN_COLUMN_GROUP:case H.IN_SELECT:case H.IN_SELECT_IN_TABLE:case H.IN_FRAMESET:case H.AFTER_FRAMESET:this._insertCharacters(e);break;case H.IN_BODY:case H.IN_CAPTION:case H.IN_CELL:case H.IN_TEMPLATE:case H.AFTER_BODY:case H.AFTER_AFTER_BODY:case H.AFTER_AFTER_FRAMESET:ma(this,e);break;case H.IN_TABLE:case H.IN_TABLE_BODY:case H.IN_ROW:uo(this,e);break;case H.IN_TABLE_TEXT:Co(this,e)}}};function Ri(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):ao(e,t),n}function zi(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Bi(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Ni;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Vi(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Vi(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Hi(e,t,n){let r=Or(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===z.TEMPLATE&&i===L.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Ui(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function Wi(e,t){for(let n=0;n<Mi;n++){let n=Ri(e,t);if(!n)break;let r=zi(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=Bi(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&Hi(e,a,i),Ui(e,r,n)}}function Gi(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Ki(e,t){e._appendCommentNode(t,e.openElements.items[0])}function qi(e,t){e._appendCommentNode(t,e.document)}function Ji(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Yi(e,t){e._setDocumentType(t);let n=t.forceQuirks?Er.QUIRKS:hi(t);mi(t)||e._err(t,F.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=H.BEFORE_HTML}function Xi(e,t){e._err(t,F.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Er.QUIRKS),e.insertionMode=H.BEFORE_HTML,e._processToken(t)}function Zi(e,t){t.tagID===z.HTML?(e._insertElement(t,L.HTML),e.insertionMode=H.BEFORE_HEAD):$i(e,t)}function Qi(e,t){let n=t.tagID;(n===z.HTML||n===z.HEAD||n===z.BODY||n===z.BR)&&$i(e,t)}function $i(e,t){e._insertFakeRootElement(),e.insertionMode=H.BEFORE_HEAD,e._processToken(t)}function ea(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.HEAD:e._insertElement(t,L.HTML),e.headElement=e.openElements.current,e.insertionMode=H.IN_HEAD;break;default:na(e,t)}}function ta(e,t){let n=t.tagID;n===z.HEAD||n===z.BODY||n===z.HTML||n===z.BR?na(e,t):e._err(t,F.endTagWithoutMatchingOpenElement)}function na(e,t){e._insertFakeElement(R.HEAD,z.HEAD),e.headElement=e.openElements.current,e.insertionMode=H.IN_HEAD,e._processToken(t)}function ra(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.BASE:case z.BASEFONT:case z.BGSOUND:case z.LINK:case z.META:e._appendElement(t,L.HTML),t.ackSelfClosing=!0;break;case z.TITLE:e._switchToTextParsing(t,jr.RCDATA);break;case z.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,jr.RAWTEXT):(e._insertElement(t,L.HTML),e.insertionMode=H.IN_HEAD_NO_SCRIPT);break;case z.NOFRAMES:case z.STYLE:e._switchToTextParsing(t,jr.RAWTEXT);break;case z.SCRIPT:e._switchToTextParsing(t,jr.SCRIPT_DATA);break;case z.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=H.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(H.IN_TEMPLATE);break;case z.HEAD:e._err(t,F.misplacedStartTagForHeadElement);break;default:oa(e,t)}}function ia(e,t){switch(t.tagID){case z.HEAD:e.openElements.pop(),e.insertionMode=H.AFTER_HEAD;break;case z.BODY:case z.BR:case z.HTML:oa(e,t);break;case z.TEMPLATE:aa(e,t);break;default:e._err(t,F.endTagWithoutMatchingOpenElement)}}function aa(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==z.TEMPLATE&&e._err(t,F.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(z.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,F.endTagWithoutMatchingOpenElement)}function oa(e,t){e.openElements.pop(),e.insertionMode=H.AFTER_HEAD,e._processToken(t)}function sa(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.BASEFONT:case z.BGSOUND:case z.HEAD:case z.LINK:case z.META:case z.NOFRAMES:case z.STYLE:ra(e,t);break;case z.NOSCRIPT:e._err(t,F.nestedNoscriptInHead);break;default:la(e,t)}}function ca(e,t){switch(t.tagID){case z.NOSCRIPT:e.openElements.pop(),e.insertionMode=H.IN_HEAD;break;case z.BR:la(e,t);break;default:e._err(t,F.endTagWithoutMatchingOpenElement)}}function la(e,t){let n=t.type===I.EOF?F.openElementsLeftAfterEof:F.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=H.IN_HEAD,e._processToken(t)}function ua(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.BODY:e._insertElement(t,L.HTML),e.framesetOk=!1,e.insertionMode=H.IN_BODY;break;case z.FRAMESET:e._insertElement(t,L.HTML),e.insertionMode=H.IN_FRAMESET;break;case z.BASE:case z.BASEFONT:case z.BGSOUND:case z.LINK:case z.META:case z.NOFRAMES:case z.SCRIPT:case z.STYLE:case z.TEMPLATE:case z.TITLE:e._err(t,F.abandonedHeadElementChild),e.openElements.push(e.headElement,z.HEAD),ra(e,t),e.openElements.remove(e.headElement);break;case z.HEAD:e._err(t,F.misplacedStartTagForHeadElement);break;default:fa(e,t)}}function da(e,t){switch(t.tagID){case z.BODY:case z.HTML:case z.BR:fa(e,t);break;case z.TEMPLATE:aa(e,t);break;default:e._err(t,F.endTagWithoutMatchingOpenElement)}}function fa(e,t){e._insertFakeElement(R.BODY,z.BODY),e.insertionMode=H.IN_BODY,pa(e,t)}function pa(e,t){switch(t.type){case I.CHARACTER:ha(e,t);break;case I.WHITESPACE_CHARACTER:ma(e,t);break;case I.COMMENT:Gi(e,t);break;case I.START_TAG:Ja(e,t);break;case I.END_TAG:oo(e,t);break;case I.EOF:so(e,t)}}function ma(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function ha(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function ga(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function _a(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function va(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_FRAMESET)}function ya(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML)}function ba(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Ar.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,L.HTML)}function xa(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Sa(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML),n||(e.formElement=e.openElements.current))}function Ca(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===z.LI&&r===z.LI||(n===z.DD||n===z.DT)&&(r===z.DD||r===z.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==z.ADDRESS&&r!==z.DIV&&r!==z.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML)}function wa(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML),e.tokenizer.state=jr.PLAINTEXT}function Ta(e,t){e.openElements.hasInScope(z.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(z.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML),e.framesetOk=!1}function Ea(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(R.A);n&&(Wi(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Da(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Oa(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(z.NOBR)&&(Wi(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,L.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ka(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Aa(e,t){e.treeAdapter.getDocumentMode(e.document)!==Er.QUIRKS&&e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._insertElement(t,L.HTML),e.framesetOk=!1,e.insertionMode=H.IN_TABLE}function ja(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,L.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Ma(e){let t=ur(e,Tr.TYPE);return t!=null&&t.toLowerCase()===ji}function Na(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,L.HTML),Ma(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Pa(e,t){e._appendElement(t,L.HTML),t.ackSelfClosing=!0}function Fa(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._appendElement(t,L.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Ia(e,t){t.tagName=R.IMG,t.tagID=z.IMG,ja(e,t)}function La(e,t){e._insertElement(t,L.HTML),e.skipNextNewLine=!0,e.tokenizer.state=jr.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=H.TEXT}function Ra(e,t){e.openElements.hasInButtonScope(z.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,jr.RAWTEXT)}function za(e,t){e.framesetOk=!1,e._switchToTextParsing(t,jr.RAWTEXT)}function Ba(e,t){e._switchToTextParsing(t,jr.RAWTEXT)}function Va(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===H.IN_TABLE||e.insertionMode===H.IN_CAPTION||e.insertionMode===H.IN_TABLE_BODY||e.insertionMode===H.IN_ROW||e.insertionMode===H.IN_CELL?H.IN_SELECT_IN_TABLE:H.IN_SELECT}function Ha(e,t){e.openElements.currentTagId===z.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML)}function Ua(e,t){e.openElements.hasInScope(z.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,L.HTML)}function Wa(e,t){e.openElements.hasInScope(z.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(z.RTC),e._insertElement(t,L.HTML)}function Ga(e,t){e._reconstructActiveFormattingElements(),wi(t),Ei(t),t.selfClosing?e._appendElement(t,L.MATHML):e._insertElement(t,L.MATHML),t.ackSelfClosing=!0}function Ka(e,t){e._reconstructActiveFormattingElements(),Ti(t),Ei(t),t.selfClosing?e._appendElement(t,L.SVG):e._insertElement(t,L.SVG),t.ackSelfClosing=!0}function qa(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,L.HTML)}function Ja(e,t){switch(t.tagID){case z.I:case z.S:case z.B:case z.U:case z.EM:case z.TT:case z.BIG:case z.CODE:case z.FONT:case z.SMALL:case z.STRIKE:case z.STRONG:Da(e,t);break;case z.A:Ea(e,t);break;case z.H1:case z.H2:case z.H3:case z.H4:case z.H5:case z.H6:ba(e,t);break;case z.P:case z.DL:case z.OL:case z.UL:case z.DIV:case z.DIR:case z.NAV:case z.MAIN:case z.MENU:case z.ASIDE:case z.CENTER:case z.FIGURE:case z.FOOTER:case z.HEADER:case z.HGROUP:case z.DIALOG:case z.DETAILS:case z.ADDRESS:case z.ARTICLE:case z.SEARCH:case z.SECTION:case z.SUMMARY:case z.FIELDSET:case z.BLOCKQUOTE:case z.FIGCAPTION:ya(e,t);break;case z.LI:case z.DD:case z.DT:Ca(e,t);break;case z.BR:case z.IMG:case z.WBR:case z.AREA:case z.EMBED:case z.KEYGEN:ja(e,t);break;case z.HR:Fa(e,t);break;case z.RB:case z.RTC:Ua(e,t);break;case z.RT:case z.RP:Wa(e,t);break;case z.PRE:case z.LISTING:xa(e,t);break;case z.XMP:Ra(e,t);break;case z.SVG:Ka(e,t);break;case z.HTML:ga(e,t);break;case z.BASE:case z.LINK:case z.META:case z.STYLE:case z.TITLE:case z.SCRIPT:case z.BGSOUND:case z.BASEFONT:case z.TEMPLATE:ra(e,t);break;case z.BODY:_a(e,t);break;case z.FORM:Sa(e,t);break;case z.NOBR:Oa(e,t);break;case z.MATH:Ga(e,t);break;case z.TABLE:Aa(e,t);break;case z.INPUT:Na(e,t);break;case z.PARAM:case z.TRACK:case z.SOURCE:Pa(e,t);break;case z.IMAGE:Ia(e,t);break;case z.BUTTON:Ta(e,t);break;case z.APPLET:case z.OBJECT:case z.MARQUEE:ka(e,t);break;case z.IFRAME:za(e,t);break;case z.SELECT:Va(e,t);break;case z.OPTION:case z.OPTGROUP:Ha(e,t);break;case z.NOEMBED:case z.NOFRAMES:Ba(e,t);break;case z.FRAMESET:va(e,t);break;case z.TEXTAREA:La(e,t);break;case z.NOSCRIPT:e.options.scriptingEnabled?Ba(e,t):qa(e,t);break;case z.PLAINTEXT:wa(e,t);break;case z.COL:case z.TH:case z.TD:case z.TR:case z.HEAD:case z.FRAME:case z.TBODY:case z.TFOOT:case z.THEAD:case z.CAPTION:case z.COLGROUP:break;default:qa(e,t)}}function Ya(e,t){if(e.openElements.hasInScope(z.BODY)&&(e.insertionMode=H.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Xa(e,t){e.openElements.hasInScope(z.BODY)&&(e.insertionMode=H.AFTER_BODY,Ko(e,t))}function Za(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Qa(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(z.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(z.FORM):n&&e.openElements.remove(n))}function $a(e){e.openElements.hasInButtonScope(z.P)||e._insertFakeElement(R.P,z.P),e._closePElement()}function eo(e){e.openElements.hasInListItemScope(z.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(z.LI),e.openElements.popUntilTagNamePopped(z.LI))}function to(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function no(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ro(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function io(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(R.BR,z.BR),e.openElements.pop(),e.framesetOk=!1}function ao(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==z.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function oo(e,t){switch(t.tagID){case z.A:case z.B:case z.I:case z.S:case z.U:case z.EM:case z.TT:case z.BIG:case z.CODE:case z.FONT:case z.NOBR:case z.SMALL:case z.STRIKE:case z.STRONG:Wi(e,t);break;case z.P:$a(e);break;case z.DL:case z.UL:case z.OL:case z.DIR:case z.DIV:case z.NAV:case z.PRE:case z.MAIN:case z.MENU:case z.ASIDE:case z.BUTTON:case z.CENTER:case z.FIGURE:case z.FOOTER:case z.HEADER:case z.HGROUP:case z.DIALOG:case z.ADDRESS:case z.ARTICLE:case z.DETAILS:case z.SEARCH:case z.SECTION:case z.SUMMARY:case z.LISTING:case z.FIELDSET:case z.BLOCKQUOTE:case z.FIGCAPTION:Za(e,t);break;case z.LI:eo(e);break;case z.DD:case z.DT:to(e,t);break;case z.H1:case z.H2:case z.H3:case z.H4:case z.H5:case z.H6:no(e);break;case z.BR:io(e);break;case z.BODY:Ya(e,t);break;case z.HTML:Xa(e,t);break;case z.FORM:Qa(e);break;case z.APPLET:case z.OBJECT:case z.MARQUEE:ro(e,t);break;case z.TEMPLATE:aa(e,t);break;default:ao(e,t)}}function so(e,t){e.tmplInsertionModeStack.length>0?Wo(e,t):Ji(e,t)}function co(e,t){var n;t.tagID===z.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function lo(e,t){e._err(t,F.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function uo(e,t){if(e.openElements.currentTagId!==void 0&&Fi.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=H.IN_TABLE_TEXT,t.type){case I.CHARACTER:wo(e,t);break;case I.WHITESPACE_CHARACTER:Co(e,t)}else So(e,t)}function fo(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_CAPTION}function po(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_COLUMN_GROUP}function mo(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(R.COLGROUP,z.COLGROUP),e.insertionMode=H.IN_COLUMN_GROUP,ko(e,t)}function ho(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_TABLE_BODY}function go(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(R.TBODY,z.TBODY),e.insertionMode=H.IN_TABLE_BODY,Mo(e,t)}function _o(e,t){e.openElements.hasInTableScope(z.TABLE)&&(e.openElements.popUntilTagNamePopped(z.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function vo(e,t){Ma(t)?e._appendElement(t,L.HTML):So(e,t),t.ackSelfClosing=!0}function yo(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,L.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function bo(e,t){switch(t.tagID){case z.TD:case z.TH:case z.TR:go(e,t);break;case z.STYLE:case z.SCRIPT:case z.TEMPLATE:ra(e,t);break;case z.COL:mo(e,t);break;case z.FORM:yo(e,t);break;case z.TABLE:_o(e,t);break;case z.TBODY:case z.TFOOT:case z.THEAD:ho(e,t);break;case z.INPUT:vo(e,t);break;case z.CAPTION:fo(e,t);break;case z.COLGROUP:po(e,t);break;default:So(e,t)}}function xo(e,t){switch(t.tagID){case z.TABLE:e.openElements.hasInTableScope(z.TABLE)&&(e.openElements.popUntilTagNamePopped(z.TABLE),e._resetInsertionMode());break;case z.TEMPLATE:aa(e,t);break;case z.BODY:case z.CAPTION:case z.COL:case z.COLGROUP:case z.HTML:case z.TBODY:case z.TD:case z.TFOOT:case z.TH:case z.THEAD:case z.TR:break;default:So(e,t)}}function So(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,pa(e,t),e.fosterParentingEnabled=n}function Co(e,t){e.pendingCharacterTokens.push(t)}function wo(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function To(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)So(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var Eo=new Set([z.CAPTION,z.COL,z.COLGROUP,z.TBODY,z.TD,z.TFOOT,z.TH,z.THEAD,z.TR]);function Do(e,t){let n=t.tagID;Eo.has(n)?e.openElements.hasInTableScope(z.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(z.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=H.IN_TABLE,bo(e,t)):Ja(e,t)}function Oo(e,t){let n=t.tagID;switch(n){case z.CAPTION:case z.TABLE:e.openElements.hasInTableScope(z.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(z.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=H.IN_TABLE,n===z.TABLE&&xo(e,t));break;case z.BODY:case z.COL:case z.COLGROUP:case z.HTML:case z.TBODY:case z.TD:case z.TFOOT:case z.TH:case z.THEAD:case z.TR:break;default:oo(e,t)}}function ko(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.COL:e._appendElement(t,L.HTML),t.ackSelfClosing=!0;break;case z.TEMPLATE:ra(e,t);break;default:jo(e,t)}}function Ao(e,t){switch(t.tagID){case z.COLGROUP:e.openElements.currentTagId===z.COLGROUP&&(e.openElements.pop(),e.insertionMode=H.IN_TABLE);break;case z.TEMPLATE:aa(e,t);break;case z.COL:break;default:jo(e,t)}}function jo(e,t){e.openElements.currentTagId===z.COLGROUP&&(e.openElements.pop(),e.insertionMode=H.IN_TABLE,e._processToken(t))}function Mo(e,t){switch(t.tagID){case z.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_ROW;break;case z.TH:case z.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(R.TR,z.TR),e.insertionMode=H.IN_ROW,Po(e,t);break;case z.CAPTION:case z.COL:case z.COLGROUP:case z.TBODY:case z.TFOOT:case z.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE,bo(e,t));break;default:bo(e,t)}}function No(e,t){let n=t.tagID;switch(t.tagID){case z.TBODY:case z.TFOOT:case z.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE);break;case z.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE,xo(e,t));break;case z.BODY:case z.CAPTION:case z.COL:case z.COLGROUP:case z.HTML:case z.TD:case z.TH:case z.TR:break;default:xo(e,t)}}function Po(e,t){switch(t.tagID){case z.TH:case z.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,L.HTML),e.insertionMode=H.IN_CELL,e.activeFormattingElements.insertMarker();break;case z.CAPTION:case z.COL:case z.COLGROUP:case z.TBODY:case z.TFOOT:case z.THEAD:case z.TR:e.openElements.hasInTableScope(z.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE_BODY,Mo(e,t));break;default:bo(e,t)}}function Fo(e,t){switch(t.tagID){case z.TR:e.openElements.hasInTableScope(z.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE_BODY);break;case z.TABLE:e.openElements.hasInTableScope(z.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE_BODY,No(e,t));break;case z.TBODY:case z.TFOOT:case z.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(z.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=H.IN_TABLE_BODY,No(e,t));break;case z.BODY:case z.CAPTION:case z.COL:case z.COLGROUP:case z.HTML:case z.TD:case z.TH:break;default:xo(e,t)}}function Io(e,t){let n=t.tagID;Eo.has(n)?(e.openElements.hasInTableScope(z.TD)||e.openElements.hasInTableScope(z.TH))&&(e._closeTableCell(),Po(e,t)):Ja(e,t)}function Lo(e,t){let n=t.tagID;switch(n){case z.TD:case z.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=H.IN_ROW);break;case z.TABLE:case z.TBODY:case z.TFOOT:case z.THEAD:case z.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Fo(e,t));break;case z.BODY:case z.CAPTION:case z.COL:case z.COLGROUP:case z.HTML:break;default:oo(e,t)}}function Ro(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.OPTION:e.openElements.currentTagId===z.OPTION&&e.openElements.pop(),e._insertElement(t,L.HTML);break;case z.OPTGROUP:e.openElements.currentTagId===z.OPTION&&e.openElements.pop(),e.openElements.currentTagId===z.OPTGROUP&&e.openElements.pop(),e._insertElement(t,L.HTML);break;case z.HR:e.openElements.currentTagId===z.OPTION&&e.openElements.pop(),e.openElements.currentTagId===z.OPTGROUP&&e.openElements.pop(),e._appendElement(t,L.HTML),t.ackSelfClosing=!0;break;case z.INPUT:case z.KEYGEN:case z.TEXTAREA:case z.SELECT:e.openElements.hasInSelectScope(z.SELECT)&&(e.openElements.popUntilTagNamePopped(z.SELECT),e._resetInsertionMode(),t.tagID!==z.SELECT&&e._processStartTag(t));break;case z.SCRIPT:case z.TEMPLATE:ra(e,t)}}function zo(e,t){switch(t.tagID){case z.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===z.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===z.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===z.OPTGROUP&&e.openElements.pop();break;case z.OPTION:e.openElements.currentTagId===z.OPTION&&e.openElements.pop();break;case z.SELECT:e.openElements.hasInSelectScope(z.SELECT)&&(e.openElements.popUntilTagNamePopped(z.SELECT),e._resetInsertionMode());break;case z.TEMPLATE:aa(e,t)}}function Bo(e,t){let n=t.tagID;n===z.CAPTION||n===z.TABLE||n===z.TBODY||n===z.TFOOT||n===z.THEAD||n===z.TR||n===z.TD||n===z.TH?(e.openElements.popUntilTagNamePopped(z.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Ro(e,t)}function Vo(e,t){let n=t.tagID;n===z.CAPTION||n===z.TABLE||n===z.TBODY||n===z.TFOOT||n===z.THEAD||n===z.TR||n===z.TD||n===z.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(z.SELECT),e._resetInsertionMode(),e.onEndTag(t)):zo(e,t)}function Ho(e,t){switch(t.tagID){case z.BASE:case z.BASEFONT:case z.BGSOUND:case z.LINK:case z.META:case z.NOFRAMES:case z.SCRIPT:case z.STYLE:case z.TEMPLATE:case z.TITLE:ra(e,t);break;case z.CAPTION:case z.COLGROUP:case z.TBODY:case z.TFOOT:case z.THEAD:e.tmplInsertionModeStack[0]=H.IN_TABLE,e.insertionMode=H.IN_TABLE,bo(e,t);break;case z.COL:e.tmplInsertionModeStack[0]=H.IN_COLUMN_GROUP,e.insertionMode=H.IN_COLUMN_GROUP,ko(e,t);break;case z.TR:e.tmplInsertionModeStack[0]=H.IN_TABLE_BODY,e.insertionMode=H.IN_TABLE_BODY,Mo(e,t);break;case z.TD:case z.TH:e.tmplInsertionModeStack[0]=H.IN_ROW,e.insertionMode=H.IN_ROW,Po(e,t);break;default:e.tmplInsertionModeStack[0]=H.IN_BODY,e.insertionMode=H.IN_BODY,Ja(e,t)}}function Uo(e,t){t.tagID===z.TEMPLATE&&aa(e,t)}function Wo(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(z.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Ji(e,t)}function Go(e,t){t.tagID===z.HTML?Ja(e,t):qo(e,t)}function Ko(e,t){if(t.tagID===z.HTML){if(e.fragmentContext||(e.insertionMode=H.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===z.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else qo(e,t)}function qo(e,t){e.insertionMode=H.IN_BODY,pa(e,t)}function Jo(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.FRAMESET:e._insertElement(t,L.HTML);break;case z.FRAME:e._appendElement(t,L.HTML),t.ackSelfClosing=!0;break;case z.NOFRAMES:ra(e,t)}}function Yo(e,t){t.tagID===z.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==z.FRAMESET&&(e.insertionMode=H.AFTER_FRAMESET))}function Xo(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.NOFRAMES:ra(e,t)}}function Zo(e,t){t.tagID===z.HTML&&(e.insertionMode=H.AFTER_AFTER_FRAMESET)}function Qo(e,t){t.tagID===z.HTML?Ja(e,t):$o(e,t)}function $o(e,t){e.insertionMode=H.IN_BODY,pa(e,t)}function es(e,t){switch(t.tagID){case z.HTML:Ja(e,t);break;case z.NOFRAMES:ra(e,t)}}function ts(e,t){t.chars=`�`,e._insertCharacters(t)}function ns(e,t){e._insertCharacters(t),e.framesetOk=!1}function rs(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==L.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function is(e,t){if(Ci(t))rs(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===L.MATHML?wi(t):r===L.SVG&&(Di(t),Ti(t)),Ei(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function as(e,t){if(t.tagID===z.P||t.tagID===z.BR)rs(e),e._endTagOutsideForeignContent(t);else for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===L.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}R.AREA,R.BASE,R.BASEFONT,R.BGSOUND,R.BR,R.COL,R.EMBED,R.FRAME,R.HR,R.IMG,R.INPUT,R.KEYGEN,R.LINK,R.META,R.PARAM,R.SOURCE,R.TRACK,R.WBR;var os=cs(`end`),ss=cs(`start`);function cs(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function ls(e){let t=ss(e),n=os(e);if(t&&n)return{start:t,end:n}}var us=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,ds=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),fs={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function ps(e,t){let n=Ds(e),r=Bn(`type`,{handlers:{root:hs,element:gs,text:_s,comment:bs,doctype:vs,raw:xs},unknown:Ss}),i={parser:n?new Li(fs):Li.getFragmentParser(void 0,fs),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),Cs(i,ss());let a=jn(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&it(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function ms(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function hs(e,t){ms(e.children,t)}function gs(e,t){Ts(e,t),ms(e.children,t),Es(e,t)}function _s(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:I.CHARACTER,chars:e.value,location:Os(e)};Cs(t,ss(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function vs(e,t){let n={type:I.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:Os(e)};Cs(t,ss(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function ys(e,t){t.stitches=!0;let n=ks(e);`children`in e&&`children`in n&&(n.children=ps({type:`root`,children:e.children},t.options).children),bs({type:`comment`,value:{stitch:n}},t)}function bs(e,t){let n=e.value,r={type:I.COMMENT,data:n,location:Os(e)};Cs(t,ss(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function xs(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,ws(t,ss(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(us,`&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;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function Ss(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))ys(n,t);else{let e=``;throw ds.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function Cs(e,t){ws(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=jr.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 ws(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Ts(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===jr.PLAINTEXT)return;Cs(t,ss(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:On.html;i===On.html&&n===`svg`&&(i=On.svg);let a=Wn({...e,children:[]},{space:i===On.svg?`svg`:`html`}),o={type:I.START_TAG,tagName:n,tagID:Or(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:Os(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Es(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&er.includes(n)||t.parser.tokenizer.state===jr.PLAINTEXT)return;Cs(t,os(e));let r={type:I.END_TAG,tagName:n,tagID:Or(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Os(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===jr.RCDATA||t.parser.tokenizer.state===jr.RAWTEXT||t.parser.tokenizer.state===jr.SCRIPT_DATA)&&(t.parser.tokenizer.state=jr.DATA)}function Ds(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function Os(e){let t=ss(e)||{line:void 0,column:void 0,offset:void 0},n=os(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 ks(e){return`children`in e?kt({...e,children:[]}):kt(e)}function As(e){return function(t,n){return ps(t,{...e,file:n})}}var js=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],Ms={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...js,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...js],h2:[[`className`,`sr-only`]],img:[...js,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...js,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...js],table:[...js],ul:[...js,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},Ns={}.hasOwnProperty;function Ps(e,t){let n={type:`root`,children:[]},r=Fs({schema:t?{...Ms,...t}:Ms,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function Fs(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return Is(e,n);case`doctype`:return Ls(e,n);case`element`:return Rs(e,n);case`root`:return zs(e,n);case`text`:return Bs(e,n)}}}function Is(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return qs(r,t),r}}function Ls(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return qs(e,t),e}}function Rs(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=Vs(e,t.children),i=Hs(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&Ns.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return qs(o,t),o}function zs(e,t){let n={type:`root`,children:Vs(e,t.children)};return qs(n,t),n}function Bs(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return qs(n,t),n}function Vs(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=Fs(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function Hs(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&Ns.call(r,n)?r[n]:void 0,o=r&&Ns.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(Ns.call(s,l)){let t=s[l],n=Us(e,Js(a,l),l,t);n??=Us(e,Js(o,l),l,t),n!=null&&(c[l]=n)}if(i&&Ns.call(i,n)){let e=i[n];for(l in e)Ns.call(e,l)&&!Ns.call(c,l)&&(c[l]=e[l])}return c}function Us(e,t,n,r){return t?Array.isArray(r)?Ws(e,t,n,r):Gs(e,t,n,r):void 0}function Ws(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=Gs(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function Gs(e,t,n,r){if((typeof r==`boolean`||typeof r==`number`||typeof r==`string`)&&Ks(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function Ks(e,t,n){let r=e.schema.protocols&&Ns.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function qs(e,t){let n=ls(t);t.data&&(e.data=kt(t.data)),n&&(e.position=n)}function Js(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function Ys(e){return function(t){return Ps(t,e)}}function Xs(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var Zs=sc(/[A-Za-z]/),Qs=sc(/[\dA-Za-z]/),$s=sc(/[#-'*+\--9=?A-Z^-~]/);function ec(e){return e!==null&&(e<32||e===127)}var tc=sc(/\d/),nc=sc(/[\dA-Fa-f]/),rc=sc(/[!-/:-@[-`{-~]/);function U(e){return e!==null&&e<-2}function ic(e){return e!==null&&(e<0||e===32)}function W(e){return e===-2||e===-1||e===32}var ac=sc(/\p{P}|\p{S}/u),oc=sc(/\s/);function sc(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function cc(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function lc(e,t,n){let r=Ke((n||{}).ignore||[]),i=uc(t),a=-1;for(;++a<i.length;)nt(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function uc(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([dc(e[0]),fc(e[1])])}return t}function dc(e){return typeof e==`string`?new RegExp(cc(e),`g`):e}function fc(e){return typeof e==`function`?e:function(){return e}}var pc=`phrasing`,mc=[`autolink`,`link`,`image`,`label`];function hc(){return{transforms:[Cc],enter:{literalAutolink:_c,literalAutolinkEmail:vc,literalAutolinkHttp:vc,literalAutolinkWww:vc},exit:{literalAutolink:Sc,literalAutolinkEmail:xc,literalAutolinkHttp:yc,literalAutolinkWww:bc}}}function gc(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:pc,notInConstruct:mc},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:pc,notInConstruct:mc},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:pc,notInConstruct:mc}]}}function _c(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function vc(e){this.config.enter.autolinkProtocol.call(this,e)}function yc(e){this.config.exit.autolinkProtocol.call(this,e)}function bc(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function xc(e){this.config.exit.autolinkEmail.call(this,e)}function Sc(e){this.exit(e)}function Cc(e){lc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,wc],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Tc]],{ignore:[`link`,`linkReference`]})}function wc(e,t,n,r,i){let a=``;if(!Oc(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Ec(n)))return!1;let o=Dc(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Tc(e,t,n,r){return!Oc(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Ec(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Dc(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Xs(e,`(`),a=Xs(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Oc(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||oc(n)||ac(n))&&(!t||n!==47)}function kc(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}zc.peek=Rc;function Ac(){this.buffer()}function jc(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Mc(){this.buffer()}function Nc(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Pc(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=kc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Fc(e){this.exit(e)}function Ic(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=kc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Lc(e){this.exit(e)}function Rc(){return`[`}function zc(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Bc(){return{enter:{gfmFootnoteCallString:Ac,gfmFootnoteCall:jc,gfmFootnoteDefinitionLabelString:Mc,gfmFootnoteDefinition:Nc},exit:{gfmFootnoteCallString:Pc,gfmFootnoteCall:Fc,gfmFootnoteDefinitionLabelString:Ic,gfmFootnoteDefinition:Lc}}}function Vc(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zc},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
4
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Uc:Hc))),s(),o}}function Hc(e,t,n){return t===0?e:Uc(e,t,n)}function Uc(e,t,n){return(n?``:` `)+e}var Wc=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Yc.peek=Xc;function Gc(){return{canContainEols:[`delete`],enter:{strikethrough:qc},exit:{strikethrough:Jc}}}function Kc(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Wc}],handlers:{delete:Yc}}}function qc(e){this.enter({type:`delete`,children:[]},e)}function Jc(e){this.exit(e)}function Yc(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Xc(){return`~`}function Zc(e){return e.length}function Qc(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Zc,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=$c(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=el(r[d]);else{let e=el(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding===!1||n.alignDelimiters===!1&&i===``||n.delimiterStart===!1&&!d||r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
5
+ `)}function $c(e){return e==null?``:String(e)}function el(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function tl(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),nl);return i(),o}function nl(e,t,n){return`>`+(n?``:` `)+e}function rl(e,t){return il(e,t.inConstruct,!0)&&!il(e,t.notInConstruct,!1)}function il(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function al(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
6
+ `&&rl(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
7
+ `}function ol(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function sl(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^ \r\n]/.test(e.value)||/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cl(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ll(e,t,n,r){let i=cl(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(sl(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ul);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(ol(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
8
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
9
+ `),a&&(u+=s.move(a+`
10
+ `)),u+=s.move(c),l(),u}function ul(e,t,n){return(n?``:` `)+e}function dl(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fl(e,t,n,r){let i=dl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
11
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function pl(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ml(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function hl(e){if(e===null||ic(e)||oc(e))return 1;if(ac(e))return 2}function gl(e,t,n){let r=hl(e),i=hl(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_l.peek=vl;function _l(e,t,n,r){let i=pl(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=gl(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=ml(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=gl(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+ml(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function vl(e,t,n){return n.options.emphasis||`*`}var yl={};function bl(e,t){let n=t||yl;return xl(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function xl(e,t,n){if(Cl(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Sl(e.children,t,n)}return Array.isArray(e)?Sl(e,t,n):``}function Sl(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=xl(e[i],t,n);return r.join(``)}function Cl(e){return!!(e&&typeof e==`object`)}function wl(e,t){let n=!1;return it(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&bl(e)&&(t.options.setext||n))}function Tl(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(wl(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
12
+ `,after:`
13
+ `});return r(),t(),o+`
14
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
15
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
16
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=ml(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}El.peek=Dl;function El(e){return e.value||``}function Dl(){return`<`}Ol.peek=kl;function Ol(e,t,n,r){let i=dl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function kl(){return`!`}Al.peek=jl;function Al(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function jl(){return`!`}Ml.peek=Nl;function Ml(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Nl(){return"`"}function Pl(e,t){let n=bl(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][a-z+.-]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}Fl.peek=Il;function Fl(e,t,n,r){let i=dl(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Pl(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Il(e,t,n){return Pl(e,n)?`<`:`[`}Ll.peek=Rl;function Ll(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Rl(){return`[`}function zl(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Bl(e){let t=zl(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Vl(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Hl(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ul(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Vl(n):zl(n),s=e.ordered?o===`.`?`)`:`.`:Bl(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if(o!==`*`&&o!==`-`||!t||t.children&&t.children[0]||n.stack[n.stack.length-1]!==`list`||n.stack[n.stack.length-2]!==`listItem`||n.stack[n.stack.length-3]!==`list`||n.stack[n.stack.length-4]!==`listItem`||n.indexStack[n.indexStack.length-1]!==0||n.indexStack[n.indexStack.length-2]!==0||n.indexStack[n.indexStack.length-3]!==0||(c=!0),Hl(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Wl(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Gl(e,t,n,r){let i=Wl(n),a=n.bulletCurrent||zl(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Kl(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var ql=Ke([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Jl(e,t,n,r){return(e.children.some(function(e){return ql(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Yl(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xl.peek=Zl;function Xl(e,t,n,r){let i=Yl(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=gl(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=ml(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=gl(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+ml(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Zl(e,t,n){return n.options.strong||`*`}function Ql(e,t,n,r){return n.safe(e.value,r)}function $l(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function eu(e,t,n){let r=(Hl(n)+(n.options.ruleSpaces?` `:``)).repeat($l(n));return n.options.ruleSpaces?r.slice(0,-1):r}var tu={blockquote:tl,break:al,code:ll,definition:fl,emphasis:_l,hardBreak:al,heading:Tl,html:El,image:Ol,imageReference:Al,inlineCode:Ml,link:Fl,linkReference:Ll,list:Ul,listItem:Gl,paragraph:Kl,root:Jl,strong:Xl,text:Ql,thematicBreak:eu},nu=document.createElement(`i`);function ru(e){let t=`&`+e+`;`;nu.innerHTML=t;let n=nu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function iu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}var au=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ou(e){return e.replace(au,su)}function su(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return iu(n.slice(t?2:1),t?16:10)}return ru(n)||e}function cu(){return{enter:{table:lu,tableData:pu,tableHeader:pu,tableRow:du},exit:{codeText:mu,table:uu,tableData:fu,tableHeader:fu,tableRow:fu}}}function lu(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function uu(e){this.exit(e),this.data.inTable=void 0}function du(e){this.enter({type:`tableRow`,children:[]},e)}function fu(e){this.exit(e)}function pu(e){this.enter({type:`tableCell`,children:[]},e)}function mu(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,hu));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function hu(e,t){return t===`|`?t:e}function gu(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
17
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
18
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Qc(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=tu.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function _u(){return{exit:{taskListCheckValueChecked:yu,taskListCheckValueUnchecked:yu,paragraph:bu}}}function vu(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:xu}}}function yu(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function bu(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function xu(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=tu.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Su(){return[hc(),Bc(),Gc(),cu(),_u()]}function Cu(e){return{extensions:[gc(),Vc(e),Kc(),gu(e),vu()]}}function wu(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Tu(e,t){return e.length>0?(wu(e,e.length,0,t),e):t}var Eu={}.hasOwnProperty;function Du(e){let t={},n=-1;for(;++n<e.length;)Ou(t,e[n]);return t}function Ou(e,t){let n;for(n in t){let r=(Eu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Eu.call(r,a)||(r[a]=[]);let e=i[a];ku(r[a],Array.isArray(e)?e:e?[e]:[])}}}function ku(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);wu(e,0,0,r)}var Au={tokenize:Wu,partial:!0},ju={tokenize:Gu,partial:!0},Mu={tokenize:Ku,partial:!0},Nu={tokenize:qu,partial:!0},Pu={tokenize:Ju,partial:!0},Fu={name:`wwwAutolink`,tokenize:Hu,previous:Yu},Iu={name:`protocolAutolink`,tokenize:Uu,previous:Xu},Lu={name:`emailAutolink`,tokenize:Vu,previous:Zu},Ru={};function zu(){return{text:Ru}}for(var Bu=48;Bu<123;)Ru[Bu]=Lu,Bu++,Bu===58?Bu=65:Bu===91&&(Bu=97);Ru[43]=Lu,Ru[45]=Lu,Ru[46]=Lu,Ru[95]=Lu,Ru[72]=[Lu,Iu],Ru[104]=[Lu,Iu],Ru[87]=[Lu,Fu],Ru[119]=[Lu,Fu];function Vu(e,t,n){let r=this,i,a;return o;function o(t){return!Qu(t)||!Zu.call(r,r.previous)||$u(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Qu(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Pu,u,l)(t):t===45||t===95||Qs(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Zs(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Hu(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Yu.call(r,r.previous)||$u(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Au,e.attempt(ju,e.attempt(Mu,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Uu(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Xu.call(r,r.previous)&&!$u(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Zs(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||ec(t)||ic(t)||oc(t)||ac(t)?n(t):e.attempt(ju,e.attempt(Mu,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Wu(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Gu(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Nu,c,s)(t):t===null||ic(t)||oc(t)||t!==45&&ac(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Ku(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Nu,t,a)(o):o===null||ic(o)||oc(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function qu(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||ic(o)||oc(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||ic(e)||oc(e)?t(e):r(e)}function a(e){return Zs(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Zs(t)?(e.consume(t),o):n(t)}}function Ju(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Qs(e)?n(e):t(e)}}function Yu(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ic(e)}function Xu(e){return!Zs(e)}function Zu(e){return!(e===47||Qu(e))}function Qu(e){return e===43||e===45||e===46||e===95||Qs(e)}function $u(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function ed(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Qs(e.charCodeAt(n+1))&&Qs(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function td(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var nd={name:`attention`,resolveAll:rd,tokenize:id};function rd(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ad(d,-c),ad(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Tu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Tu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Tu(l,td(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Tu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Tu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,wu(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function id(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=hl(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=hl(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function ad(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var od={name:`autolink`,tokenize:sd};function sd(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Zs(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Qs(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Qs(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||ec(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):$s(t)?(e.consume(t),l):n(t)}function u(e){return Qs(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Qs(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function G(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return W(r)?(e.enter(n),s(r)):t(r)}function s(r){return W(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var cd={partial:!0,tokenize:ld};function ld(e,t,n){return r;function r(t){return W(t)?G(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||U(e)?t(e):n(e)}}var ud={continuation:{tokenize:fd},exit:pd,name:`blockQuote`,tokenize:dd};function dd(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return W(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function fd(e,t,n){let r=this;return i;function i(t){return W(t)?G(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ud,t,n)(r)}}function pd(e){e.exit(`blockQuote`)}var md={name:`characterEscape`,tokenize:hd};function hd(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return rc(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var gd={name:`characterReference`,tokenize:_d};function _d(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Qs,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=nc,u):(e.enter(`characterReferenceValue`),a=7,o=tc,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Qs&&!ru(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var vd={partial:!0,tokenize:xd},yd={concrete:!0,name:`codeFenced`,tokenize:bd};function bd(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),W(t)?G(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||U(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(vd,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),G(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||U(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&W(t)?G(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||U(t)?e.check(vd,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||U(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),W(t)?G(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),W(t)?G(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||U(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function xd(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Sd={name:`codeIndented`,tokenize:wd},Cd={partial:!0,tokenize:Td};function wd(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),G(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):U(t)?e.attempt(Cd,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||U(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Td(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):G(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):U(e)?i(e):n(e)}}var Ed={name:`codeText`,previous:Od,resolve:Dd,tokenize:kd};function Dd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Od(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function kd(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||U(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Ad=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&jd(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),jd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);jd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);jd(this.left,t.reverse())}}}};function jd(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Md(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Ad(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Nd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return wu(e,0,1/0,u.slice(0)),!l}function Nd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Pd={resolve:Id,tokenize:Ld},Fd={partial:!0,tokenize:Rd};function Id(e){return Md(e),e}function Ld(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):U(t)?e.check(Fd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Rd(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,a,`linePrefix`)}function a(i){if(i===null||U(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function zd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||ec(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||U(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||ic(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||ec(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Bd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):U(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||U(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!W(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Vd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||U(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Hd(e,t){let n;return r;function r(i){return U(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):W(i)?G(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ud={name:`definition`,tokenize:Gd},Wd={partial:!0,tokenize:Kd};function Gd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Bd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=kc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return ic(t)?Hd(e,l)(t):l(t)}function l(t){return zd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Wd,d,d)(t)}function d(t){return W(t)?G(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||U(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Kd(e,t,n){return r;function r(t){return ic(t)?Hd(e,i)(t):n(t)}function i(t){return Vd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return W(t)?G(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||U(e)?t(e):n(e)}}var qd={name:`hardBreakEscape`,tokenize:Jd};function Jd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return U(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Yd={name:`headingAtx`,resolve:Xd,tokenize:Zd};function Xd(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},wu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Zd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||ic(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||U(n)?(e.exit(`atxHeading`),t(n)):W(n)?G(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||ic(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Qd=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),$d=[`pre`,`script`,`style`,`textarea`],ef={concrete:!0,name:`htmlFlow`,resolveTo:rf,tokenize:af},tf={partial:!0,tokenize:sf},nf={partial:!0,tokenize:of};function rf(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function af(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):Zs(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Zs(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:E:m):n(i)}function h(t){return Zs(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||ic(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&$d.includes(l)?(i=1,r.interrupt?t(s):E(s)):Qd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):E(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Qs(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:E):n(i)}function v(t){return W(t)?(e.consume(t),v):T(t)}function y(t){return t===47?(e.consume(t),T):t===58||t===95||Zs(t)?(e.consume(t),b):W(t)?(e.consume(t),y):T(t)}function b(t){return t===45||t===46||t===58||t===95||Qs(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),ee):W(t)?(e.consume(t),x):y(t)}function ee(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,S):W(t)?(e.consume(t),ee):C(t)}function S(t){return t===c?(e.consume(t),c=null,w):t===null||U(t)?n(t):(e.consume(t),S)}function C(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||ic(t)?x(t):(e.consume(t),C)}function w(e){return e===47||e===62||W(e)?y(e):n(e)}function T(t){return t===62?(e.consume(t),te):n(t)}function te(t){return t===null||U(t)?E(t):W(t)?(e.consume(t),te):n(t)}function E(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):U(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(tf,ue,D)(t)):t===null||U(t)?(e.exit(`htmlFlowData`),D(t)):(e.consume(t),E)}function D(t){return e.check(nf,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||U(t)?D(t):(e.enter(`htmlFlowData`),E(t))}function ie(t){return t===45?(e.consume(t),ce):E(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):E(t)}function oe(t){if(t===62){let n=o.toLowerCase();return $d.includes(n)?(e.consume(t),le):E(t)}return Zs(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):E(t)}function se(t){return t===93?(e.consume(t),ce):E(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):E(t)}function le(t){return t===null||U(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function of(e,t,n){let r=this;return i;function i(t){return U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function sf(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(cd,t,n)}}var cf={name:`htmlText`,tokenize:lf};function lf(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Zs(t)?(e.consume(t),C):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Zs(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):U(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):U(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):U(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):U(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return Zs(t)?(e.consume(t),ee):n(t)}function ee(t){return t===45||Qs(t)?(e.consume(t),ee):S(t)}function S(t){return U(t)?(o=S,ae(t)):W(t)?(e.consume(t),S):ie(t)}function C(t){return t===45||Qs(t)?(e.consume(t),C):t===47||t===62||ic(t)?w(t):n(t)}function w(t){return t===47?(e.consume(t),ie):t===58||t===95||Zs(t)?(e.consume(t),T):U(t)?(o=w,ae(t)):W(t)?(e.consume(t),w):ie(t)}function T(t){return t===45||t===46||t===58||t===95||Qs(t)?(e.consume(t),T):te(t)}function te(t){return t===61?(e.consume(t),E):U(t)?(o=te,ae(t)):W(t)?(e.consume(t),te):w(t)}function E(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,D):U(t)?(o=E,ae(t)):W(t)?(e.consume(t),E):(e.consume(t),ne)}function D(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):U(t)?(o=D,ae(t)):(e.consume(t),D)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||ic(t)?w(t):(e.consume(t),ne)}function re(e){return e===47||e===62||ic(e)?w(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return W(t)?G(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var uf={name:`labelEnd`,resolveAll:mf,resolveTo:hf,tokenize:gf},df={tokenize:_f},ff={tokenize:vf},pf={tokenize:yf};function mf(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&wu(e,0,e.length,n),e}function hf(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Tu(s,e.slice(a+1,a+r+3)),s=Tu(s,[[`enter`,u,t]]),s=Tu(s,td(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Tu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Tu(s,e.slice(o+1)),s=Tu(s,[[`exit`,c,t]]),wu(e,a,e.length,s),e}function gf(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(kc(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(df,u,o?u:d)(t):t===91?e.attempt(ff,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(pf,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function _f(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return ic(t)?Hd(e,a)(t):a(t)}function a(t){return t===41?u(t):zd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return ic(t)?Hd(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Vd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return ic(t)?Hd(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function vf(e,t,n){let r=this;return i;function i(t){return Bd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(kc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function yf(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var bf={name:`labelStartImage`,resolveAll:uf.resolveAll,tokenize:xf};function xf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Sf={name:`labelStartLink`,resolveAll:uf.resolveAll,tokenize:Cf};function Cf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var wf={name:`lineEnding`,tokenize:Tf};function Tf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}}var Ef={name:`thematicBreak`,tokenize:Df};function Df(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||U(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),W(t)?G(e,s,`whitespace`)(t):s(t))}}var Of={continuation:{tokenize:Mf},exit:Pf,name:`list`,tokenize:jf},kf={partial:!0,tokenize:Ff},Af={partial:!0,tokenize:Nf};function jf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:tc(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Ef,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return tc(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(cd,r.interrupt?n:u,e.attempt(kf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return W(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Mf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(cd,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,G(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!W(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Af,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,G(e,e.attempt(Of,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Nf(e,t,n){let r=this;return G(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Pf(e){e.exit(this.containerState.type)}function Ff(e,t,n){let r=this;return G(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!W(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var If={name:`setextUnderline`,resolveTo:Lf,tokenize:Rf};function Lf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Rf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),W(t)?G(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||U(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var zf={tokenize:qf,partial:!0};function Bf(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Wf,continuation:{tokenize:Gf},exit:Kf}},text:{91:{name:`gfmFootnoteCall`,tokenize:Uf},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Vf,resolveTo:Hf}}}}function Vf(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=kc(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Hf(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Uf(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||ic(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(kc(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return ic(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Wf(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||ic(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=kc(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return ic(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),G(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Gf(e,t,n){return e.check(cd,t,e.attempt(zf,t,n))}function Kf(e){e.exit(`gfmFootnoteDefinition`)}function qf(e,t,n){let r=this;return G(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Jf(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&wu(o,o.length,0,td(s,e.slice(r+1,n),t)),wu(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),wu(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=hl(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=hl(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Yf=class{constructor(){this.map=[]}add(e,t,n){Xf(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Xf(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Zf(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Qf(){return{flow:{null:{name:`table`,tokenize:$f,resolveAll:ep}}}}function $f(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?ee:c;return a===ee&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):U(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):W(t)?G(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||ic(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,W(t)?G(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return W(t)?G(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||U(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return W(t)?G(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||U(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function ee(t){return e.enter(`tableRow`),S(t)}function S(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),S):n===null||U(n)?(e.exit(`tableRow`),t(n)):W(n)?G(e,S,`whitespace`)(n):(e.enter(`data`),C(n))}function C(t){return t===null||t===124||ic(t)?(e.exit(`data`),S(t)):(e.consume(t),t===92?w:C)}function w(t){return t===92||t===124?(e.consume(t),C):C(t)}}function ep(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Yf;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(np(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=tp(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=tp(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=tp(f,t,o,i,n,d)):(o[0]=o[1],d=tp(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&np(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Zf(t.events,n))}return e}function tp(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},rp(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=rp(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=rp(t.events,n[2]),a=rp(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},rp(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function np(e,t,n,r,i){let a=[],o=rp(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function rp(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var ip={name:`tasklistCheck`,tokenize:op};function ap(){return{text:{91:ip}}}function op(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return ic(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return U(r)?t(r):W(r)?e.check({tokenize:sp},t,n)(r):n(r)}}function sp(e,t,n){return G(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function cp(e){return Du([zu(),Bf(),Jf(e),Qf(),ap()])}var lp={};function up(e){let t=this,n=e||lp,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(cp(n)),a.push(Su()),o.push(Cu(n))}var dp=Object.defineProperty,fp=Object.defineProperties,pp=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertySymbols,hp=Object.prototype.hasOwnProperty,gp=Object.prototype.propertyIsEnumerable,_p=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||={})hp.call(t,n)&&_p(e,n,t[n]);if(mp)for(var n of mp(t))gp.call(t,n)&&_p(e,n,t[n]);return e},yp=(e,t)=>fp(e,pp(t)),bp={PROSE:0,FENCE_MARKER:1,FENCE_INFO:2,FENCE_BODY:3,CODE_SPAN:4,CODE_SPAN_OPEN:5},xp=/^(`{3,}|~{3,})(.*)$/,Sp=e=>e!==void 0&&e>=`0`&&e<=`9`,Cp=(e,t)=>{let n=t;if(e[n]===`-`||e[n]===`*`||e[n]===`+`)n+=1;else{for(;Sp(e[n])&&n-t<9;)n+=1;if(n===t||e[n]!==`.`&&e[n]!==`)`)return-1;n+=1}return e[n]===` `?n+1:-1},wp=(e,t,n)=>{let r=0,i=t,a=!1,o=t;for(;;){for(;o<n&&e[o]===` `;)o+=1;if(e[o]===`>`){r+=1,o+=e[o+1]===` `?2:1,i=o,a=!1;continue}let t=o<n?Cp(e,o):-1;if(t===-1)return{contentStart:o,listIndent:a?o-i:0,quoteDepth:r};o=t,a=!0}},Tp=(e,t,n,r)=>{let i=t;for(let t=0;t<r;t+=1){for(;i<n&&e[i]===` `;)i+=1;if(e[i]!==`>`)return-1;i+=1,e[i]===` `&&(i+=1)}return i},Ep=(e,t,n,r,i)=>{let a=t+r;e.fill(bp.FENCE_MARKER,a,a+i),e.fill(bp.FENCE_INFO,a+i,Math.min(n+1,e.length))},Dp=(e,t,n,r)=>{let i=t;for(;i<n&&e[i]===` `;)i+=1;let a=0;for(;i<n&&e[i]===r.char;)i+=1,a+=1;if(a<r.length)return!1;for(;i<n;){if(e[i]!==` `&&e[i]!==` `&&e[i]!==`\r`)return!1;i+=1}return!0},Op=(e,t,n,r)=>{let i=r>n&&e[r-1]===`\r`?r-1:r,a=wp(e,n,i),o=e.slice(a.contentStart,i).match(xp);if(!o)return null;let[,s,c]=o,l=s[0];return l==="`"&&c.includes("`")?null:(Ep(t,n,r,a.contentStart-n,s.length),{char:l,length:s.length,listIndent:a.listIndent,quoteDepth:a.quoteDepth})},kp=(e,t,n,r)=>{let i=Tp(e,t,n,r.quoteDepth);if(i===-1||r.listIndent===0)return i;let a=i;for(;a<n&&e[a]===` `;)a+=1;return a===n||e[a]===`\r`&&a+1===n||a-i>=r.listIndent?i:-1},Ap=(e,t)=>{let n=e.length,r=null,i=0;for(;i<n;){let a=e.indexOf(`
19
+ `,i);a===-1&&(a=n);let o=r?kp(e,i,a,r):-1;r&&o===-1&&(r=null),r?Dp(e,o,a,r)?(t.fill(bp.FENCE_MARKER,i,a),r=null):t.fill(bp.FENCE_BODY,i,Math.min(a+1,n)):r=Op(e,t,i,a),i=a+1}return r},jp=(e,t)=>{let n=t+1;for(;n<e.length&&e[n]==="`";)n+=1;return n},Mp=(e,t)=>{let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n+=1;return n<e.length&&e[n]===`
20
+ `},Np=(e,t,n)=>{let r=n;for(;;){let n=e.indexOf("`",r);if(n===-1)return-1;let i=n>r&&e[n-1]===`\\`&&t[n-1]===bp.PROSE;if(t[n]===bp.PROSE&&!i)return n;r=n+1}},Pp=(e,t)=>{let n=e.length,r=-1,i=0,a=0;for(;a<n;){if(r<0){if(a=Np(e,t,a),a===-1)break;let n=jp(e,a);r=a,i=n-a,a=n;continue}if(t[a]!==bp.PROSE){t.fill(bp.CODE_SPAN_OPEN,r,a),r=-1,a+=1;continue}if(e[a]===`
21
+ `&&Mp(e,a)){r=-1,a+=1;continue}if(e[a]!=="`"){a+=1;continue}let n=jp(e,a);n-a===i&&(t.fill(bp.CODE_SPAN,r,n),r=-1),a=n}return r>=0?(t.fill(bp.CODE_SPAN_OPEN,r,n),{start:r,runLength:i}):null},Fp=e=>{let t=new Uint8Array(e.length);return{text:e,regions:t,openFence:Ap(e,t),openSpan:Pp(e,t),mathMask:null,linkUrlMask:null,htmlTagMask:null}},Ip=null,Lp=null,Rp=e=>{if(Lp!==null&&e===Ip)return Lp;let t=Fp(e);return Ip=e,Lp=t,t},zp=()=>{Ip=null,Lp=null},Bp=(e,t)=>t>=e.regions.length?e.openFence!==null||e.openSpan!==null:t<0?!1:e.regions[t]!==bp.PROSE,Vp=(e,t)=>e.regions[t]===bp.CODE_SPAN,Hp=(e,t)=>{let n=Rp(e),r=t+t,i=0;for(let t=e.indexOf(r);t!==-1;t=e.indexOf(r,t))n.regions[t]===bp.PROSE?(i+=1,t+=2):t+=1;return i},Up=new Uint8Array,Wp=e=>e===`inlineLatex`||e===`blockLatex`,Gp=(e,t)=>t===`[`&&e===`none`?`blockLatex`:t===`]`&&e===`blockLatex`?`none`:t===`(`&&e===`none`?`inlineLatex`:t===`)`&&e===`inlineLatex`?`none`:null,Kp=(e,t)=>t?e===`blockDollar`?`none`:`blockDollar`:e===`blockDollar`?e:e===`inlineDollar`?`none`:`inlineDollar`,qp=e=>e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`),Jp=(e,t,n)=>{let r=e[t+1];if(e[t]===`\\`){if(r===`$`)return{context:n,length:2};let e=Gp(n,r);return e===null?null:{context:e,length:2}}if(e[t]===`$`&&!Wp(n)){let e=r===`$`;return{context:Kp(n,e),length:e?2:1}}return null},Yp=e=>{let{text:t,regions:n}=e,r=t.length,i=new Uint8Array(r),a=`none`,o=0;for(;o<r;){i[o]=a===`none`?0:1;let e=n[o]===bp.PROSE?Jp(t,o,a):null;e===null?o+=1:(a=e.context,e.length===2&&(i[o+1]=a===`none`?0:1),o+=e.length)}return i},Xp=(e,t)=>t<0||t>=e.text.length?!1:(e.mathMask===null&&(e.mathMask=qp(e.text)?Yp(e):Up),e.mathMask[t]===1),Zp=(e,t,n,r)=>{let{text:i,regions:a}=e,o=new Uint8Array(n-t),s=0;for(let e=n-1;e>=t;--e)i[e]===`)`&&a[e]===bp.PROSE&&(s=1),o[e-t]=s;let c=!1;for(let e=t;e<n;e+=1)c&&o[e-t]===1&&(r[e]=1),a[e]===bp.PROSE&&(i[e]===`)`?c=!1:i[e]===`(`&&(c=e>0&&i[e-1]===`]`))},Qp=e=>{let{text:t}=e,n=t.length,r=new Uint8Array(n),i=0;for(;i<n;){let a=t.indexOf(`
22
+ `,i);a===-1&&(a=n),Zp(e,i,a,r),i=a+1}return r},$p=(e,t)=>t<0||t>=e.text.length?!1:(e.linkUrlMask===null&&(e.linkUrlMask=e.text.includes(`](`)?Qp(e):Up),e.linkUrlMask[t]===1),em=e=>{let{text:t,regions:n}=e,r=t.length,i=new Uint8Array(r),a=!1;for(let e=0;e<r;e+=1)if(t[e]===`
23
+ `)a=!1;else if(i[e]=+!!a,n[e]===bp.PROSE){if(t[e]===`>`)a=!1;else if(t[e]===`<`){let n=t[e+1];a=n!==void 0&&(n>=`a`&&n<=`z`||n>=`A`&&n<=`Z`||n===`/`)}}return i},tm=(e,t)=>t<0||t>=e.text.length?!1:(e.htmlTagMask===null&&(e.htmlTagMask=e.text.includes(`<`)?em(e):Up),e.htmlTagMask[t]===1),nm=(e,t)=>Bp(Rp(e),t),rm=(e,t)=>Vp(Rp(e),t),im=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,am=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(im,(t,n,r,i)=>nm(e,i)?t:`${n}\\>${r}`),om=(e,{delimiter:t,markerLength:n,regex:r})=>{let i=e.lastIndexOf(t,e.length-2),a=i===-1?e.length-1:i;return e.slice(Math.max(0,a-n+1)).match(r)},sm={delimiter:`*`,markerLength:2,regex:/(\*\*)([^*]*\*?)$/},cm={delimiter:`_`,markerLength:2,regex:/(__)([^_]*?)$/},lm={delimiter:`*`,markerLength:3,regex:/(\*\*\*)([^*]*?)$/},um={delimiter:`*`,markerLength:1,regex:/(\*)([^*]*?)$/},dm={delimiter:`_`,markerLength:1,regex:/(_)([^_]*?)$/},fm={delimiter:`~`,markerLength:2,regex:/(~~)([^~]*?)$/},pm={delimiter:`_`,markerLength:2,regex:/(__)([^_]+)_$/},mm={delimiter:`~`,markerLength:2,regex:/(~~)([^~]+)~$/},hm=/^[\s_~*`]*$/,gm=/^[\s]*[-*+][\s]+$/,_m=/[\p{L}\p{N}_]/u,vm=/^\*{4,}$/,ym=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95||_m.test(e)},bm=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},xm=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},Sm=(e,t)=>Xp(Rp(e),t),Cm=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;--n)if(e[n]===`
24
+ `){r=n+1;break}let i=e.length;for(let n=t;n<e.length;n+=1)if(e[n]===`
25
+ `){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},wm=(e,t,n,r)=>n===`\\`||Xp(e,t)?!0:n!==`*`&&r===`*`?(t<e.text.length-2?e.text[t+2]:``)!==`*`:n===`*`||(!n||n===` `||n===` `||n===`
26
+ `)&&(!r||r===` `||r===` `||r===`
27
+ `),Tm=e=>e===` `||e===` `||e===`
28
+ `,Em=(e,t)=>!!(e&&t&&ym(e)&&ym(t)),Dm=(e,t,n,r)=>{let i=Em(e,t),a=!!t&&!Tm(t),o=!!e&&!Tm(e);return i&&n%2==0&&!r?{count:!1}:o&&n%2==1||a?{count:!0,inWordAsteriskChain:i}:{count:!1}},Om=e=>{let t=Rp(e),n=0,r=!1,i=e.length;for(let a=0;a<i;a+=1){if(e[a]!==`*`||t.regions[a]!==bp.PROSE){ym(e[a])||(r=!1);continue}let o=a>0?e[a-1]:``,s=a<i-1?e[a+1]:``;if(wm(t,a,o,s))continue;let c=Dm(o,s,n,r);c.count&&(n+=1,r=c.inWordAsteriskChain)}return n},km=(e,t,n,r)=>!!(n===`\\`||Xp(e,t)||$p(e,t)||tm(e,t)||n===`_`||r===`_`||n&&r&&ym(n)&&ym(r)),Am=e=>{let t=Rp(e),n=0,r=e.length;for(let i=0;i<r;i+=1){if(e[i]!==`_`||t.regions[i]!==bp.PROSE)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;km(t,i,a,o)||(n+=1)}return n},jm=e=>{let t=Rp(e),n=0,r=0;for(let i=0;i<e.length;i+=1)e[i]===`*`&&t.regions[i]===bp.PROSE?r+=1:(r>=3&&(n+=Math.floor(r/3)),r=0);return r>=3&&(n+=Math.floor(r/3)),n},Mm=e=>Hp(e,`*`),Nm=e=>e===``||e===` `||e===` `||e===`
29
+ `,Pm=(e,t,n,r,i)=>{if(!(Nm(n)&&Nm(r)))return!1;if(t>i.lineEnd){let n=e.indexOf(`
30
+ `,t);i.lineEnd=n===-1?e.length:n,i.result=Cm(e,t,`_`)}return i.result},Fm=(e,t,n,r)=>{let i=e.text,a=t,o=!1;a>0&&i[a-1]===`\\`&&(a+=1,o=!0);let s=n-a;if(s<2)return!1;let c=a>0?i[a-1]:``,l=o?`\\`:c,u=n<i.length?i[n]:``;return ym(l)&&ym(u)||Pm(i,a,l,u,r)||Xp(e,a)||$p(e,a)||tm(e,a)?!1:Math.floor(s/2)%2==1},Im=e=>{let t=Rp(e),n=e.length,r={lineEnd:-1,result:!1},i=!1,a=0;for(;a<n;){if(e[a]!==`_`||t.regions[a]!==bp.PROSE){a+=1;continue}let o=a,s=a+1;for(;s<n&&e[s]===`_`&&t.regions[s]===bp.PROSE;)s+=1;a=s,Fm(t,o,s,r)&&(i=!i)}return i},Lm=(e,t,n)=>{if(!t||hm.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
31
+ `),i=r===-1?0:r+1,a=e.substring(i,n);return gm.test(a)&&t.includes(`
32
+ `)?!0:Cm(e,n,`*`)},Rm=e=>{let t=om(e,sm);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return nm(e,r)||rm(e,r)||Lm(e,n,r)?e:Mm(e)%2==1?n.endsWith(`*`)?`${e}*`:`${e}**`:e},zm=(e,t,n)=>{if(!t||hm.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
33
+ `),i=r===-1?0:r+1,a=e.substring(i,n);return gm.test(a)&&t.includes(`
34
+ `)?!0:Cm(e,n,`_`)},Bm=e=>{let t=om(e,cm);if(!t){let t=om(e,pm);if(t){let n=e.lastIndexOf(t[1]);if(!(nm(e,n)||rm(e,n))&&Im(e))return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return nm(e,r)||rm(e,r)||zm(e,n,r)?e:Im(e)?`${e}__`:e},Vm=(e,t)=>{let{text:n}=e;return n[t]===`*`&&e.regions[t]===bp.PROSE&&n[t-1]!==`*`&&n[t+1]!==`*`&&n[t-1]!==`\\`&&!Xp(e,t)},Hm=e=>{let t=Rp(e);for(let n=e.indexOf(`*`);n!==-1;n=e.indexOf(`*`,n+1)){if(!Vm(t,n))continue;let r=n>0?e[n-1]:``,i=n<e.length-1?e[n+1]:``,a=!r||Tm(r),o=!i||Tm(i);if(!(a&&o)&&!(r&&i&&ym(r)&&ym(i))&&!o)return n}return-1},Um=e=>{if(!om(e,um))return e;let t=Hm(e);if(t===-1||nm(e,t)||rm(e,t))return e;let n=e.substring(t+1);return!n||hm.test(n)?e:Om(e)%2==1?`${e}*`:e},Wm=e=>{let t=Rp(e);for(let n=e.indexOf(`_`);n!==-1;n=e.indexOf(`_`,n+1))if(t.regions[n]===bp.PROSE&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!Xp(t,n)&&!$p(t,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if(t&&r&&ym(t)&&ym(r))continue;return n}return-1},Gm=e=>{let t=e.length;for(;t>0&&e[t-1]===`
35
+ `;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},Km=e=>{if(!e.endsWith(`**`))return null;let t=e.slice(0,-2);if(Mm(t)%2!=1)return null;let n=t.indexOf(`**`),r=Wm(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},qm=e=>{if(!om(e,dm))return e;let t=Wm(e);if(t===-1)return e;let n=e.substring(t+1);if(!n||hm.test(n)||nm(e,t)||rm(e,t))return e;if(Am(e)%2==1){let t=Km(e);return t===null?Gm(e):t}return e},Jm=e=>{let t=Mm(e),n=Om(e);return t%2==0&&n%2==0},Ym=(e,t,n)=>!t||hm.test(t)||nm(e,n)||rm(e,n)?!0:Cm(e,n,`*`),Xm=e=>{if(vm.test(e))return e;let t=om(e,lm);if(!t)return e;let n=t[2];return Ym(e,n,e.lastIndexOf(t[1]))?e:jm(e)%2==1?Jm(e)?e:`${e}***`:e},Zm=/<[a-zA-Z/][^>]*$/,Qm=/[a-zA-Z/]/,$m=e=>e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`),eh=(e,t)=>{let n=e[t+1];return n!==void 0&&Qm.test(n)},th=e=>{let t=e.match(Zm);if(!t||t.index===void 0)return e;let n=$m(e);for(let r=t.index;r<e.length;r+=1)if(e[r]===`<`&&eh(e,r)&&!nm(e,r)&&!(n&&Sm(e,r)))return e.substring(0,r).trimEnd();return e},nh=e=>{let t=Rp(e);if(t.openFence)return e;let n=t.openSpan;if(!n)return e;let r=e.slice(n.start+n.runLength);if(!r||hm.test(r))return e;let i=0,a=e.length-1;for(;a>=0&&e[a]==="`";)i+=1,--a;return i>=n.runLength?e:e+"`".repeat(n.runLength-i)},rh=e=>Hp(e,`$`),ih=e=>{let t=Rp(e),n=0;for(let r=0;r<e.length;r+=1)e[r]===`\\`?r+=1:t.regions[r]===bp.PROSE&&e[r]===`$`&&(r+1<e.length&&e[r+1]===`$`?r+=1:n+=1);return n},ah=e=>{if(e.endsWith(`$`)&&!e.endsWith(`$$`))return`${e}$`;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
36
+ `,t)!==-1&&!e.endsWith(`
37
+ `)?`${e}
38
+ $$`:`${e}$$`},oh=e=>rh(e)%2==0?e:ah(e),sh=e=>ih(e)%2==1?`${e}$`:e,ch=`streamdown:incomplete-image`,lh=(e,t,n)=>{if(e.substring(t+2).includes(`)`))return null;let r=bm(e,t);if(r===-1||nm(e,r))return null;let i=r>0&&e[r-1]===`!`,a=i?r-1:r,o=e.substring(0,a),s=e.substring(r+1,t);return i?`${o}![${s}](${ch})`:n===`text-only`?`${o}${s}`:`${o}[${s}](streamdown:incomplete-link)`},uh=(e,t)=>{for(let n=0;n<t;n++)if(e[n]===`[`&&!nm(e,n)){if(n>0&&e[n-1]===`!`)continue;let t=xm(e,n);if(t===-1)return n;if(t+1<e.length&&e[t+1]===`(`){let r=e.indexOf(`)`,t+2);r!==-1&&(n=r)}}return t},dh=(e,t,n)=>{let r=t>0&&e[t-1]===`!`,i=r?t-1:t;if(!e.substring(t+1).includes(`]`)||xm(e,t)===-1){let a=e.substring(0,i);if(r)return`${a}![${e.substring(t+1)}](${ch})`;if(n===`text-only`){let n=uh(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},fh=(e,t)=>{let n=e.lastIndexOf(`](`);if(n!==-1&&!nm(e,n)){let r=lh(e,n,t);if(r!==null)return r}for(let n=e.lastIndexOf(`[`);n!==-1;n=n===0?-1:e.lastIndexOf(`[`,n-1))if(!nm(e,n)){let r=dh(e,n,t);if(r!==null)return r}return e},ph=32,mh=(e,t=`protocol`)=>{let n=e;for(let e=0;e<ph;e+=1){let e=fh(n,t);if(e.length>=n.length)return e;n=e}return n},hh=/^-{1,2}$/,gh=/^[\s]*-{1,2}[\s]+$/,_h=/^={1,2}$/,vh=/^[\s]*={1,2}[\s]+$/,yh=e=>{if(!e||typeof e!=`string`)return e;let t=e.lastIndexOf(`
39
+ `);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(hh.test(i)&&!n.match(gh)){let t=r.split(`
40
+ `).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(_h.test(i)&&!n.match(vh)){let t=r.split(`
41
+ `).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},bh=/([\p{L}\p{N}_])~(?!~)(?=[\p{L}\p{N}_])/gu,xh=e=>!e||typeof e!=`string`||!e.includes(`~`)?e:e.replace(bh,(t,n,r)=>nm(e,r+n.length)?t:`${n}\\~`),Sh=e=>Hp(e,`~`),Ch=e=>{let t=om(e,fm);if(t){let n=t[2];if(!n||hm.test(n))return e;let r=e.lastIndexOf(t[1]);if(nm(e,r)||rm(e,r))return e;if(Sh(e)%2==1)return`${e}~~`}else{let t=om(e,mm);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(nm(e,n)||rm(e,n))return e;if(Sh(e)%2==1)return`${e}~`}}return e},wh=e=>e!==!1,Th=e=>e===!0,Eh={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},Dh=[{handler:{name:`singleTilde`,handle:xh,priority:Eh.SINGLE_TILDE},optionKey:`singleTilde`},{handler:{name:`comparisonOperators`,handle:am,priority:Eh.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:th,priority:Eh.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:yh,priority:Eh.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:mh,priority:Eh.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)||e.endsWith(`](streamdown:incomplete-image)`)},{handler:{name:`boldItalic`,handle:Xm,priority:Eh.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:Rm,priority:Eh.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:Bm,priority:Eh.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:Um,priority:Eh.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:qm,priority:Eh.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:nh,priority:Eh.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:Ch,priority:Eh.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:oh,priority:Eh.KATEX},optionKey:`katex`},{handler:{name:`inlineKatex`,handle:sh,priority:Eh.INLINE_KATEX},optionKey:`inlineKatex`}],Oh=e=>{let t=e?.linkMode??`protocol`;return Dh.filter(({handler:t,optionKey:n})=>t.name===`links`?wh(e?.links)||wh(e?.images):t.name===`inlineKatex`?Th(e?.inlineKatex):wh(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:yp(vp({},e),{handle:e=>mh(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},kh=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=Oh(t),i=(t?.handlers??[]).map(e=>({handler:yp(vp({},e),{priority:e.priority??Eh.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));try{for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n.endsWith(` `)&&!n.endsWith(` `)?n.slice(0,-1):n}finally{zp()}},Ah=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jh=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mh={};function Nh(e,t){return((t||Mh).jsx?jh:Ah).test(e)}var Ph=/[ \t\n\f\r]/g;function Fh(e){return typeof e==`object`?e.type===`text`&&Ih(e.value):Ih(e)}function Ih(e){return e.replace(Ph,``)===``}var Lh=T(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
42
+ `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Rh=T(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(Lh());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),zh=T((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Bh=T(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Rh()),i=zh();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a}));function Vh(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Uh(e.position):`start`in e||`end`in e?Uh(e):`line`in e||`column`in e?Hh(e):``}function Hh(e){return Wh(e&&e.line)+`:`+Wh(e&&e.column)}function Uh(e){return Hh(e&&e.start)+`-`+Hh(e&&e.end)}function Wh(e){return e&&typeof e==`number`?e:1}var Gh=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Vh(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Gh.prototype.file=``,Gh.prototype.name=``,Gh.prototype.reason=``,Gh.prototype.message=``,Gh.prototype.stack=``,Gh.prototype.column=void 0,Gh.prototype.line=void 0,Gh.prototype.ancestors=void 0,Gh.prototype.cause=void 0,Gh.prototype.fatal=void 0,Gh.prototype.place=void 0,Gh.prototype.ruleId=void 0,Gh.prototype.source=void 0;var Kh=S(Bh(),1),qh={}.hasOwnProperty,Jh=new Map,Yh=/[A-Z]/g,Xh=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Zh=new Set([`td`,`th`]),Qh=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $h(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ug(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=lg(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?ln:cn,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=eg(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function eg(e,t,n){if(t.type===`element`)return tg(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ng(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ig(e,t,n);if(t.type===`mdxjsEsm`)return rg(e,t);if(t.type===`root`)return ag(e,t,n);if(t.type===`text`)return og(e,t)}function tg(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=ln,e.schema=i),e.ancestors.push(t);let a=gg(e,t.tagName,!1),o=dg(e,t),s=pg(e,t);return Xh.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Fh(e)})),sg(e,o,a,t),cg(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ng(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}_g(e,t.position)}function rg(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_g(e,t.position)}function ig(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=ln,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:gg(e,t.name,!0),o=fg(e,t),s=pg(e,t);return sg(e,o,a,t),cg(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ag(e,t,n){let r={};return cg(r,pg(e,t)),e.create(t,e.Fragment,r,n)}function og(e,t){return t.value}function sg(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cg(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function lg(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ug(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=ss(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function dg(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qh.call(t.properties,i)){let a=mg(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Zh.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function fg(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else _g(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else _g(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function pg(e,t){let n=[],r=-1,i=e.passKeys?new Map:Jh;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=eg(e,a,o);s!==void 0&&n.push(s)}return n}function mg(e,t,n){let r=an(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?dn(n):hn(n)),r.property===`style`){let t=typeof n==`object`?n:hg(e,String(n));return e.stylePropertyNameCase===`css`&&(t=vg(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?en[r.property]||r.property:r.attribute,n]}}function hg(e,t){try{return(0,Kh.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Gh("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Qh+`#cannot-parse-style-attribute`,r}}function gg(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Nh(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Nh(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return qh.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);_g(e)}function _g(e,t){let n=new Gh("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Qh+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function vg(e){let t={},n;for(n in e)qh.call(e,n)&&(t[yg(n)]=e[n]);return t}function yg(e){let t=e.replace(Yh,bg);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function bg(e){return`-`+e.toLowerCase()}var xg={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Sg={tokenize:Cg};function Cg(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return U(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var wg={tokenize:Eg},Tg={tokenize:Dg};function Eg(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return wu(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Tg,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Tg,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return U(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;wu(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Dg(e,t,n){return G(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var Og={tokenize:kg};function kg(e){let t=this,n=e.attempt(cd,r,e.attempt(this.parser.constructs.flowInitial,i,G(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Pd,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Ag={resolveAll:Pg()},jg=Ng(`string`),Mg=Ng(`text`);function Ng(e){return{resolveAll:Pg(e===`text`?Fg:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Pg(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Fg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ig=C({attentionMarkers:()=>Wg,contentInitial:()=>Rg,disable:()=>Gg,document:()=>Lg,flow:()=>Bg,flowInitial:()=>zg,insideSpan:()=>Ug,string:()=>Vg,text:()=>Hg}),Lg={42:Of,43:Of,45:Of,48:Of,49:Of,50:Of,51:Of,52:Of,53:Of,54:Of,55:Of,56:Of,57:Of,62:ud},Rg={91:Ud},zg={[-2]:Sd,[-1]:Sd,32:Sd},Bg={35:Yd,42:Ef,45:[If,Ef],60:ef,61:If,95:Ef,96:yd,126:yd},Vg={38:gd,92:md},Hg={[-5]:wf,[-4]:wf,[-3]:wf,33:bf,38:gd,42:nd,60:[od,cf],91:Sf,92:[qd,md],93:uf,95:nd,96:Ed},Ug={null:[nd,Ag]},Wg={null:[42,95]},Gg={null:[]};function Kg(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:S(x),check:S(ee),consume:v,enter:y,exit:b,interrupt:S(ee,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Tu(o,e),g(),o[o.length-1]===null?(C(t,0),l.events=td(a,l.events,l),l.events):[]}function f(e,t){return Jg(p(e),t)}function p(e){return qg(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,T()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){U(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,T()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){C(e,t.from)}function ee(e,t){t.restore()}function S(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=w(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function C(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&wu(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function w(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function qg(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Jg(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
43
+ `;break;case-3:o=`\r
44
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Yg(e){let t={constructs:Du([Ig,...(e||{}).extensions||[]]),content:n(Sg),defined:[],document:n(wg),flow:n(Og),lazy:{},string:n(jg),text:n(Mg)};return t;function n(e){return n;function n(n){return Kg(t,e,n)}}}function Xg(e){for(;!Md(e););return e}var Zg=/[\0\t\n\r]/g;function Qg(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Zg.lastIndex=u,c=Zg.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var $g={}.hasOwnProperty;function e_(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),t_(n)(Xg(Yg(n).document().write(Qg()(e,t,!0))))}function t_(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Ee),autolinkProtocol:w,autolinkEmail:w,atxHeading:a(Se),blockQuote:a(ve),characterEscape:w,characterReference:w,codeFenced:a(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ye,o),codeText:a(be,o),codeTextData:w,data:w,codeFlowValue:w,definition:a(O),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(xe),hardBreakEscape:a(Ce),hardBreakTrailing:a(Ce),htmlFlow:a(we,o),htmlFlowData:w,htmlText:a(we,o),htmlTextData:w,image:a(Te),label:o,link:a(Ee),listItem:a(De),listItemValue:f,listOrdered:a(k,d),listUnordered:a(k),paragraph:a(Oe),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Se),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:_e,autolinkProtocol:ge,blockQuote:c(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:me,characterReference:he,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:c(_),codeText:c(re),codeTextData:T,data:T,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(D),htmlFlowData:T,htmlText:c(ne),htmlTextData:T,image:c(ae),label:se,labelText:oe,lineEnding:te,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:fe,resourceDestinationString:ce,resourceTitleString:le,resource:ue,setextHeading:c(C),setextHeadingLineSequence:S,setextHeadingText:ee,strong:c(),thematicBreak:c()}};r_(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];$g.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||a_).call(a,void 0,e[0])}for(r.position={start:n_(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:n_(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:n_(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||a_).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Vh({start:e.start,end:e.end})+`): it’s not open`);n.position.end=n_(e.end)}function u(){return bl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=kc(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function ee(){this.data.setextHeadingSlurpLineEnding=!0}function S(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function w(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=Ae(),n.position={start:n_(e.start),end:void 0},t.push(n)),this.stack.push(n)}function T(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=n_(e.end)}function te(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=n_(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(w.call(this,e),T.call(this,e))}function E(){this.data.atHardBreak=!0}function D(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ou(t),n.identifier=kc(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ue(){this.data.inReference=void 0}function de(){this.data.referenceType=`collapsed`}function fe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=kc(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function pe(e){this.data.characterReferenceType=e.type}function me(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=iu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ru(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=n_(e.end)}function ge(e){T.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function _e(e){T.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ve(){return{type:`blockquote`,children:[]}}function ye(){return{type:`code`,lang:null,meta:null,value:``}}function be(){return{type:`inlineCode`,value:``}}function O(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function xe(){return{type:`emphasis`,children:[]}}function Se(){return{type:`heading`,depth:0,children:[]}}function Ce(){return{type:`break`}}function we(){return{type:`html`,value:``}}function Te(){return{type:`image`,title:null,url:``,alt:null}}function Ee(){return{type:`link`,title:null,url:``,children:[]}}function k(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function n_(e){return{line:e.line,column:e.column,offset:e.offset}}function r_(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?r_(e,r):i_(e,r)}}function i_(e,t){let n;for(n in t)if($g.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function a_(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Vh({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vh({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Vh({start:t.start,end:t.end})+`) is still open`)}function o_(e){let t=this;t.parser=n;function n(n){return e_(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function s_(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function c_(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
45
+ `}]}function l_(e,t){let n=t.value?t.value+`
46
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function u_(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d_(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function f_(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ed(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function p_(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function m_(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function h_(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function g_(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return h_(e,t);let i={src:ed(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function __(e,t){let n={src:ed(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function v_(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function y_(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return h_(e,t);let i={href:ed(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function b_(e,t){let n={href:ed(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function x_(e,t,n){let r=e.all(t),i=n?S_(n):C_(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
47
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
48
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function S_(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=C_(n[r])}return t}function C_(e){return e.spread??e.children.length>1}function w_(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function T_(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E_(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function D_(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function O_(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=ss(t.children[1]),o=os(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function k_(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function A_(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var j_=9,M_=32;function N_(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(P_(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(P_(t.slice(i),i>0,!1)),a.join(``)}function P_(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===j_||t===M_;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===j_||t===M_;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function F_(e,t){let n={type:`text`,value:N_(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function I_(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var L_={blockquote:s_,break:c_,code:l_,delete:u_,emphasis:d_,footnoteReference:f_,heading:p_,html:m_,imageReference:g_,image:__,inlineCode:v_,linkReference:y_,link:b_,listItem:x_,list:w_,paragraph:T_,root:E_,strong:D_,table:O_,tableCell:A_,tableRow:k_,text:F_,thematicBreak:I_,toml:R_,yaml:R_,definition:R_,footnoteDefinition:R_};function R_(){}function z_(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function B_(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function V_(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||z_,r=e.options.footnoteBackLabel||B_,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=ed(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...kt(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
49
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
50
+ `}]}}var H_={}.hasOwnProperty,U_={};function W_(e,t){let n=t||U_,r=new Map,i=new Map,a={all:s,applyData:K_,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...L_,...n.handlers},one:o,options:n,patch:G_,wrap:J_};return it(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(H_.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=kt(n);return r.children=a.all(e),r}return kt(e)}return(a.options.unknownHandler||q_)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Y_(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Y_(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function G_(e,t){e.position&&(t.position=ls(e))}function K_(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,kt(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function q_(e,t){let n=t.data||{},r=`value`in t&&!(H_.call(n,`hProperties`)||H_.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function J_(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
51
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
52
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
53
+ `}),n}function Y_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function X_(e,t){let n=W_(e,t),r=n.one(e,void 0),i=V_(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
54
+ `},i)),a}function Z_(e,t){return e&&`run`in e?async function(n,r){let i=X_(n,{file:r,...t});await e.run(i,r)}:function(n,r){return X_(n,{file:r,...e||t})}}function Q_(e){if(e)throw e}var $_=T(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function ev(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function tv(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?nv(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function nv(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var rv={basename:iv,dirname:av,extname:ov,join:sv,sep:`/`};function iv(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);uv(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function av(e){if(uv(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ov(e){uv(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function sv(...e){let t=-1,n;for(;++t<e.length;)uv(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:cv(n)}function cv(e){uv(e);let t=e.codePointAt(0)===47,n=lv(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function lv(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function uv(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var dv={cwd:fv};function fv(){return`/`}function pv(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function mv(e){if(typeof e==`string`)e=new URL(e);else if(!pv(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return hv(e)}function hv(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var gv=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],_v=class{constructor(e){let t;t=e?pv(e)?{path:e}:typeof e==`string`||xv(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:dv.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<gv.length;){let e=gv[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)gv.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?rv.basename(this.path):void 0}set basename(e){yv(e,`basename`),vv(e,`basename`),this.path=rv.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?rv.dirname(this.path):void 0}set dirname(e){bv(this.basename,`dirname`),this.path=rv.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?rv.extname(this.path):void 0}set extname(e){if(vv(e,`extname`),bv(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=rv.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){pv(e)&&(e=mv(e)),yv(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?rv.basename(this.path,this.extname):void 0}set stem(e){yv(e,`stem`),vv(e,`stem`),this.path=rv.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Gh(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function vv(e,t){if(e&&e.includes(rv.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+rv.sep+"`")}function yv(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function bv(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function xv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Sv=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Cv=S($_(),1),wv={}.hasOwnProperty,Tv=new class e extends Sv{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tv()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Cv.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Ov(`data`,this.frozen),this.namespace[e]=t,this):wv.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ov(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=jv(e),n=this.parser||this.Parser;return Ev(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ev(`process`,this.parser||this.Parser),Dv(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=jv(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Nv(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Ev(`processSync`,this.parser||this.Parser),Dv(`processSync`,this.compiler||this.Compiler),this.process(e,r),Av(`processSync`,`process`,t),n;function r(e,r){t=!0,Q_(e),n=r}}run(e,t,n){kv(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=jv(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Av(`runSync`,`run`,n),r;function i(e,t){Q_(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=jv(t),r=this.compiler||this.Compiler;return Dv(`stringify`,r),kv(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Ov(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Cv.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];ev(o)&&ev(r)&&(r=(0,Cv.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ev(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Dv(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Ov(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function kv(e){if(!ev(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Av(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function jv(e){return Mv(e)?e:new _v(e)}function Mv(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Nv(e){return typeof e==`string`||Pv(e)}function Pv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Fv=S(ke(),1),Iv=300,Lv=`300px`,Rv=500;function zv(e={}){let{immediate:t=!1,debounceDelay:n=Iv,rootMargin:r=Lv,idleTimeout:i=Rv}=e,[a,o]=(0,A.useState)(!1),s=(0,A.useRef)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(null),u=(0,A.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,A.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,A.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,A.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var Bv=320,Vv=4,Hv=()=>typeof performance>`u`?Date.now():performance.now();function Uv(e){let t=e?.now??Hv,n=e?.maxBacklogMs??Bv,r=0,i=0;return{now:t,beginPass(e){i=Math.min(Math.max(r,e),e+n)},mark(){return i},rewind(e){i=e},take(e,t,r){if(e<=0)return{baseDelay:0,step:Math.max(0,t)};let a=Math.max(0,t),o=a===0?0:Math.min(a,Vv),s=Math.max(i,r),c=r+n,l=s+Math.max(0,e-1)*a,u=a;if(l>c&&e>1){if(s<c){let t=c-s;u=Math.max(o,t/(e-1))}else u=o}let d=Math.max(0,Math.round(s-r));return i=s+e*u,{baseDelay:d,step:u}},commitPass(){r=i}}}var Wv=/\s/,Gv=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\u3000-\u303F\uFF00-\uFFEF]/u,Kv=/^\s+$/,qv=new Set([`pre`,`svg`,`math`,`annotation`]),Jv=new Set([`img`,`hr`]),Yv=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,Xv=e=>e.some(e=>Yv(e)&&qv.has(e.tagName)),Zv=e=>{for(let t=e.length-1;t>=0;t--){let n=e[t];if(Yv(n)&&n.tagName===`li`)return n}},Qv=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate-marker`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(n)}ms;--sd-marker-easing:${r}`},$v=new Set([`ul`,`ol`,`li`]),ey=e=>{for(let t of e.children)if(Yv(t)){if(t.tagName===`input`)return t;if($v.has(t.tagName))continue;let e=ey(t);if(e)return e}},ty=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${n}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(r)}ms`},ny=(e,t,n,r)=>{let i=ey(e);i&&ty(i,t,n,r)},ry=(e,t,n,r,i,a)=>{if(Xv(t))return;let o=r.prevContentLength,s=i.count;i.count+=1;let c=o>0&&s<o,l=c?0:a.baseDelay+i.newIndex++*a.step;ty(e,n,c?0:n.duration,l)},iy=e=>{var t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(Yv(r)){if((t=r.properties)!=null&&t[`data-sd-animated`])break;r.properties={...r.properties,"data-sd-animated":!0}}}},ay=e=>{let t=[],n=``,r=!1,i=!1;for(let a of e){let e=Wv.test(a),o=!e&&Gv.test(a);if(!e&&n!==``&&(o||i))t.push(n),n=``,r=!1;else if(e!==r&&n){if(e){n+=a,r=!0;continue}t.push(n),n=``}n+=a,r=e,i=o}return n&&t.push(n),t},oy=e=>{let t=[],n=``;for(let r of e)Wv.test(r)?t.length>0&&!Kv.test(t.at(-1))?t[t.length-1]+=r:n+=r:(n&&=(t.push(n),``),t.push(r));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},sy=/^[^\s;:'"\\/](?:[^;:'"\\/\r\n]*[^\s;:'"\\/])?$/,cy=(e,t,n,r)=>{let i=`sd-${t.animation}`,a=`${n?0:t.duration}ms`,o;return t.styleObjects?(o={"--sd-animation":i,"--sd-duration":a,"--sd-easing":t.easing},r&&(o[`--sd-delay`]=`${Math.round(r)}ms`)):(o=`--sd-animation:${i};--sd-duration:${a};--sd-easing:${t.easing}`,r&&(o+=`;--sd-delay:${Math.round(r)}ms`)),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},ly=(e,t)=>!(e>0&&t<e),uy=e=>Yv(e)&&Jv.has(e.tagName),dy=(e,t,n)=>{let r=0,i=0;return nt(e,e=>e.type===`text`||uy(e),(e,a)=>{if(Xv(a))return tt;if(uy(e)){ly(n,i)&&(r+=1),i+=1;return}let o=e.value;if(!o.trim()){i+=o.length;return}let s=t.sep===`char`?oy(o):ay(o);for(let e of s){let t=i;i+=e.length,!Kv.test(e)&&ly(n,t)&&(r+=1)}}),r},fy=(e,t,n,r,i,a)=>{var o;let s=t.at(-1);if(!(s&&`children`in s))return;if(Xv(t))return tt;let c=s,l=c.children.indexOf(e);if(l===-1)return;let u=e.value;if(!u.trim()){i.count+=u.length;return}let d=n.sep===`char`?oy(u):ay(u),f=r.prevContentLength,p=!1,m=Zv(t),h=!(!m||(o=m.properties)!=null&&o[`data-sd-animate-marker`]),g=!1,_=d.map(e=>{let t=i.count;if(i.count+=e.length,Kv.test(e))return{type:`text`,value:e};let r=f>0&&t<f,o=r?0:a.baseDelay+i.newIndex++*a.step;if(p=!0,m&&h&&!g){let e=r?0:n.duration;Qv(m,e,o,n.easing),ny(m,n,e,o),g=!0}return cy(e,n,r,o)});return p&&iy(t),c.children.splice(l,1,..._),l+_.length},py=0;function my(e){return gy(e,!1)}var hy=e=>gy(e,!0);function gy(e,t){let n=e?.animation??`fadeIn`,r=e?.easing??`ease`,i={animation:n,duration:e?.duration??150,easing:r,sep:e?.sep??`word`,stagger:e?.stagger??40,styleObjects:t&&sy.test(n)&&sy.test(r),timeline:e?.timeline},a={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},o=py++,s=()=>e=>{let t={count:0,newIndex:0};a.prevContentLength=a.committedCharCount;let n=i.timeline,r=n?.now()??Hv();n&&(a.pendingMark===null?a.pendingMark=n.mark():n.rewind(a.pendingMark));let o=n?n.take(dy(e,i,a.prevContentLength),i.stagger,r):{baseDelay:0,step:i.stagger};nt(e,e=>e.type===`text`||uy(e),(e,n)=>{if(e.type===`text`)return fy(e,n,i,a,t,o);ry(e,n,i,a,t,o)}),a.lastRenderCharCount=t.count,a.prevContentLength=0};return Object.defineProperty(s,"name",{value:`rehypeAnimate$${o}`}),{name:`animate`,type:`animate`,rehypePlugin:s,setPrevContentLength(e){a.committedCharCount=e,a.prevContentLength=e},getLastRenderCharCount(){return a.lastRenderCharCount},commit(){a.committedCharCount=a.lastRenderCharCount,a.pendingMark=null}}}my();var _y=(0,A.createContext)(!1),vy=()=>(0,A.useContext)(_y),yy=(...e)=>Oe(De(e)),by=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},xy=e=>e?(...t)=>by(e,Oe(De(t))):yy,Sy=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},Cy=(0,A.createContext)(yy),K=()=>(0,A.useContext)(Cy),wy=8,Ty=e=>{if(e!==void 0&&e!==0&&e!==1/0){if(typeof e==`number`)return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(e!==`0`&&e!==`none`&&e!==`Infinity`)return e}},Ey=(e,t,n)=>{let r=(0,A.useRef)(null),i=(0,A.useRef)(!0),a=(0,A.useRef)(!1),o=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let e=r.current;if(!(e&&t))return;let n=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<wy;i.current=t};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[t]),(0,A.useEffect)(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),(0,A.useEffect)(()=>()=>{o.current!==null&&cancelAnimationFrame(o.current)},[]),(0,A.useEffect)(()=>{let n=r.current;!(n&&t&&e&&i.current)||o.current!==null||(o.current=requestAnimationFrame(()=>{o.current=null,i.current&&n.scrollTo({top:n.scrollHeight,behavior:`instant`})}))},[e,t,n]),r},Dy=yy(`block`),Oy=yy(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),ky=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},Ay=(0,A.memo)(({children:e,result:t,language:n,className:r,maxHeight:i,startLine:a,lineNumbers:o=!0,...s})=>{let c=K(),{isAnimating:l}=(0,A.useContext)(KS),u=Ty(i),d=Ey(l,!!u,t),f=(0,A.useMemo)(()=>c(Oy),[c]),p=(0,A.useMemo)(()=>c(Dy),[c]),m=(0,A.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,ky(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,j.jsx)(`div`,{className:c(r,u?`overflow-y-auto`:null,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,ref:d,style:u?{maxHeight:u}:void 0,...s,children:(0,j.jsx)(`pre`,{className:c(r,`bg-[var(--sdm-bg,inherit)]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]`),style:m,children:(0,j.jsx)(`code`,{className:o?c(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:o&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((e,t)=>(0,j.jsx)(`span`,{className:o?f:p,children:e.length===0||e.length===1&&e[0].content===``?`
55
+ `:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,j.jsx)(`span`,{className:c(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})}),jy=({className:e,language:t,style:n,isIncomplete:r,...i})=>{let a=K();return(0,j.jsx)(`div`,{className:a(`relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i})},My=(0,A.createContext)({code:``}),Ny=()=>(0,A.useContext)(My),Py=({language:e})=>{let t=K();return(0,j.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,j.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},Fy=e=>{let t=e.length;for(;t>0&&e[t-1]===`
56
+ `;)t--;return e.slice(0,t)},Iy=(0,A.lazy)(()=>je(()=>import(`./highlighted-body-JLMTFACH-BcroQey-.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),Ly=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=K(),{codeBlockMaxHeight:l}=(0,A.useContext)(KS),u=(0,A.useMemo)(()=>Fy(e),[e]),d=(0,A.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
57
+ `).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,j.jsx)(My.Provider,{value:{code:e},children:(0,j.jsxs)(jy,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,j.jsx)(Py,{language:t}),r?(0,j.jsx)(`div`,{className:c(`pointer-events-none absolute top-2 right-2 z-10 flex items-center`),children:(0,j.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(Ay,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,j.jsx)(Iy,{className:n,code:u,isIncomplete:i,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},Ry={CheckIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,j.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,j.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,j.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,j.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,j.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},zy=(0,A.createContext)(Ry),By=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])},Vy=({icons:e,children:t})=>{let n=(0,A.useRef)(e),r=(0,A.useRef)(e?{...Ry,...e}:Ry);By(n.current,e)||(n.current=e,r.current=e?{...Ry,...e}:Ry);let i=r.current;return(0,j.jsx)(zy.Provider,{value:i,children:t})},Hy=()=>(0,A.useContext)(zy),Uy={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,mermaidAriaLabel:`Mermaid chart`,errorMermaid:`Failed to render Mermaid chart`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},Wy=(0,A.createContext)(Uy),Gy=()=>(0,A.useContext)(Wy),Ky=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=K(),[c,l]=(0,A.useState)(!1),u=(0,A.useRef)(0),{code:d}=Ny(),{isAnimating:f}=(0,A.useContext)(KS),p=Gy(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText))t?.(Error(`Clipboard API not available`));else try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,A.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=Hy(),_=c?g.CheckIcon:g.CopyIcon;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":p.copyCode,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,j.jsx)(_,{"aria-hidden":`true`,size:14})}),c&&(0,j.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},qy=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},Jy=(e,t)=>{if(typeof e==`boolean`)return{};let n=e[t];if(typeof n!=`object`)return{};let r=n.copy;return typeof r!=`object`||!r?{}:{onCopy:r.onCopy,onError:r.onError}},Yy={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},Xy=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=K(),{code:c}=Ny(),{isAnimating:l,controls:u}=(0,A.useContext)(KS),d=Gy(),f=Hy(),p=a??c,m=n&&n in Yy?Yy[n]:`txt`,h=`${qy(u,`code`,`file`)}.${m}`;return(0,j.jsx)(`button`,{"aria-label":d.downloadFile,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{Sy(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,j.jsx)(f.DownloadIcon,{size:14})})},Zy=()=>{let{Loader2Icon:e}=Hy(),t=K();return(0,j.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,j.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,j.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,j.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},Qy=/\.[^/.]+$/,$y=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=Hy(),u=K(),d=(0,A.useRef)(null),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),g=Gy(),_=c.width!=null||c.height!=null,v=(f||_)&&!m&&o&&s,y=m&&!_;(0,A.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let b=(0,A.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),x=(0,A.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),ee=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(Qy,``)}.${i}`}Sy(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?n===`streamdown:incomplete-image`?(0,j.jsx)(`div`,{className:u(`group relative my-4 inline-block`),"data-incomplete":`true`,"data-streamdown":`image-wrapper`,children:(0,j.jsx)(`div`,{className:u(`h-24 w-48 animate-pulse rounded-lg bg-muted`),"data-streamdown":`image-placeholder`})}):(0,j.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,j.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,y&&`hidden`,t),"data-streamdown":`image`,onError:x,onLoad:b,ref:d,src:n,...c}),y&&(0,j.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,j.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),v&&(0,j.jsx)(`button`,{className:u(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:ee,title:g.downloadImage,type:`button`,children:(0,j.jsx)(l,{size:14})})]}):null},eb=e=>(typeof e==`function`?e():e)??document.body,tb=0,nb=()=>{tb+=1,tb===1&&(document.body.style.overflow=`hidden`)},rb=()=>{tb=Math.max(0,tb-1),tb===0&&(document.body.style.overflow=``)},ib=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=Hy(),c=K(),[l,u]=(0,A.useState)(!1),d=Gy(),{portal:f}=(0,A.useContext)(KS),p=(0,A.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),m=(0,A.useCallback)(()=>{r(),n()},[r,n]);if((0,A.useEffect)(()=>{if(t){nb();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),rb()}}},[t,n]),!t||typeof document>`u`)return null;let h=(0,j.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,j.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,j.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,j.jsx)(s,{size:16})}),(0,j.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,j.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,j.jsx)(o,{size:20}),(0,j.jsx)(`span`,{children:d.openExternalLink})]}),(0,j.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,j.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,j.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,j.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:p,type:`button`,children:l?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i,{size:14}),(0,j.jsx)(`span`,{children:d.copied})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a,{size:14}),(0,j.jsx)(`span`,{children:d.copyLink})]})}),(0,j.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:m,type:`button`,children:[(0,j.jsx)(o,{size:14}),(0,j.jsx)(`span`,{children:d.openLink})]})]})]})});return(0,Fv.createPortal)(h,eb(f))},ab=(0,A.createContext)(null),ob=()=>(0,A.useContext)(ab),sb=()=>ob()?.code??null,cb=()=>ob()?.mermaid??null,lb=e=>{var t;let n=ob();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},ub=/<svg\b[^>]*>/i,db=/\bviewBox=(['"])(.*?)\1/i,fb=/[\s,]+/,pb=/\swidth=(['"]).*?\1/gi,mb=/\sheight=(['"]).*?\1/gi,hb=/\sstyle=(['"])(.*?)\1/i,gb=/^width\s*:/i,_b=/^height\s*:/i,vb=/^max-width\s*:/i,yb=/^<svg/i,bb=e=>{let t=e.match(ub);if(!t)return null;let n=t[0].match(db)?.[2];if(!n)return null;let r=n.trim().split(fb).map(e=>Number.parseFloat(e));if(r.length<4||r.slice(0,4).some(Number.isNaN))return null;let i=r[2],a=r[3];return i>0&&a>0?{height:a,width:i}:null},xb=e=>{let t=e.match(ub);if(!t)return e;try{let n=t[0],r=bb(e);if(!r)return e;let{width:i,height:a}=r,o=n.replace(pb,``).replace(mb,``),s=o.match(hb),c=`width:${i}px;height:${a}px;max-width:none;`;if(s){let e=s[1],t=s[2].split(`;`).map(e=>e.trim()).filter(Boolean).filter(e=>!(gb.test(e)||_b.test(e)||vb.test(e))).join(`;`),n=`${c}${t?`${t};`:``}`;o=o.replace(hb,` style=${e}${n}${e}`)}else o=o.replace(yb,`<svg style="${c}"`);return o=o.replace(yb,`<svg width="${i}" height="${a}"`),e.replace(n,o)}catch{return e}},Sb=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},Cb=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);o?(o.drawImage(i,0,0,r,a),e.toBlob(e=>{e?t(e):n(Error(`Failed to create PNG blob`))},`image/png`)):n(Error(`Failed to create 2D canvas context for PNG export`))},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),wb=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=K(),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(null),{isAnimating:u,controls:d}=(0,A.useContext)(KS),f=Hy(),p=cb(),m=Gy(),h=qy(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){Sy(`${h}.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}let u=Sb(l);if(t===`svg`){Sy(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await Cb(u);Sy(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,A.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,j.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,j.jsx)(`button`,{"aria-label":m.downloadDiagram,className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,j.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,j.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,j.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,j.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,j.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},Tb=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=Hy(),c=K(),[l,u]=(0,A.useState)(!1),{isAnimating:d,controls:f,portal:p}=(0,A.useContext)(KS),m=Gy(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.download!==!1})(),_=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.copy!==!1})(),v=()=>{u(!l)};return(0,A.useEffect)(()=>{if(l){nb();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),rb()}}},[l]),(0,A.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:v,title:m.viewFullscreen,type:`button`,...a,"aria-label":m.viewFullscreen,children:(0,j.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,Fv.createPortal)((0,j.jsxs)(`div`,{"aria-label":m.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:v,onKeyDown:e=>{e.key===`Escape`&&v()},role:`dialog`,children:[(0,j.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[g?(0,j.jsx)(wb,{chart:e,config:t}):null,_?(0,j.jsx)(Ky,{code:e}):null,(0,j.jsx)(`button`,{"aria-label":m.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:v,title:m.exitFullscreen,type:`button`,children:(0,j.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,j.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,j.jsx)(oC,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:h})})]}),eb(p)):null]})};function Eb(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
58
+ `:Array.from(t.childNodes).map(Eb).join(``)}var Db=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(Eb(e).trim());let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(Eb(e).trim());n.push(t)}return{headers:t,rows:n}},Ob=e=>{if(typeof e!=`object`)return`,`;let t=e.table;return typeof t==`object`?t.csvSeparator??`,`:`,`},kb=(e,t=`,`)=>{let n;n=t===`auto`?Intl.NumberFormat().format(1.1).includes(`,`)?`;`:`,`:t;let{headers:r,rows:i}=e,a=e=>{let t=!1;for(let r of e)if(r===n||r===`"`||r===`
59
+ `||r===`\r`){t=!0;break}return t?`"${e.replace(/"/g,`""`)}"`:e},o=r.length>0?i.length+1:i.length,s=Array(o),c=0;r.length>0&&(s[c]=r.map(a).join(n),c+=1);for(let e of i)s[c]=e.map(a).join(n),c+=1;return s.join(`
60
+ `)},Ab=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
61
+ `||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
62
+ `?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
63
+ `)},jb=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`||n===`
64
+ `||n===`&`||n===`<`||n===`>`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):t===`
65
+ `?n.push(`<br>`):t===`&`?n.push(`&amp;`):t===`<`?n.push(`&lt;`):t===`>`?n.push(`&gt;`):n.push(t);return n.join(``)},Mb=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0,a=t.map(e=>jb(e));r[i]=`| ${a.join(` | `)} |`,i+=1;let o=Array(t.length);for(let e=0;e<t.length;e+=1)o[e]=`---`;r[i]=`| ${o.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?jb(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else{let t=e.map(e=>jb(e));r[i]=`| ${t.join(` | `)} |`,i+=1}return r.join(`
66
+ `)},Nb=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=K(),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(!1),u=(0,A.useRef)(null),d=(0,A.useRef)(0),{isAnimating:f,controls:p}=(0,A.useContext)(KS),m=Gy(),h=Ob(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write))r?.(Error(`Clipboard API not available`));else try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Db(t),o=``;o=e===`csv`?kb(a,h):e===`tsv`?Ab(a):Mb(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,A.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=Hy(),v=c?_.CheckIcon:_.CopyIcon;return(0,j.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,j.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,j.jsx)(v,{height:14,width:14})}),o?(0,j.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,j.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,j.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,j.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},Pb=({children:e,className:t,onDownload:n,onError:r})=>{let i=K(),[a,o]=(0,A.useState)(!1),s=(0,A.useRef)(null),{isAnimating:c,controls:l}=(0,A.useContext)(KS),u=Gy(),d=Hy(),f=Ob(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Db(t),a=e===`csv`?kb(i,f):Mb(i),c=e===`csv`?`csv`:`md`;Sy(`${qy(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,A.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,j.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,j.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,j.jsx)(d.DownloadIcon,{size:14})}),a?(0,j.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,j.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,j.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},Fb=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=Hy(),o=K(),[s,c]=(0,A.useState)(!1),{isAnimating:l,portal:u}=(0,A.useContext)(KS),d=Gy(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,A.useEffect)(()=>{if(s){nb();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),rb()}}},[s]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:d.viewFullscreen,type:`button`,children:(0,j.jsx)(i,{size:14})}),s?(0,Fv.createPortal)((0,j.jsx)(`div`,{"aria-label":d.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,j.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,j.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,j.jsx)(Nb,{}):null,r?(0,j.jsx)(Pb,{}):null,(0,j.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:d.exitFullscreen,type:`button`,children:(0,j.jsx)(a,{size:20})})]}),(0,j.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,j.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),eb(u)):null]})},Ib=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=K(),{isAnimating:l}=(0,A.useContext)(KS),u=Ty(n),d=Ey(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,j.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,j.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,j.jsx)(Nb,{}):null,p?(0,j.jsx)(Pb,{}):null,m?(0,j.jsx)(Fb,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,j.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,j.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},Lb=/startLine=(\d+)/,Rb=/\bnoLineNumbers\b/,zb=(0,A.lazy)(()=>je(()=>import(`./mermaid-WFAXDIZX-BjSsakrn.js`).then(e=>({default:e.Mermaid})),[])),Bb=/language-([^\s]+)/,Vb=`node`;function Hb(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==Vb&&!Object.is(r[e],i[e]))return!1;return!0}function Ub(e,t){return e?.properties?.metastring===t?.properties?.metastring}var Wb=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,Gb=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},Kb=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},qb=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},Jb=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},Yb=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>Hb(e,t));Yb.displayName=`MarkdownOl`;var Xb=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K(),a=Array.isArray(e)?e.filter(e=>e!==`
67
+ `&&e!==``):[e],o=a.length===1&&(0,A.isValidElement)(a[0])&&(a[0].type===yx||a[0].props.node?.tagname===`p`)?a[0].props.children:e;return(0,j.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:o})},(e,t)=>Hb(e,t));Xb.displayName=`MarkdownLi`;var Zb=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>Hb(e,t));Zb.displayName=`MarkdownUl`;var Qb=(0,A.memo)(({className:e,node:t,...n})=>{let r=K();return(0,j.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>Hb(e,t));Qb.displayName=`MarkdownHr`;var $b=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>Hb(e,t));$b.displayName=`MarkdownStrong`;var ex=(0,A.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=K(),{linkSafety:o}=(0,A.useContext)(KS),[s,c]=(0,A.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,A.useCallback)(async e=>{if(o!=null&&o.enabled&&n&&!l){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,A.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,A.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,j.jsx)(ib,{...p})]}):(0,j.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>Hb(e,t));ex.displayName=`MarkdownA`;var tx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>Hb(e,t));tx.displayName=`MarkdownH1`;var nx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>Hb(e,t));nx.displayName=`MarkdownH2`;var rx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>Hb(e,t));rx.displayName=`MarkdownH3`;var ix=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>Hb(e,t));ix.displayName=`MarkdownH4`;var ax=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>Hb(e,t));ax.displayName=`MarkdownH5`;var ox=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>Hb(e,t));ox.displayName=`MarkdownH6`;var sx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,A.useContext)(KS),o=Wb(i,`table`),s=Gb(i,`copy`),c=Gb(i,`download`),l=Gb(i,`fullscreen`);return(0,j.jsx)(Ib,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>Hb(e,t));sx.displayName=`MarkdownTable`;var cx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>Hb(e,t));cx.displayName=`MarkdownThead`;var lx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>Hb(e,t));lx.displayName=`MarkdownTbody`;var ux=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>Hb(e,t));ux.displayName=`MarkdownTr`;var dx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>Hb(e,t));dx.displayName=`MarkdownTh`;var fx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>Hb(e,t));fx.displayName=`MarkdownTd`;var px=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>Hb(e,t));px.displayName=`MarkdownBlockquote`;var mx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>Hb(e,t));mx.displayName=`MarkdownSup`;var hx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{let i=K();return(0,j.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>Hb(e,t));hx.displayName=`MarkdownSub`;var gx=(0,A.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,A.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,A.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t)if(typeof e==`string`&&e.trim()!==``||(0,A.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,A.isValidElement)(e))return e;if(e.type===Yb){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,j.jsx)(`section`,{className:t,...r,children:i}):null}return(0,j.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>Hb(e,t));gx.displayName=`MarkdownSection`;var _x=(0,A.memo)(({node:e,className:t,children:n,...r})=>{let i=K(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,A.useContext)(KS),l=cb(),u=vy(),d=(t?.match(Bb))?.at(1)??``,f=lb(d);if(a)return(0,j.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(Lb),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&Rb.test(p))&&c!==!1,v=``;if((0,A.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(Zy,{}),children:(0,j.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=Wb(s,`mermaid`),n=qb(s,`download`),r=qb(s,`copy`),a=qb(s,`fullscreen`),c=qb(s,`panZoom`),l=e&&(n||r||a);return(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(Zy,{}),children:(0,j.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,j.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,j.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,j.jsx)(`div`,{className:i(`pointer-events-none absolute top-2 right-2 z-10 flex items-center`),children:(0,j.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,j.jsx)(wb,{chart:v,config:o?.config}):null,r?(0,j.jsx)(Ky,{code:v,...Jy(s,`mermaid`)}):null,a?(0,j.jsx)(Tb,{chart:v,config:o?.config}):null]})}):null,(0,j.jsx)(`div`,{className:i(`overflow-hidden rounded-md border border-border bg-background`),children:(0,j.jsx)(zb,{chart:v,config:o?.config,showControls:c})})]})})}let y=Wb(s,`code`),b=Kb(s,`download`),x=Kb(s,`copy`),{"data-block":ee,...S}=r;return(0,j.jsx)(Ly,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,...S,children:y?(0,j.jsxs)(j.Fragment,{children:[b?(0,j.jsx)(Xy,{code:v,language:d}):null,x?(0,j.jsx)(Ky,{...Jy(s,`code`)}):null]}):null})},(e,t)=>Hb(e,t)&&Ub(e.node,t.node));_x.displayName=`MarkdownCode`;var vx=(0,A.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,A.useContext)(KS),i=Wb(r,`image`),a=i&&Jb(r,`download`);return(0,j.jsx)($y,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>Hb(e,t));vx.displayName=`MarkdownImg`;var yx=(0,A.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,A.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,j.jsx)(j.Fragment,{children:e})}return(0,j.jsx)(`p`,{...n,children:e})},(e,t)=>Hb(e,t));yx.displayName=`MarkdownParagraph`;var bx={ol:Yb,li:Xb,ul:Zb,hr:Qb,strong:$b,a:ex,h1:tx,h2:nx,h3:rx,h4:ix,h5:ax,h6:ox,table:sx,thead:cx,tbody:lx,tr:ux,th:dx,td:fx,blockquote:px,code:_x,img:vx,pre:({children:e})=>(0,A.isValidElement)(e)?(0,A.cloneElement)(e,{"data-block":`true`}):e,sup:mx,sub:hx,p:yx,section:gx},xx=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Sx=/\p{L}/u;function Cx(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t)xx.test(e)?(n??=`rtl`,i+=1):Sx.test(e)&&(n??=`ltr`,r+=1);return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var wx=/^[ \t]{0,3}(`{3,}|~{3,})/,Tx=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,Ex=e=>{let t=e.split(`
68
+ `),n=null,r=0;for(let e of t){let t=wx.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},Dx=e=>{let t=e.split(`
69
+ `);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&Tx.test(t))return!0}return!1},Ox=()=>e=>{it(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},kx=[],Ax={allowDangerousHtml:!0},jx=new WeakMap,Mx=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=jx.get(e);n||(n=e.name,jx.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=jx.get(r);e||(e=r.name,jx.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},Nx=e=>{let t=Px(e),n=e.children||``;return Vx(t.runSync(t.parse(n),n),e)},Px=e=>{let t=Mx.get(e);if(t)return t;let n=Ix(e);return Mx.set(e,n),n},Fx=e=>e.some(e=>Array.isArray(e)?e[0]===As:e===As),Ix=e=>{let t=e.rehypePlugins||kx,n=e.remarkPlugins||kx,r=Fx(t)?n:[...n,Ox],i=e.remarkRehypeOptions?{...Ax,...e.remarkRehypeOptions}:Ax;return Tv().use(o_).use(r).use(Z_,i).use(t)},Lx=e=>e,Rx=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},zx=(e,t)=>{for(let n in xg)if(Object.hasOwn(xg,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=xg[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},Bx=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},Vx=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||Lx;it(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return Rx(c,s,a,e.value),s;if(e.type===`element`&&(zx(e,t),Bx(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return $h(e,{Fragment:j.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:j.jsx,jsxs:j.jsxs,passKeys:!0,passNode:!0})},Hx=/\[\^[\w-]{1,200}\](?!:)/,Ux=/\[\^[\w-]{1,200}\]:/,Wx=/<([A-Za-z][\w:-]*)[\s>/]/,Gx=/^ {0,3}\[[^\]]+\]:/m,Kx=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),qx=new Map,Jx=new Map,Yx=e=>{let t=e.toLowerCase(),n=qx.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return qx.set(t,r),r},Xx=e=>{let t=e.toLowerCase(),n=Jx.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return Jx.set(t,r),r},Zx=(e,t)=>{if(Kx.has(t.toLowerCase()))return 0;let n=e.match(Yx(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},Qx=(e,t)=>{let n=e.match(Xx(t));return n?n.length:0},$x=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},eS=/\r\n|\r/g,tS=e=>{let t=new Ae({gfm:!0});return{tokens:t.blockTokens(e),hasLinkDefinitions:Object.keys(t.tokens.links).length>0}},nS=null,rS=`
70
+
71
+ `,iS=e=>{for(let t=e.length-3;t>=0;--t)if(e[t].endsWith(rS))return t+1;return 0},aS=e=>` ${e}`.slice(1),oS=e=>e.map(aS),sS=e=>{let t=[],n=[],r=!1;for(let i of e){let e=i.raw,a=t.length;if(n.length>0){t[a-1]+=e;let r=n.at(-1),i=Zx(e,r),o=Qx(e,r);for(let e=0;e<i;e+=1)n.push(r);for(let e=0;e<o;e+=1)n.length>0&&n.at(-1)===r&&n.pop()}else{if(i.type===`html`&&i.block){let t=e.match(Wx);if(t){let r=t[1];Zx(e,r)>Qx(e,r)&&n.push(r)}}if(i.type===`space`&&a>0)t[a-1]+=e;else{if(a>0&&!r){let n=t[a-1];if($x(n)%2==1){t[a-1]=n+e;continue}}t.push(e),i.type!==`space`&&(r=i.type===`code`)}}}return t},cS=(e,t)=>{if(t.length<=e.input.length||t.slice(0,e.input.length)!==e.input||Gx.test(t))return null;let n=iS(e.blocks);if(n===0)return null;let r=e.verifiedCount,i=e.verifiedLength;if(r>n){r=n,i=0;for(let t=0;t<r;t+=1)i+=e.blocks[t].length}for(;r<n&&t.startsWith(e.blocks[r],i);)i+=e.blocks[r].length,r+=1;if(r!==n)return null;let a=tS(t.slice(i));if(a.hasLinkDefinitions)return null;let o=oS(sS(a.tokens));return{input:t,blocks:e.blocks.slice(0,n).concat(o),verifiedCount:r,verifiedLength:i}},lS=e=>{let t=Hx.test(e),n=Ux.test(e);if(t||n)return[e];let r=e.includes(`\r`)?e.replace(eS,`
72
+ `):e;if(nS?.input===r)return nS.blocks;let i=nS?cS(nS,r):null;if(!i){let{tokens:e,hasLinkDefinitions:t}=tS(r);i={input:r,blocks:t?[aS(r)]:oS(sS(e)),verifiedCount:0,verifiedLength:0}}return nS=i,i.blocks},uS=/^\n*/,dS=/\n*$/,fS=/\n\n/g,pS=(e,t,n)=>t.includes(`
73
+ `)?`${e}${t.replace(fS,`
74
+ <!---->
75
+ `).replace(uS,`
76
+
77
+ `).replace(dS,`
78
+
79
+ `)}${n}
80
+
81
+ `:e+t+n,mS=(e,t)=>{let n=RegExp(`<(${t})(?=[\\s>/])([^>]*)>`,`gi`),r=``,i=0,a=n.exec(e);for(;a;){let t=a[0],o=a[1],s=a.index+t.length,c=e.slice(s);if(RegExp(`</${o}\\s*>`,`i`).test(c)){a=n.exec(e);continue}if(r+=e.slice(i,a.index),c.length===0){r+=t,i=s,a=n.exec(e);continue}if(c.startsWith(`
82
+
83
+ `)){let n=c.slice(2).replace(fS,`
84
+ <!---->
85
+ `);r+=`${t}
86
+
87
+ ${n}`,i=e.length;break}if(!c.startsWith(`
88
+ `)){r+=t,i=s,a=n.exec(e);continue}let l=c.slice(1);if(l.trim().length===0){r+=t,i=s,a=n.exec(e);continue}let u=l.replace(fS,`
89
+ <!---->
90
+ `);r+=`${t}
91
+
92
+ ${u}`,i=e.length;break}return i===0?e:r+e.slice(i)},hS=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>pS(t,n,r)),n=mS(n,e)}return n},gS=/([\\`*_~[\]|])/g,_S=e=>e.replace(gS,`\\$1`),vS=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+_S(n).replace(/\n\n/g,`&#10;&#10;`)+r)}return n},yS=new Set([`blockquote`,`dd`,`dt`,`figcaption`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`]),bS=new Set([`code`,`kbd`,`pre`,`samp`,`var`]);function xS(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`&&!bS.has(e.tagName)?xS(e):``).join(``)}function SS(){return e=>{it(e,`element`,e=>{bS.has(e.tagName)?(e.properties??={},e.properties.dir=`ltr`):yS.has(e.tagName)&&(e.properties??={},typeof e.properties.dir!=`string`&&(e.properties.dir=Cx(xS(e))))})}}var CS=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(CS).join(``):``,wS=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));it(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=CS(e);e.children=t?[{type:`text`,value:t}]:[]}})},TS=()=>e=>{it(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},ES=/^([a-zA-Z][a-zA-Z\d+\-.]*:)/,DS=e=>new Set(e.map(e=>e.trim().toLowerCase()).filter(e=>e.length>0).map(e=>e.endsWith(`:`)?e:`${e}:`));function OS(e,t,n){let r=e.position?.start?.offset;if(typeof r==`number`&&n.charCodeAt(r)===91||e.children.length!==1)return!1;let[i]=e.children;if(i.type!==`text`)return!1;let a=ES.exec(e.url);if(!a)return!1;let o=a[1].toLowerCase();return t.has(o)?o===`mailto:`?e.url===`mailto:${i.value}`:e.url===i.value||e.url===`${o}//${i.value}`:!1}var kS=(e=[])=>{let t=DS(e);return(e,n)=>{if(t.size===0)return;let r=String(n.value??``);it(e,`link`,(e,n,i)=>{if(i&&n!==void 0&&OS(e,t,r))return i.children.splice(n,1,...e.children),n})}},AS=`data-sd-caret-hidden`,jS=()=>{},MS=()=>jS,NS=e=>{let t=(0,A.useRef)(null),n=(0,A.useRef)(null),r=(0,A.useSyncExternalStore)(MS,()=>!0,()=>!1);return(0,A.useLayoutEffect)(()=>{var r;let i=e&&(r=t.current?.lastElementChild)!=null?r:null,a=n.current;a!==i&&(a?.removeAttribute(AS),i?.setAttribute(AS,``),n.current=i)}),{containerRef:t,showCaret:r||!e}},PS=/^[a-z]/,FS=/^[ \t]*<[\w!/?-]/,IS=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,LS=e=>typeof e!=`string`||e.length===0||!FS.test(e)?e:e.replace(IS,`$1`),RS={...Ms,clobberPrefix:``,protocols:{...Ms.protocols,href:[...Ms.protocols?.href??[],`tel`,`streamdown`],src:[...Ms.protocols?.src??[],`streamdown`]},attributes:{...Ms.attributes,code:[...Ms.attributes?.code??[],`metastring`]}},zS={raw:As,sanitize:[Ys,RS],harden:[ot,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},BS={gfm:[up,{}],codeMeta:TS},VS=Object.values(zS),HS=Object.values(BS),US={block:` ▋`,circle:` ●`},WS=[`github-light`,`github-dark`],GS={enabled:!0},KS=(0,A.createContext)({codeBlockMaxHeight:400,shikiTheme:WS,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:GS,portal:void 0,tableMaxHeight:300}),qS=(0,A.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{(0,A.useLayoutEffect)(()=>{o?.commit()});let c=typeof e==`string`&&n?LS(e):e,l=(0,j.jsx)(Nx,{...s,children:c});return(0,j.jsx)(_y.Provider,{value:i,children:a?(0,j.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return e.rehypePlugins===t.rehypePlugins&&e.remarkPlugins===t.remarkPlugins&&!!e.animatePlugin==!!t.animatePlugin});qS.displayName=`Block`;var JS=e=>{let t={};for(let[n,r]of Object.entries(e))(n.startsWith(`data-`)||n.startsWith(`aria-`))&&(t[n]=r);return t},YS=(e,t)=>{let n=JS(e),r=JS(t),i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>Object.hasOwn(r,e)&&n[e]===r[e])},XS=(0,A.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=VS,remarkPlugins:s=HS,className:c,shikiTheme:l,mermaid:u,codeBlockMaxHeight:d=400,controls:f=!0,isAnimating:p=!1,tableMaxHeight:m=300,animated:h,BlockComponent:g=qS,parseMarkdownIntoBlocksFn:_=lS,caret:v,plugins:y,remend:b,linkSafety:x=GS,portal:ee,lineNumbers:S=!0,allowedTags:C,fallbackComponent:w,literalTagContent:T,disableAutolinkProtocols:te,translations:E,icons:D,prefix:ne,onAnimationStart:re,onAnimationEnd:ie,...ae})=>{let oe=(0,A.useId)(),se=JS(ae),ce=(0,A.useMemo)(()=>xy(ne),[ne]),le=(0,A.useRef)(null),ue=(0,A.useRef)(re),de=(0,A.useRef)(ie);ue.current=re,de.current=ie,(0,A.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=le.current;le.current=p,i===null?p&&((e=ue.current)==null||e.call(ue)):p&&!i?(n=ue.current)==null||n.call(ue):!p&&i&&((r=de.current)==null||r.call(de))},[p,t]);let fe=(0,A.useMemo)(()=>C?Object.keys(C):[],[C]),pe=(0,A.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?kh(e,b):e;return T&&T.length>0&&(n=vS(n,T)),fe.length>0&&(n=hS(n,fe)),n},[e,t,r,b,fe,T]),me=(0,A.useMemo)(()=>_(pe),[pe,_]),he=(0,A.useMemo)(()=>n===`auto`?me.map(Cx):void 0,[me,n]),ge=(0,A.useMemo)(()=>me.map((e,t)=>`${oe}-${t}`),[me.length,oe]),_e=(0,A.useMemo)(()=>h===!0?`true`:h?JSON.stringify(h):``,[h]),ve=(0,A.useRef)(null),ye=(0,A.useRef)([]),be=(0,A.useRef)([]),O=(0,A.useRef)(null),xe=(0,A.useRef)(``);_e?(xe.current===_e?ve.current||=Uv():(xe.current=_e,ve.current=Uv({maxBacklogMs:_e===`true`?void 0:h.maxBacklogMs}),ye.current=[],be.current=[]),p&&ve.current&&ve.current.beginPass(ve.current.now())):(ve.current=null,ye.current=[],be.current=[],xe.current=``),(0,A.useLayoutEffect)(()=>{var e;p&&((e=ve.current)==null||e.commitPass())});let Se=(0,A.useMemo)(()=>({codeBlockMaxHeight:d,shikiTheme:l??(y?.code)?.getThemes()??WS,controls:f,isAnimating:p,lineNumbers:S,mode:t,mermaid:u,linkSafety:x,portal:ee,tableMaxHeight:m}),[d,l,f,p,S,t,u,x,ee,y?.code,m]),Ce=(0,A.useMemo)(()=>E?JSON.stringify(E):``,[E]),we=(0,A.useMemo)(()=>({...Uy,...E}),[Ce]),Te=(0,A.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...bx,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,A.createElement)(t,n):null:(0,A.createElement)(e,n)}if(w){if(C)for(let e of Object.keys(C))Object.hasOwn(n,e)||(n[e]=w);let e={configurable:!0,enumerable:!1,value:w,writable:!1};return new Proxy(n,{getOwnPropertyDescriptor(t,n){let r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;if(typeof n==`string`&&PS.test(n))return e},get(e,t,n){return typeof t==`string`&&PS.test(t)&&!Object.hasOwn(e,t)?w:Reflect.get(e,t,n)}})}return n},[a,w,C]),Ee=(0,A.useMemo)(()=>{let e=[];return y!=null&&y.cjk&&(e=[...e,...y.cjk.remarkPluginsBefore]),e=[...e,...s],te&&te.length>0&&(e=[...e,[kS,te]]),y!=null&&y.cjk&&(e=[...e,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(e=[...e,y.math.remarkPlugin]),e},[s,y?.math,y?.cjk,te]),k=(0,A.useMemo)(()=>{let e=o;if(C&&Object.keys(C).length>0&&o===VS){let t={...RS,tagNames:[...RS.tagNames??[],...Object.keys(C)],attributes:{...RS.attributes,...C}};e=[zS.raw,[Ys,t],zS.harden]}return T&&T.length>0&&(e=[...e,[wS,T]]),y!=null&&y.math&&(e=[...e,y.math.rehypePlugin]),n===`auto`&&t===`static`&&(e=[...e,SS]),e},[o,y?.math,C,T,n,t]),De=(0,A.useMemo)(()=>v&&p?{"--streamdown-caret":`"${US[v]}"`}:void 0,[v,p]),{containerRef:Oe,showCaret:ke}=NS((0,A.useMemo)(()=>{if(!p||me.length===0)return!1;let e=me.at(-1);return Ex(e)||Dx(e)},[p,me])),Ae=e=>{let t=null;if(ve.current&&p){if(!ye.current[e]){let{maxBacklogMs:t,...n}=_e&&_e!==`true`?h:{};ye.current[e]=hy({...n,timeline:ve.current})}t=ye.current[e]}O.current!==k&&(be.current=[],O.current=k),t&&!be.current[e]&&(be.current[e]=[...k,t.rehypePlugin]);let n=t&&be.current[e]?be.current[e]:k;return{blockAnimatePlugin:t,blockRehypePlugins:n}};return t===`static`?(0,j.jsx)(Wy.Provider,{value:we,children:(0,j.jsx)(ab.Provider,{value:y??null,children:(0,j.jsx)(KS.Provider,{value:Se,children:(0,j.jsx)(Vy,{icons:D,children:(0,j.jsx)(Cy.Provider,{value:ce,children:(0,j.jsx)(`div`,{...se,className:ce(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?void 0:n,children:(0,j.jsx)(Nx,{components:Te,rehypePlugins:k,remarkPlugins:Ee,...ae,children:pe})})})})})})}):(0,j.jsx)(Wy.Provider,{value:we,children:(0,j.jsx)(ab.Provider,{value:y??null,children:(0,j.jsx)(KS.Provider,{value:Se,children:(0,j.jsx)(Vy,{icons:D,children:(0,j.jsx)(Cy.Provider,{value:ce,children:(0,j.jsxs)(`div`,{...se,className:ce(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,v&&ke?`[&>*:last-child:not([data-sd-caret-hidden])]:after:inline [&>*:last-child:not([data-sd-caret-hidden])]:after:align-baseline [&>*:last-child:not([data-sd-caret-hidden])]:after:content-[var(--streamdown-caret)]`:null,c),ref:Oe,style:De,children:[me.length===0&&v&&p&&(0,j.jsx)(`span`,{}),me.map((e,t)=>{let a=t===me.length-1,o=p&&a&&Ex(e),{blockAnimatePlugin:s,blockRehypePlugins:c}=Ae(t);return(0,j.jsx)(g,{animatePlugin:s,components:Te,content:e,dir:he?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:c,remarkPlugins:Ee,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...ae},ge[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.codeBlockMaxHeight===t.codeBlockMaxHeight&&e.tableMaxHeight===t.tableMaxHeight&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&e.disableAutolinkProtocols===t.disableAutolinkProtocols&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir&&e.fallbackComponent===t.fallbackComponent&&YS(e,t));XS.displayName=`Streamdown`;var ZS=e=>e>0?e:null,QS=(e,t)=>{if(e.endsWith(`px`))return ZS(Number.parseFloat(e));if(e.endsWith(`rem`)){let t=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||`16`);return ZS(Number.parseFloat(e)*t)}if(e.endsWith(`em`)){let n=Number.parseFloat(getComputedStyle(t).fontSize||`16`);return ZS(Number.parseFloat(e)*n)}if(e.endsWith(`vh`))return ZS(Number.parseFloat(e)/100*window.innerHeight);if(e.endsWith(`%`)){let n=t.parentElement;return n&&n.clientHeight>0?ZS(Number.parseFloat(e)/100*n.clientHeight):null}return null},$S=(e,t)=>{let n=t.trim().toLowerCase();return!n||n===`none`||n===`auto`?null:QS(n,e)},eC=/^min\(\s*([^,]+)\s*,\s*([^)]+)\s*\)$/i,tC=(e,t)=>{let n=$S(e,t);if(n!=null)return n;let r=t.trim().match(eC);if(!r)return null;let i=$S(e,r[1].trim()),a=$S(e,r[2].trim());return i==null||a==null?null:Math.min(i,a)},nC=(e,t,n)=>{let r=t.clientWidth;if(!(r>0))return null;if(n){let n=t.clientHeight;if(!(n>0))return null;let i=Math.min(r/e.width,n/e.height,1);return!(i>0)||Number.isNaN(i)?null:{fitZoom:i,viewportHeight:null}}let i=Math.min(r/e.width,1);if(!(i>0)||Number.isNaN(i))return null;let a=e.height*i,o=null,s=t;for(;s&&o==null;){let e=getComputedStyle(s);o=tC(s,e.maxHeight),s=s.parentElement}let c=o==null?a:Math.min(a,o),l=Math.min(i,c/e.height,1);return!(l>0)||Number.isNaN(l)?null:{fitZoom:l,viewportHeight:c}},rC=({children:e,className:t,contentSize:n,fitKey:r,minZoom:i=.5,maxZoom:a=3,zoomStep:o=.1,showControls:s=!0,initialZoom:c=1,isAutoFit:l=!1,fullscreen:u=!1})=>{let{RotateCcwIcon:d,ZoomInIcon:f,ZoomOutIcon:p}=Hy(),m=K(),h=Gy(),g=(0,A.useRef)(null),_=(0,A.useRef)(null),v=(0,A.useRef)(!1),[y,b]=(0,A.useState)(c),[x,ee]=(0,A.useState)(i),[S,C]=(0,A.useState)(c),[w,T]=(0,A.useState)({x:0,y:0}),[te,E]=(0,A.useState)(!1),[D,ne]=(0,A.useState)({x:0,y:0}),[re,ie]=(0,A.useState)({x:0,y:0}),[ae,oe]=(0,A.useState)(null),se=(0,A.useCallback)(e=>{let t=g.current;if(!t)return;let n=nC(e,t,u);if(!n)return;let{fitZoom:r,viewportHeight:a}=n;oe(a),b(r),ee(Math.min(i,r)),v.current||(C(r),T({x:0,y:0}))},[u,i]),ce=(0,A.useCallback)(e=>{C(t=>Math.max(x,Math.min(a,t+e))),v.current=!0},[x,a]),le=(0,A.useCallback)(()=>{ce(o)},[ce,o]),ue=(0,A.useCallback)(()=>{ce(-o)},[ce,o]),de=(0,A.useCallback)(()=>{C(y),T({x:0,y:0}),v.current=!1},[y]),fe=(0,A.useCallback)(e=>{e.preventDefault();let t=e.deltaY>0?-o:o;ce(t)},[ce,o]),pe=(0,A.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;E(!0),v.current=!0,ne({x:e.clientX,y:e.clientY}),ie(w);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[w]),me=(0,A.useCallback)(e=>{if(!te)return;e.preventDefault();let t=e.clientX-D.x,n=e.clientY-D.y;T({x:re.x+t,y:re.y+n})},[te,D,re]),he=(0,A.useCallback)(e=>{E(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);(0,A.useEffect)(()=>{ee(i),l||(b(c),C(c),oe(null))},[c,l,i]),(0,A.useLayoutEffect)(()=>{if(!(l&&n))return;se(n);let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{se(n)});return t.observe(e),()=>{t.disconnect()}},[se,n,l]),(0,A.useEffect)(()=>{l&&(v.current=!1)},[r,l]),(0,A.useEffect)(()=>{let e=g.current;if(e)return e.addEventListener(`wheel`,fe,{passive:!1}),()=>{e.removeEventListener(`wheel`,fe)}},[fe]),(0,A.useEffect)(()=>{let e=_.current;if(e&&te)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,me,{passive:!1}),e.addEventListener(`pointerup`,he),e.addEventListener(`pointercancel`,he),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,me),e.removeEventListener(`pointerup`,he),e.removeEventListener(`pointercancel`,he)}},[te,me,he]);let ge=!u&&l&&ae!=null?{height:ae}:void 0;return(0,j.jsxs)(`div`,{className:m(`relative flex flex-col`,u?`h-full w-full`:`min-h-28 w-full`,t),ref:g,style:{cursor:te?`grabbing`:`grab`,...ge},children:[s?(0,j.jsxs)(`div`,{className:m(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,u?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,j.jsx)(`button`,{"aria-label":h.zoomIn,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:S>=a,onClick:le,title:h.zoomIn,type:`button`,children:(0,j.jsx)(f,{"aria-hidden":`true`,size:16})}),(0,j.jsx)(`button`,{"aria-label":h.zoomOut,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:S<=x,onClick:ue,title:h.zoomOut,type:`button`,children:(0,j.jsx)(p,{"aria-hidden":`true`,size:16})}),(0,j.jsx)(`button`,{"aria-label":h.resetView,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:de,title:h.resetView,type:`button`,children:(0,j.jsx)(d,{"aria-hidden":`true`,size:16})})]}):null,(0,j.jsx)(`div`,{className:m(`flex h-full w-full flex-1 origin-center items-center justify-center transition-transform duration-150 ease-out`),onPointerDown:pe,ref:_,role:`application`,style:{transform:`translate(${w.x}px, ${w.y}px) scale(${S})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},iC=(e,t)=>new Promise(n=>{let r=setTimeout(n,e);t(()=>{clearTimeout(r),n()})}),aC=async(e,{chart:t,config:n},r,i)=>{try{let i=e.getMermaid(n),a=t.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),o=`mermaid-${Math.abs(a)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:s}=await i.render(o,t),c=bb(s);return{ok:!0,svg:r?s:xb(s),size:c}}catch(e){return{ok:!1,error:e instanceof Error?e.message:i}}},oC=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=K(),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(null),m=Gy(),[h,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(0),{mermaid:y}=(0,A.useContext)(KS),b=cb(),x=y?.errorComponent,{shouldRender:ee,containerRef:S}=zv({immediate:r}),C=(0,A.useRef)(null),w=(0,A.useRef)(!1),T=(0,A.useRef)(!1),te=vy(),E=(0,A.useRef)(te),D=(0,A.useRef)(null);(0,A.useEffect)(()=>(T.current=!0,()=>{var e;T.current=!1,(e=D.current)==null||e.call(D)}),[]),(0,A.useEffect)(()=>{var e;E.current=te,te||(e=D.current)==null||e.call(D)},[te]);let ne=async e=>{E.current&&(await iC(e,e=>{D.current=e}),D.current=null)};if((0,A.useEffect)(()=>{if(!ee)return;if(!b){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}if(C.current={chart:e,config:n},w.current)return;let t=(e,t)=>{t.ok?(d(t.svg),p(t.size),g(t.svg)):e===C.current&&s(t.error)};(async()=>{w.current=!0,s(null),l(!0);try{let e=C.current;for(;e;){let n=performance.now(),i=await aC(b,e,r,m.errorMermaid);if(!T.current||(t(e,i),i.ok&&await ne(performance.now()-n),!T.current||e===C.current))return;e=C.current}}finally{w.current=!1,T.current&&l(!1)}})()},[e,n,_,ee,b]),!(ee||u||h))return(0,j.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:S});if(c&&!u&&!h)return(0,j.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:S,children:(0,j.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,j.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,j.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!h)return x?(0,j.jsx)(`div`,{ref:S,children:(0,j.jsx)(x,{chart:e,error:o,retry:()=>v(e=>e+1)})}):(0,j.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:S,children:[(0,j.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,j.jsxs)(`details`,{className:a(`mt-2`),children:[(0,j.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,j.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let re=u||h;return(0,j.jsx)(`div`,{className:a(r?`size-full`:`max-h-[min(70vh,40rem)] w-full`,t),"data-streamdown":`mermaid`,ref:S,children:(0,j.jsx)(rC,{className:a(r?`size-full overflow-hidden`:`max-h-[min(70vh,40rem)] overflow-hidden`,t),contentSize:f,fitKey:e,fullscreen:r,isAutoFit:!0,maxZoom:3,minZoom:.1,showControls:i,zoomStep:.1,children:(0,j.jsx)(`div`,{"aria-label":m.mermaidAriaLabel,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:re},role:`img`})})})},sC=`vercel.ai.error`,cC=Symbol.for(sC),lC=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[cC]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,sC)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},uC=`AI_APICallError`,dC=`vercel.ai.error.${uC}`,fC=Symbol.for(dC),pC=class extends lC{constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:uC,message:e,cause:o}),this[fC]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return lC.hasMarker(e,dC)}},mC=`AI_EmptyResponseBodyError`,hC=`vercel.ai.error.${mC}`,gC=Symbol.for(hC),_C=class extends lC{constructor({message:e=`Empty response body`}={}){super({name:mC,message:e}),this[gC]=!0}static isInstance(e){return lC.hasMarker(e,hC)}};function vC(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var yC=`AI_InvalidArgumentError`,bC=`vercel.ai.error.${yC}`,xC=Symbol.for(bC),SC=class extends lC{constructor({message:e,cause:t,argument:n}){super({name:yC,message:e,cause:t}),this[xC]=!0,this.argument=n}static isInstance(e){return lC.hasMarker(e,bC)}},CC=`AI_JSONParseError`,wC=`vercel.ai.error.${CC}`,TC=Symbol.for(wC),EC=class extends lC{constructor({text:e,cause:t}){super({name:CC,message:`JSON parsing failed: Text: ${e}.\nError message: ${vC(t)}`,cause:t}),this[TC]=!0,this.text=e}static isInstance(e){return lC.hasMarker(e,wC)}},DC=`AI_TypeValidationError`,OC=`vercel.ai.error.${DC}`,kC=Symbol.for(OC),AC=class e extends lC{constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:DC,message:`${r}: Value: ${JSON.stringify(e)}.\nError message: ${vC(t)}`,cause:t}),this[kC]=!0,this.value=e,this.context=n}static isInstance(e){return lC.hasMarker(e,OC)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},jC=`AI_UnsupportedFunctionalityError`,MC=`vercel.ai.error.${jC}`,NC=Symbol.for(MC),PC=class extends lC{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:jC,message:t}),this[NC]=!0,this.functionality=e}static isInstance(e){return lC.hasMarker(e,MC)}};function FC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function IC(e,t=`|`){return e.map(e=>lw(e)).join(t)}function LC(e,t){return typeof t==`bigint`?t.toString():t}var RC=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function zC(e){return new RC(e)}function BC(e){return e==null}function VC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function HC(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var UC=Symbol(`evaluating`);function WC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==UC)return r===void 0&&(r=UC,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function GC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function KC(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function qC(e){return KC(e._zod.def)??e._zod.def.shape}function JC(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return GC(this,t,e),e},enumerable:!0,configurable:!0})}function YC(e,t,n){t in e?GC(e,t,n):e[t]=n}function XC(e,t,n,r){let i=qC(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?JC(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):YC(e,a,r?r(n.value,a):n.value))}}function ZC(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?JC(e,n,()=>t[n]):YC(e,n,r.value))}}function QC(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function $C(e){return JSON.stringify(e)}function ew(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var tw=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function nw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rw=zC(()=>{if($w.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function iw(e){if(nw(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return nw(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function aw(e){return iw(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ow=new Set([`string`,`number`,`symbol`]);function sw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function cw(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function q(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function lw(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function uw(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var dw={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fw={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function pw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return XC(i,e,mw(e,t)),cw(e,QC(n,{shape:i,checks:[]}))}function mw(e,t){let n=qC(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function hw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(mw(e,t)),a={};return XC(a,e,Reflect.ownKeys(qC(e)).filter(e=>!i.has(e))),cw(e,QC(n,{shape:a,checks:[]}))}function gw(e,t){if(!iw(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=qC(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return cw(e,QC(e._zod.def,{shape:_w(e,t)}))}function _w(e,t){let n={};return XC(n,e,Reflect.ownKeys(qC(e))),ZC(n,t),n}function vw(e,t){if(!iw(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return cw(e,QC(e._zod.def,{shape:_w(e,t)}))}function yw(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return XC(n,e,Reflect.ownKeys(qC(e))),XC(n,t,Reflect.ownKeys(qC(t))),cw(e,QC(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function bw(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(mw(t,n)):void 0,o={};return XC(o,t,Reflect.ownKeys(qC(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),cw(t,QC(t._zod.def,{shape:o,checks:[]}))}function xw(e,t,n){let r=n?new Set(mw(t,n)):void 0,i={};return XC(i,t,Reflect.ownKeys(qC(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),cw(t,QC(t._zod.def,{shape:i}))}function Sw(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Cw(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ww(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tw(e){return typeof e==`string`?e:e?.message}function Ew(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Dw(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ow(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Tw(e.inst?._zod.def?.error?.(e))??Tw(a?.(e))??Tw(t?.error?.(e))??Tw(n.customError?.(e))??Tw(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var kw=/[\uD800-\uDBFF]/;function Aw(e){let t=e.length;if(!kw.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function jw(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Mw(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Nw(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Pw(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Rw(e,n,r.value)}}function Fw(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Iw(e,t,n){return Fw(e,t,n,!1)}function Lw(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Fw(this,n,r(this))},set(e){Fw(this,n,e)}})}return t}function Rw(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Fw(this,t,n.bind(this))},set(e){Fw(this,t,e)}})}function zw(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Bw,Vw=!1,Hw={configurable:!0,get(){Vw=!0}};function J(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Bw!==e._zod?Bw=void 0:(Bw=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Hw);let e=Vw;Vw=!1;try{let r=n(this);return Vw?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Vw||=e,r}catch(n){throw delete this[t],Vw||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Uw(e,t,n,r){let i=zw(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ww=`~constantCatch`;function Gw(e){let t=()=>e;return t[Ww]=!0,t}var Kw,qw=Object.freeze({status:`aborted`}),Jw={value:void 0,enumerable:!1},Yw=`captureStackTrace`in Error?Error:null;function Xw(e){let t=Yw;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Yw=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Y(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Jw.value=new a(r);try{Object.defineProperty(n,"_zod",Jw)}finally{Jw.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Pw(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Xw(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Zw=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Qw=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Kw=globalThis).__zod_globalConfig??(Kw.__zod_globalConfig={});var $w=globalThis.__zod_globalConfig;function eT(e){return e&&Object.assign($w,e),$w}function tT(){let e=this._zod;return e.message??=JSON.stringify(e.def,LC,2),e.message}function nT(e){this._zod.message=e}var rT={get:tT,set:nT,enumerable:!0,configurable:!0},iT={value:void 0,enumerable:!1},aT=new WeakSet([Object.prototype,Error.prototype]),oT=(e,t)=>{e.name=`$ZodError`,iT.value=t,Object.defineProperty(e,"issues",iT),iT.value=void 0,Object.defineProperty(e,"message",rT);let n=Object.getPrototypeOf(e);aT.has(n)||(aT.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},sT=Y(`$ZodError`,oT),cT=Y(`$ZodError`,oT,void 0,{Parent:Error});function lT(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function uT(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?lT(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function dT(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function fT(e,t){return{callee:t?.callee??e,Err:t?.Err}}var pT=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Zw;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ow(e,o,eT())));throw tw(n,a?.callee??t),n}return s.value};return t},mT=pT(cT),hT=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ow(e,o,eT())));throw tw(n,a?.callee??t),n}return s.value};return t},gT=hT(cT),_T=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Zw;return a.issues.length?yT(e,a.issues,i):{success:!0,data:a.value}},vT=_T(cT);function yT(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ow(e,n,eT()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var bT=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?yT(e,a.issues,i):{success:!0,data:a.value}},xT=bT(cT),ST=Symbol.for(`zod.compile.invalid`),CT=Symbol.for(`zod.compile.fallback`),wT=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ST)return!0;if(r.definite===!0&&n===void 0)return!1}return TT(e,t,n)});function TT(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[CT]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Zw;return a.issues.length===0}var ET=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},DT=e=>{let t=pT(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,fT(n,a))};return n},OT=e=>{let t=pT(e),n=(e,r,i,a)=>t(e,r,i,fT(n,a));return n},kT=e=>{let t=hT(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,fT(n,a))};return n},AT=e=>{let t=hT(e),n=async(e,r,i,a)=>await t(e,r,i,fT(n,a));return n},jT=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _T(e)(t,n,i)},MT=e=>(t,n,r)=>_T(e)(t,n,r),NT=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bT(e)(t,n,i)},PT=e=>async(t,n,r)=>bT(e)(t,n,r),FT=/^[cC][0-9a-z]{6,}$/,IT=/^[0-9a-z]+$/,LT=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,RT=/^[0-9a-vA-V]{20}$/,zT=/^[A-Za-z0-9]{27}$/,BT=/^[a-zA-Z0-9_-]{21}$/;function VT(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var HT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,UT=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,WT=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,GT=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KT=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function qT(){return new RegExp(KT,`u`)}var JT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,YT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,XT=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ZT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,QT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$T=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,eE=/^https?$/,tE=/^\+[1-9]\d{6,14}$/,nE=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function rE(e){return RegExp(`^${e}$`)}var iE=rE(nE);function aE(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function oE(e){return RegExp(`^${aE(e)}$`)}function sE(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${aE({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${aE({precision:e.precision})}`:n;return RegExp(`^${nE}T(?:${r})$`)}var cE=/^[\s\S]{0,}$/,lE=/^-?\d+$/,uE=/^-?\d+(?:\.\d+)?$/,dE=/^(?:true|false)$/i,fE=/^null$/i,pE=/^[^A-Z]*$/,mE=/^[^a-z]*$/,hE=Y(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gE=e=>{let t=e.value;return!BC(t)&&t.length!==void 0},_E={number:`number`,bigint:`bigint`,object:`date`},vE=Y(`$ZodCheckLessThan`,(e,t)=>{hE.init(e,t);let n=_E[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:_E[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yE=Y(`$ZodCheckGreaterThan`,(e,t)=>{hE.init(e,t);let n=_E[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_E[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bE=Y(`$ZodCheckMultipleOf`,(e,t)=>{hE.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):HC(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xE=Y(`$ZodCheckNumberFormat`,(e,t)=>{hE.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=dw[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),SE=Y(`$ZodCheckMaxLength`,(e,t)=>{var n;hE.init(e,t),(n=e._zod.def).when??(n.when=gE),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Aw(r):i)<=t.maximum)return;let a=jw(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),CE=Y(`$ZodCheckMinLength`,(e,t)=>{var n;hE.init(e,t),(n=e._zod.def).when??(n.when=gE),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Aw(r):i)>=t.minimum)return;let a=jw(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wE=Y(`$ZodCheckLengthEquals`,(e,t)=>{var n;hE.init(e,t),(n=e._zod.def).when??(n.when=gE),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Aw(r):i;if(a===t.length)return;let o=jw(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),TE=Y(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hE.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),EE=Y(`$ZodCheckRegex`,(e,t)=>{TE.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),DE=Y(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pE,TE.init(e,t)}),OE=Y(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mE,TE.init(e,t)}),kE=Y(`$ZodCheckIncludes`,(e,t)=>{hE.init(e,t);let n=sw(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),AE=Y(`$ZodCheckStartsWith`,(e,t)=>{hE.init(e,t);let n=RegExp(`^${sw(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jE=Y(`$ZodCheckEndsWith`,(e,t)=>{hE.init(e,t);let n=RegExp(`.*${sw(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function ME(e,t,n){e.issues.length&&t.issues.push(...ww(n,e.issues))}var NE=Y(`$ZodCheckProperties`,(e,t)=>{hE.init(e,t),Iw(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:`object`,code:`invalid_type`,input:r.value,inst:e});return}n??=Reflect.ownKeys(t.shape).map(e=>[e,t.shape[e]]);let i=r.value,a;for(let[e,t]of n){let n=t._zod.run({value:i[e],issues:[]},{});n instanceof Promise?(a??=[],a.push(n.then(t=>ME(t,r,e)))):ME(n,r,e)}if(a)return Promise.all(a).then(()=>void 0)}}),PE=Y(`$ZodCheckOverwrite`,(e,t)=>{hE.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),FE=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
93
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
94
+ `)}\n};`)(...Object.values(this.closed))}},IE={major:4,minor:6,patch:7},LE=Y(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=IE;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Sw(t),a;for(let o of n){if(o._zod.def.when){if(Cw(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Zw;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Dw(t.issues,n,e),i||=Sw(t,n))});else{if(t.issues.length===n)continue;Dw(t.issues,n,e),i||=Sw(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Sw(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Zw;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Zw;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Iw(this,`~standard`,BE(this))},set"~standard"(e){Fw(this,`~standard`,e)}}),RE=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ow(e,t,eT()))}:{value:e.value};async function zE(e,t){let n={async:!0};return RE(await e._zod.run({value:t,issues:[]},n),n)}function BE(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return RE(r,n)}catch{}return zE(e,t)},vendor:`zod`,version:1}}var VE=Y(`$ZodString`,(e,t)=>{LE.init(e,t),e._zod.pattern=t.pattern??cE,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),HE=Y(`$ZodStringFormat`,(e,t)=>{TE.init(e,t),VE.init(e,t)}),UE=Y(`$ZodGUID`,(e,t)=>{t.pattern??=UT,HE.init(e,t)}),WE=Y(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=WT(e)}else t.pattern??=WT();HE.init(e,t)}),GE=Y(`$ZodEmail`,(e,t)=>{t.pattern??=GT,HE.init(e,t)});function KE(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function qE(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?KE(e)||2:JE(e,t)}function JE(e,t){if(!t.normalize&&t.protocol?.source===eE.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var YE=/[\t\n\r]/g;function XE(e){return e.replace(YE,``)}function ZE(e,t){return t.lastIndex=0,t.test(e.hostname)}function QE(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var $E=Y(`$ZodURL`,(e,t)=>{HE.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=qE(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=XE(r);return}t.hostname&&!ZE(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!QE(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:XE(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),eD=Y(`$ZodEmoji`,(e,t)=>{t.pattern??=qT(),HE.init(e,t)}),tD=Y(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?BT:VT(t.length),HE.init(e,t)}),nD=Y(`$ZodCUID`,(e,t)=>{t.pattern??=FT,HE.init(e,t)}),rD=Y(`$ZodCUID2`,(e,t)=>{t.pattern??=IT,HE.init(e,t)}),iD=Y(`$ZodULID`,(e,t)=>{t.pattern??=LT,HE.init(e,t)}),aD=Y(`$ZodXID`,(e,t)=>{t.pattern??=RT,HE.init(e,t)}),oD=Y(`$ZodKSUID`,(e,t)=>{t.pattern??=zT,HE.init(e,t)}),sD=Y(`$ZodISODateTime`,(e,t)=>{t.pattern??=sE(t),HE.init(e,t)}),cD=Y(`$ZodISODate`,(e,t)=>{t.pattern??=iE,HE.init(e,t)}),lD=Y(`$ZodISOTime`,(e,t)=>{t.pattern??=oE(t),HE.init(e,t)}),uD=Y(`$ZodISODuration`,(e,t)=>{t.pattern??=HT,HE.init(e,t)}),dD=Y(`$ZodIPv4`,(e,t)=>{t.pattern??=JT,HE.init(e,t)}),fD=/^[0-9a-fA-F:.]+$/;function pD(e){return fD.test(e)?KE(`http://[${e}]`):!1}var mD=Y(`$ZodIPv6`,(e,t)=>{t.pattern??=YT,HE.init(e,t),e._zod.check=n=>{pD(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),hD=Y(`$ZodCIDRv4`,(e,t)=>{t.pattern??=XT,HE.init(e,t)});function gD(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:pD(n)}var _D=Y(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ZT,HE.init(e,t),e._zod.check=n=>{gD(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function vD(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var yD=/^[0-9a-zA-Z+/]*={0,2}$/,bD=Y(`$ZodBase64`,(e,t)=>{t.pattern??=yD,HE.init(e,t),e._zod.check=n=>{vD(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),xD=/^[A-Za-z0-9_-]*$/;function SD(e){if(!xD.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return vD(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var CD=Y(`$ZodBase64URL`,(e,t)=>{t.pattern??=xD,HE.init(e,t),e._zod.check=n=>{SD(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),wD=Y(`$ZodE164`,(e,t)=>{t.pattern??=tE,HE.init(e,t)});function TD(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ED=Y(`$ZodJWT`,(e,t)=>{HE.init(e,t),e._zod.check=n=>{TD(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),DD=Y(`$ZodNumber`,(e,t)=>{LE.init(e,t),e._zod.pattern=uE,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),OD=Y(`$ZodNumberFormat`,(e,t)=>{xE.init(e,t),DD.init(e,t)}),kD=Y(`$ZodBoolean`,(e,t)=>{LE.init(e,t),e._zod.pattern=dE,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),AD=Y(`$ZodNull`,(e,t)=>{LE.init(e,t),e._zod.pattern=fE,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),jD=Y(`$ZodUnknown`,(e,t)=>{LE.init(e,t),e._zod.parse=e=>e}),MD=Y(`$ZodNever`,(e,t)=>{LE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ND(e,t){let n=Ew(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ew(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Dw(n.issues,t,e),n}}return i(n,a)}}var PD=e=>Array.isArray(e)?e.length:-1;function FD(e,t,n){e.issues.length&&t.issues.push(...ww(n,e.issues)),t.value[n]=e.value}var ID=Y(`$ZodArray`,(e,t)=>{LE.init(e,t);let n=$w.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>FD(t,r,e)));else if(FD(c,r,e),s&&c.issues.length!==0&&Sw(c))break}return o.length?Promise.all(o).then(()=>r):r},ND(e,PD)});function LD(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ww(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var RD=[];function zD(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:RD,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=uw(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function BD(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Sw(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>LD(e,n,i,t,d,f))):LD(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var VD=Y(`$ZodObject`,(e,t)=>{LE.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=zC(()=>zD(t));J(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||GC(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=nw,o=t.catchall,s,c=$w.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Sw(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>LD(n,t,e,r,a,o))):LD(s,t,e,r,a,o)}return o?BD(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),HD=Y(`$ZodObjectJIT`,(e,t)=>{VD.init(e,t);let n=e._zod.parse,r=zC(()=>zD(t)),i=$w.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new FE([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
95
+ let ${e}_ab = false;
96
+ for (let i = 0; i < ${e}.issues.length; i++) {
97
+ const iss = ${e}.issues[i];
98
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
99
+ payload.issues.push(iss);
100
+ if (iss.continue !== true) ${e}_ab = true;
101
+ }
102
+ if (${e}_ab && ctx && ctx.abortEarly) {
103
+ payload.value = newResult;
104
+ return payload;
105
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:$C(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
106
+ const ${n}_present = ${i};
107
+ if (!${n}.issues.length || ${n}_present) {
108
+ if (${n}.issues.length) {${c(n,r)}
109
+ }
110
+
111
+ if (${e}) {
112
+ newResult[${r}] = ${n}.value;
113
+ }
114
+ }
115
+
116
+ `)}else f?(o.write(`
117
+ if (${n}.issues.length) {${c(n,r)}
118
+ }
119
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
120
+ if (${n}.value !== undefined || ${i}) {
121
+ newResult[${r}] = ${n}.value;
122
+ }
123
+ `)):o.write(`
124
+ const ${n}_present = ${i};
125
+ if (${n}.issues.length) {${c(n,r)}
126
+ }
127
+ if (!${n}_present && !${n}.issues.length) {
128
+ payload.issues.push({
129
+ code: "invalid_type",
130
+ expected: "nonoptional",
131
+ input: undefined,
132
+ path: [${r}]
133
+ });
134
+ if (ctx && ctx.abortEarly) {
135
+ payload.value = newResult;
136
+ return payload;
137
+ }
138
+ }
139
+
140
+ if (${n}_present) {
141
+ newResult[${r}] = ${n}.value;
142
+ }
143
+
144
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=nw,c=!$w.jitless,l=c&&rw.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?BD([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function UD(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Sw(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ow(e,r,eT())))}),t)}var WD=Y(`$ZodUnion`,(e,t)=>{LE.init(e,t),J(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),J(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),J(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),J(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>VC(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>UD(t,r,e,i)):UD(o,r,e,i)}});function GD(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var KD=Y(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,WD.init(e,t);let n=e._zod.parse;J(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||GC(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=KC(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=zC(()=>GD(t));e._zod.parse=(i,a)=>{let o=i.value;if(!nw(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),qD=Y(`$ZodIntersection`,(e,t)=>{LE.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>YD(e,t,n)):YD(e,i,a)}});function JD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(iw(e)&&iw(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=JD(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=JD(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function YD(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=JD(t.value,n.value);if(!c.valid){if(Sw(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var XD=Y(`$ZodRecord`,(e,t)=>{LE.init(e,t);let n=$w.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!iw(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ow(e,i,eT())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ww(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ww(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&uE.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Ow(e,i,eT())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ww(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ww(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ZD=Y(`$ZodEnum`,(e,t)=>{LE.init(e,t);let n=FC(t.entries),r=new Set(n);e._zod.values=r,J(e,`pattern`,e=>{let t=FC(e.def.entries).filter(e=>ow.has(typeof e));return RegExp(t.length?`^(${t.map(e=>sw(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),QD=Y(`$ZodLiteral`,(e,t)=>{LE.init(e,t);let n=new Set(t.values);e._zod.values=n,J(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?sw(e):e?sw(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),$D=Y(`$ZodTransform`,(e,t)=>{LE.init(e,t),e._zod.optin=`optional`,$w.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qw(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Zw;return n.value=i,n}});function eO(e,t){return e.value=t.issues.length?void 0:t.value,e}var tO=Y(`$ZodOptional`,(e,t)=>{LE.init(e,t),J(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,J(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),J(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${VC(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>eO(e,t)):eO(e,r)}return t.innerType._zod.run(e,n)}}),nO=Y(`$ZodExactOptional`,(e,t)=>{tO.init(e,t),J(e,`values`,e=>e.def.innerType._zod.values),J(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),rO=Y(`$ZodNullable`,(e,t)=>{LE.init(e,t),J(e,`optin`,e=>e.def.innerType._zod.optin),J(e,`optout`,e=>e.def.innerType._zod.optout),J(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${VC(t.source)}|null)$`):void 0}),J(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),iO=Y(`$ZodDefault`,(e,t)=>{LE.init(e,t),e._zod.optin=`defaulted`,J(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>aO(e,t)):aO(r,t)}});function aO(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var oO=Y(`$ZodPrefault`,(e,t)=>{LE.init(e,t),e._zod.optin=`defaulted`,J(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),sO=Y(`$ZodNonOptional`,(e,t)=>{LE.init(e,t),J(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>cO(t,e)):cO(i,e)}});function cO(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function lO(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ow(e,r,eT()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var uO=Y(`$ZodCatch`,(e,t)=>{LE.init(e,t),J(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),J(e,`optout`,e=>e.def.innerType._zod.optout),J(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>lO(e,r,t,n)):lO(e,r,t,n)}}),dO=Y(`$ZodPipe`,(e,t)=>{LE.init(e,t),J(e,`values`,e=>e.def.in._zod.values),J(e,`optin`,e=>e.def.in._zod.optin),J(e,`optout`,e=>e.def.out._zod.optout),J(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>fO(e,t.in,n)):fO(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>fO(e,t.out,n)):fO(r,t.out,n)}});function fO(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var pO=Y(`$ZodReadonly`,(e,t)=>{LE.init(e,t),J(e,`propValues`,e=>e.def.innerType._zod.propValues),J(e,`values`,e=>e.def.innerType._zod.values),J(e,`optin`,e=>e.def.innerType?._zod?.optin),J(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(mO):mO(r)}});function mO(e){return e.memo||(e.value=Object.freeze(e.value)),e}var hO=Y(`$ZodLazy`,(e,t)=>{LE.init(e,t),WC(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),J(e,`pattern`,e=>e.innerType?._zod?.pattern),J(e,`propValues`,e=>e.innerType?._zod?.propValues),J(e,`optin`,e=>e.innerType?._zod?.optin??void 0),J(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),gO=Y(`$ZodCustom`,(e,t)=>{hE.init(e,t),LE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>_O(t,n,r,e));_O(i,n,r,e)}});function _O(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Nw(e))}}var vO=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},yO=`~memo`,bO=[];function xO(e){return typeof e==`object`&&!!e}function SO(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var CO=new WeakMap,wO=0,TO=1,EO=2;function DO(e,t,n){let r=CO.get(e);if(r!==void 0)return r?EO:wO;if(t.has(e))return EO;t.add(e);let i=wO,a=e=>{if(i!==EO&&e?._zod){let r=DO(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=wO;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?TO:o.value?._zod?DO(o.value,t,n):wO;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=KC(c);s(e?o(e,!0):TO),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?DO(r,t,!1):TO);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),OO(e,i)}function OO(e,t){return t!==TO&&CO.set(e,t===EO),t}function kO(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var AO,jO=[],MO={alloc(e,t,n){let r=AO;if(!r)return n;AO=void 0;let i={value:n,issues:null};return r.set(t.value,i),jO.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&PO(n,e.value))throw new vO;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=DO(e,new Set,!1);if(i===wO)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===EO||r?n=!0:r=!0}let l=s.value;if(!xO(l))return t(s,c);let u=c[yO];u||(u={buckets:new WeakMap,backEdges:void 0},c[yO]=u);let d;i===c?d=a:(d=kO(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...SO(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;AO=d;let p=jO.length,m=t(s,c);AO=void 0;let h=jO.length>p?jO.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?SO(e.issues):bO),e)):(h&&(h.issues=m.issues.length?SO(m.issues):bO),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function NO(){return MO}function PO(e,t){let n=e[yO]?.backEdges;return n!==void 0&&xO(t)&&n.has(t)}var FO=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Mw(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${lw(e.values[0])}`:`Invalid option: expected one of ${IC(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${IC(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function IO(){return{localeError:FO()}}var LO,RO=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function zO(){return new RO}(LO=globalThis).__zod_globalRegistry??(LO.__zod_globalRegistry=zO());var BO=globalThis.__zod_globalRegistry;function VO(e){return e.checks&&=[...e.checks],e}function HO(e,t){return new e(VO({type:`string`,...q(t)}))}function UO(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...q(t)})}function WO(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...q(t)})}function GO(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...q(t)})}function KO(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...q(t)})}function qO(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...q(t)})}function JO(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...q(t)})}function YO(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...q(t)})}function XO(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...q(t)})}function ZO(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...q(t)})}function QO(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...q(t)})}function $O(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...q(t)})}function ek(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...q(t)})}function tk(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...q(t)})}function nk(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...q(t)})}function rk(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...q(t)})}function ik(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...q(t)})}function ak(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...q(t)})}function ok(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...q(t)})}function sk(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...q(t)})}function ck(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...q(t)})}function lk(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...q(t)})}function uk(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...q(t)})}function dk(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...q(t)})}function fk(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...q(t)})}function pk(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...q(t)})}function mk(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...q(t)})}function hk(e,t){return new e(VO({type:`number`,checks:[],...q(t)}))}function gk(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...q(t)})}function _k(e,t){return new e({type:`boolean`,...q(t)})}function vk(e,t){return new e({type:`null`,...q(t)})}function yk(e){return new e({type:`unknown`})}function bk(e,t){return new e({type:`never`,...q(t)})}function xk(e,t){return new vE({check:`less_than`,...q(t),value:e,inclusive:!1})}function Sk(e,t){return new vE({check:`less_than`,...q(t),value:e,inclusive:!0})}function Ck(e,t){return new yE({check:`greater_than`,...q(t),value:e,inclusive:!1})}function wk(e,t){return new yE({check:`greater_than`,...q(t),value:e,inclusive:!0})}function Tk(e){return Ck(0,e)}function Ek(e){return wk(0,e)}function Dk(e,t){return new bE({check:`multiple_of`,...q(t),value:e})}function Ok(e,t){return new SE({check:`max_length`,...q(t),maximum:e})}function kk(e,t){return new CE({check:`min_length`,...q(t),minimum:e})}function Ak(e,t){return new wE({check:`length_equals`,...q(t),length:e})}function jk(e,t){return new EE({check:`string_format`,format:`regex`,...q(t),pattern:e})}function Mk(e){return new DE({check:`string_format`,format:`lowercase`,...q(e)})}function Nk(e){return new OE({check:`string_format`,format:`uppercase`,...q(e)})}function Pk(e,t){return new kE({check:`string_format`,format:`includes`,...q(t),includes:e})}function Fk(e,t){return new AE({check:`string_format`,format:`starts_with`,...q(t),prefix:e})}function Ik(e,t){return new jE({check:`string_format`,format:`ends_with`,...q(t),suffix:e})}function Lk(e,t){return new NE({check:`properties`,shape:e,...q(t)})}function Rk(e){return new PE({check:`overwrite`,tx:e})}function zk(e){return Rk(t=>t.normalize(e))}function Bk(){return Rk(e=>e.trim())}function Vk(){return Rk(e=>e.toLowerCase())}function Hk(){return Rk(e=>e.toUpperCase())}function Uk(){return Rk(e=>ew(e))}function Wk(e,t,n){return new e({type:`array`,element:t,...q(n)})}function Gk(e,t,n){let r=q(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Kk(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...q(n)})}function qk(e,t){let n=Jk(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Nw(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Nw(r))}},e(t.value,t)),t);return n}function Jk(e,t){let n=new hE({check:`custom`,...q(t)});return n._zod.check=e,n}function Yk(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&GC(e,t,n[t]);return e}function Xk(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??BO,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Zk(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Qk(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Qk(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Yk(o.schema,c),t.io===`input`&&cA(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function $k(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function eA(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${$k(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+$k(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
145
+
146
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function tA(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;tA(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var nA=new Set([`type`,`properties`,`required`,`additionalProperties`]),rA=[`oneOf`,`anyOf`];function iA(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function aA(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!nA.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??iA(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}GC(n,r,e.length===1?e[0]:aA(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=iA(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function oA(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of nA)if(t in e)return;let n=t.filter(e=>rA.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=aA(t);else{let e=n[0],i=rA.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>aA([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Yk(e,r))}function sA(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Yk(i,s),Yk(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())tA(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])oA(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Yk(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,GC(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:uA(t,`input`,e.processors),output:uA(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function cA(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return cA(r.element,n);if(r.type===`set`)return cA(r.valueType,n);if(r.type===`lazy`)return cA(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return cA(r.innerType,n);if(r.type===`intersection`)return cA(r.left,n)||cA(r.right,n);if(r.type===`record`||r.type===`map`)return cA(r.keyType,n)||cA(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:cA(r.in,n)||cA(r.out,n);if(r.type===`object`){for(let e in r.shape)if(cA(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(cA(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(cA(e,n))return!0;return!!(r.rest&&cA(r.rest,n))}return!1}var lA=(e,t={})=>n=>{let r=Xk({...n,processors:t});return Qk(e,r),eA(r,e),sA(r,e)},uA=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Xk({...i??{},target:a,io:t,processors:n});return Qk(e,o),eA(o,e),sA(o,e)},dA=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},fA=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},pA=(e,t)=>{dA(e,`minimum`,t),fA(e,`maximum`,t)},mA=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},hA=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},gA=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},_A=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},vA=(e,t)=>dA(e,`minimum`,t.minimum),yA=(e,t)=>fA(e,`maximum`,t.maximum),bA=e=>(t,n)=>{_A(t,n.format);let[r,i]=e[n.format];dA(t,`minimum`,r),fA(t,`maximum`,i)},xA={greater_than:(e,t)=>dA(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>fA(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>mA(e,t.value),number_format:bA(dw),bigint_format:bA(fw),min_length:vA,max_length:yA,length_equals:(e,t)=>pA(e,t.length),min_size:vA,max_size:yA,size_equals:(e,t)=>pA(e,t.size),string_format:(e,t)=>{_A(e,t.format),t.pattern&&hA(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>gA(e,t.mime)};function SA(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)xA[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&dA(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&dA(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&fA(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&fA(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&mA(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&gA(t,i.mime);for(let e of i.patterns??[])hA(t,e);return t}var CA={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wA=new Map([[yD,QT],[xD,$T]]),TA=e=>wA.get(e)??e,EA=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=SA(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=CA[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(TA);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},DA=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=SA(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Zk(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},OA=(e,t,n,r)=>{n.type=`boolean`},kA=(e,t,n,r)=>{Zk(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},AA=(e,t,n,r)=>{Zk(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},jA=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},MA=(e,t,n,r)=>{Zk(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},NA=(e,t,n,r)=>{Zk(e,t,n,r,`Void cannot be represented in JSON Schema`)},PA=(e,t,n,r)=>{n.not={}},FA=(e,t,n,r)=>{},IA=(e,t,n,r)=>{},LA=(e,t,n,r)=>{Zk(e,t,n,r,`Date cannot be represented in JSON Schema`)},RA=(e,t,n,r)=>{let i=e._zod.def,a=FC(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},zA=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Zk(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Zk(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},BA=(e,t,n,r)=>{Zk(e,t,n,r,`NaN cannot be represented in JSON Schema`)},VA=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},HA=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=SA(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},UA=(e,t,n,r)=>{n.type=`boolean`},WA=(e,t,n,r)=>{Zk(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},GA=(e,t,n,r)=>{Zk(e,t,n,r,`Function types cannot be represented in JSON Schema`)},KA=(e,t,n,r)=>{Zk(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},qA=(e,t,n,r)=>{Zk(e,t,n,r,`Map cannot be represented in JSON Schema`)},JA=(e,t,n,r)=>{Zk(e,t,n,r,`Set cannot be represented in JSON Schema`)},YA=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=SA(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Qk(a.element,t,{...r,path:[...r.path,`items`]})};function XA(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?XA(t.out):t.type===`catch`?XA(t.innerType):e._zod.optin}var ZA=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Zk(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)GC(i.properties,e,Qk(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?XA(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Qk(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},QA=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Qk(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},$A=(e,t,n,r)=>{let i=e._zod.def,a=Qk(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Qk(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ej=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Qk(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Qk(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?XA(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=SA(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function tj(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=tj(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>tj(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?uE:lE).source)),p}var nj=new WeakMap;function rj(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of nj.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=tj(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var ij=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=SA(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Qk(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)GC(i.patternProperties,TA(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Qk(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=nj.get(t);n||(n=[],nj.set(t,n),t.deferred.push(()=>rj(t))),n.push(e)}i.additionalProperties=Qk(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&XA(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},aj=(e,t,n,r)=>{let i=e._zod.def,a=Qk(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},oj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},sj=Symbol();function cj(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Zk(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),sj):JSON.parse(o)}var lj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=cj(i.defaultValue,e,t,n,r);o!==sj&&(n.default=o)},uj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=cj(i.defaultValue,e,t,n,r);o!==sj&&(n._prefault=o)},dj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Zk(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},fj=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Qk(o,t,r);let s=t.seen.get(e);s.ref=o},pj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},mj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},hj=(e,t,n,r)=>{let i=e._zod.def;Qk(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},gj=(e,t,n,r)=>{let i=e._zod.innerType;Qk(i,t,r);let a=t.seen.get(e);a.ref=i},_j={string:EA,number:DA,boolean:OA,bigint:kA,symbol:AA,null:jA,undefined:MA,void:NA,never:PA,any:FA,unknown:IA,date:LA,enum:RA,literal:zA,nan:BA,template_literal:VA,file:HA,success:UA,custom:WA,function:GA,transform:KA,map:qA,set:JA,array:YA,object:ZA,union:QA,intersection:$A,tuple:ej,record:ij,nullable:aj,nonoptional:oj,default:lj,prefault:uj,catch:dj,pipe:fj,readonly:pj,promise:mj,optional:hj,lazy:gj};function vj(e,t){if(`_idmap`in e){let n=e,r=Xk({...t,processors:_j}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Qk(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;eA(r,n),GC(a,t,sA(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Xk({...t,processors:_j});return Qk(e,n),eA(n,e),sA(n,e)}var yj=new WeakSet([Object.prototype,Error.prototype]);function bj(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var xj=Y(`ZodError`,(e,t)=>{sT.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);yj.has(n)||(yj.add(n),bj(n,`format`,e=>t=>dT(e,t)),bj(n,`flatten`,e=>t=>uT(e,t)),bj(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,LC,2)}),bj(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,LC,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Sj=pT(xj),Cj=hT(xj),wj=_T(xj),Tj=bT(xj),Ej=DT(xj),Dj=OT(xj),Oj=kT(xj),kj=AT(xj),Aj=jT(xj),jj=MT(xj),Mj=NT(xj),Nj=PT(xj);function Pj(){$w.localeError||eT(IO())}function Fj(){$w.memoizer||eT({memoizer:NO()})}var Ij=Y(`ZodType`,(e,t)=>(Pj(),LE.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(QC(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return cw(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cN(e,t))},superRefine(e,t){return this.check(lN(e,t))},overwrite(e){return this.check(Rk(e))},optional(){return VM(this)},exactOptional(){return UM(this)},nullable(){return GM(this)},nullish(){return VM(GM(this))},nonoptional(e){return ZM(this,e)},array(){return CM(this)},or(e){return DM([this,e])},and(e){return jM(this,e)},transform(e){return tN(this,zM(e))},default(e){return qM(this,e)},prefault(e){return YM(this,e)},catch(e){return $M(this,e)},pipe(e){return tN(this,e)},readonly(){return rN(this)},describe(e){let t=this.clone();return BO.add(t,{description:e}),t},meta(...e){if(e.length===0)return BO.get(this);let t=this.clone();return BO.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Iw(this,`~standard`,{...BE(this),jsonSchema:{input:uA(this,`input`),output:uA(this,`output`)}})},set"~standard"(e){Fw(this,`~standard`,e)},parse:function e(t,n){return Sj(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cj(this,t,n,{callee:e})},safeParse(e,t){return wj(this,e,t)},async safeParseAsync(e,t){return Tj(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Fw(this,`spa`,e)},validate(e,t){return wT(this,e,t)},validateAsync(e,t){return ET(this,e,t)},encode:function e(t,n){return Ej(this,t,n,{callee:e})},decode:function e(t,n){return Dj(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Oj(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await kj(this,t,n,{callee:e})},safeEncode(e,t){return Aj(this,e,t)},safeDecode(e,t){return jj(this,e,t)},async safeEncodeAsync(e,t){return Mj(this,e,t)},async safeDecodeAsync(e,t){return Nj(this,e,t)},toJSONSchema(e){return lA(this,{})(e)},get description(){return BO.get(this)?.description},get _def(){return this._zod.def}}),Lj=Y(`_ZodString`,(e,t)=>{VE.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>EA(e,t,n,r)},Lw({format:e=>SA(e).format??null,minLength:e=>SA(e).minimum??null,maxLength:e=>SA(e).maximum??null},{regex(...e){return this.check(jk(...e))},includes(...e){return this.check(Pk(...e))},startsWith(...e){return this.check(Fk(...e))},endsWith(...e){return this.check(Ik(...e))},min(...e){return this.check(kk(...e))},max(...e){return this.check(Ok(...e))},length(...e){return this.check(Ak(...e))},nonempty(...e){return this.check(kk(1,...e))},lowercase(e){return this.check(Mk(e))},uppercase(e){return this.check(Nk(e))},trim(){return this.check(Bk())},normalize(...e){return this.check(zk(...e))},toLowerCase(){return this.check(Vk())},toUpperCase(){return this.check(Hk())},slugify(){return this.check(Uk())}})),Rj=Y(`ZodString`,(e,t)=>{VE.init(e,t),Lj.init(e,t)},{email(e){return this.check(UO(Gj,e))},url(e){return this.check(YO(Jj,e))},jwt(e){return this.check(uk(lM,e))},emoji(e){return this.check(XO(Yj,e))},guid(e){return this.check(WO(Kj,e))},uuid(e){return this.check(GO(qj,e))},uuidv4(e){return this.check(KO(qj,e))},uuidv6(e){return this.check(qO(qj,e))},uuidv7(e){return this.check(JO(qj,e))},nanoid(e){return this.check(ZO(Xj,e))},cuid(e){return this.check(QO(Zj,e))},cuid2(e){return this.check($O(Qj,e))},ulid(e){return this.check(ek($j,e))},base64(e){return this.check(sk(oM,e))},base64url(e){return this.check(ck(sM,e))},xid(e){return this.check(tk(eM,e))},ksuid(e){return this.check(nk(tM,e))},ipv4(e){return this.check(rk(nM,e))},ipv6(e){return this.check(ik(rM,e))},cidrv4(e){return this.check(ak(iM,e))},cidrv6(e){return this.check(ok(aM,e))},e164(e){return this.check(lk(cM,e))},datetime(e){return this.check(dk(Vj,e))},date(e){return this.check(fk(Hj,e))},time(e){return this.check(pk(Uj,e))},duration(e){return this.check(mk(Wj,e))}});function zj(e){return HO(Rj,e)}var Bj=Y(`ZodStringFormat`,(e,t)=>{HE.init(e,t),Lj.init(e,t)}),Vj=Y(`ZodISODateTime`,(e,t)=>{sD.init(e,t),Bj.init(e,t)}),Hj=Y(`ZodISODate`,(e,t)=>{cD.init(e,t),Bj.init(e,t)}),Uj=Y(`ZodISOTime`,(e,t)=>{lD.init(e,t),Bj.init(e,t)}),Wj=Y(`ZodISODuration`,(e,t)=>{uD.init(e,t),Bj.init(e,t)}),Gj=Y(`ZodEmail`,(e,t)=>{GE.init(e,t),Bj.init(e,t)}),Kj=Y(`ZodGUID`,(e,t)=>{UE.init(e,t),Bj.init(e,t)}),qj=Y(`ZodUUID`,(e,t)=>{WE.init(e,t),Bj.init(e,t)}),Jj=Y(`ZodURL`,(e,t)=>{$E.init(e,t),Bj.init(e,t)}),Yj=Y(`ZodEmoji`,(e,t)=>{eD.init(e,t),Bj.init(e,t)}),Xj=Y(`ZodNanoID`,(e,t)=>{tD.init(e,t),Bj.init(e,t)}),Zj=Y(`ZodCUID`,(e,t)=>{nD.init(e,t),Bj.init(e,t)}),Qj=Y(`ZodCUID2`,(e,t)=>{rD.init(e,t),Bj.init(e,t)}),$j=Y(`ZodULID`,(e,t)=>{iD.init(e,t),Bj.init(e,t)}),eM=Y(`ZodXID`,(e,t)=>{aD.init(e,t),Bj.init(e,t)}),tM=Y(`ZodKSUID`,(e,t)=>{oD.init(e,t),Bj.init(e,t)}),nM=Y(`ZodIPv4`,(e,t)=>{dD.init(e,t),Bj.init(e,t)}),rM=Y(`ZodIPv6`,(e,t)=>{mD.init(e,t),Bj.init(e,t)}),iM=Y(`ZodCIDRv4`,(e,t)=>{hD.init(e,t),Bj.init(e,t)}),aM=Y(`ZodCIDRv6`,(e,t)=>{_D.init(e,t),Bj.init(e,t)}),oM=Y(`ZodBase64`,(e,t)=>{bD.init(e,t),Bj.init(e,t)}),sM=Y(`ZodBase64URL`,(e,t)=>{CD.init(e,t),Bj.init(e,t)}),cM=Y(`ZodE164`,(e,t)=>{wD.init(e,t),Bj.init(e,t)}),lM=Y(`ZodJWT`,(e,t)=>{ED.init(e,t),Bj.init(e,t)}),uM=Y(`ZodNumber`,(e,t)=>{DD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>DA(e,t,n,r),e.isFinite=!0},Lw({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=SA(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=SA(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=SA(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>SA(e).format??null},{gt(e,t){return this.check(Ck(e,t))},gte(e,t){return this.check(wk(e,t))},min(e,t){return this.check(wk(e,t))},lt(e,t){return this.check(xk(e,t))},lte(e,t){return this.check(Sk(e,t))},max(e,t){return this.check(Sk(e,t))},int(e){return this.check(pM(e))},safe(e){return this.check(pM(e))},positive(e){return this.check(Ck(0,e))},nonnegative(e){return this.check(wk(0,e))},negative(e){return this.check(xk(0,e))},nonpositive(e){return this.check(Sk(0,e))},multipleOf(e,t){return this.check(Dk(e,t))},step(e,t){return this.check(Dk(e,t))},finite(){return this}}));function dM(e){return hk(uM,e)}var fM=Y(`ZodNumberFormat`,(e,t)=>{OD.init(e,t),uM.init(e,t)});function pM(e){return gk(fM,e)}var mM=Y(`ZodBoolean`,(e,t)=>{kD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>OA(e,t,n,r)});function hM(e){return _k(mM,e)}var gM=Y(`ZodNull`,(e,t)=>{AD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jA(e,t,n,r)});function _M(e){return vk(gM,e)}var vM=Y(`ZodUnknown`,(e,t)=>{jD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function yM(){return yk(vM)}var bM=Y(`ZodNever`,(e,t)=>{MD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>PA(e,t,n,r)});function xM(e){return bk(bM,e)}var SM=Y(`ZodArray`,(e,t)=>{Fj(),ID.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>YA(e,t,n,r),e.element=t.element},{min(e,t){return this.check(kk(e,t))},nonempty(e){return this.check(kk(1,e))},max(e,t){return this.check(Ok(e,t))},length(e,t){return this.check(Ak(e,t))},unwrap(){return this.element}});function CM(e,t){return Wk(SM,e,t)}var wM=Y(`ZodObject`,(e,t)=>{Fj(),HD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ZA(e,t,n,r),Uw(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return FM(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(QC(this._zod.def,{catchall:e}))},passthrough(){return this.clone(QC(this._zod.def,{catchall:yM()}))},loose(){return this.clone(QC(this._zod.def,{catchall:yM()}))},strict(){return this.clone(QC(this._zod.def,{catchall:xM()}))},strip(){return this.clone(QC(this._zod.def,{catchall:void 0}))},extend(e){return gw(this,e)},safeExtend(e){return vw(this,e)},merge(e){return yw(this,e)},pick(e){return pw(this,e)},omit(e){return hw(this,e)},partial(...e){return bw(BM,this,e[0])},exactPartial(...e){return bw(HM,this,e[0],`exactPartial`)},required(...e){return xw(XM,this,e[0])}});function TM(e,t){return new wM({type:`object`,shape:e??{},...q(t)})}var EM=Y(`ZodUnion`,(e,t)=>{WD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>QA(e,t,n,r),e.options=t.options});function DM(e,t){return new EM({type:`union`,options:e,...q(t)})}var OM=Y(`ZodDiscriminatedUnion`,(e,t)=>{EM.init(e,t),KD.init(e,t)});function kM(e,t,n){return new OM({type:`union`,options:t,discriminator:e,...q(n)})}var AM=Y(`ZodIntersection`,(e,t)=>{qD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$A(e,t,n,r)});function jM(e,t){return new AM({type:`intersection`,left:e,right:t})}var MM=Y(`ZodRecord`,(e,t)=>{Fj(),XD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ij(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function NM(e,t,n){return!t||!t._zod?new MM({type:`record`,keyType:zj(),valueType:e,...q(t)}):new MM({type:`record`,keyType:e,valueType:t,...q(n)})}var PM=Y(`ZodEnum`,(e,t)=>{ZD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>RA(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new PM({...t,checks:[],...q(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new PM({...t,checks:[],...q(r),entries:i})}});function FM(e,t){return new PM({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...q(t)})}var IM=Y(`ZodLiteral`,(e,t)=>{QD.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zA(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function LM(e,t){return new IM({type:`literal`,values:Array.isArray(e)?e:[e],...q(t)})}var RM=Y(`ZodTransform`,(e,t)=>{Fj(),$D.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>KA(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qw(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Nw(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Nw(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function zM(e){return new RM({type:`transform`,transform:e})}var BM=Y(`ZodOptional`,(e,t)=>{tO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function VM(e){return new BM({type:`optional`,innerType:e})}var HM=Y(`ZodExactOptional`,(e,t)=>{nO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function UM(e){return new HM({type:`optional`,innerType:e})}var WM=Y(`ZodNullable`,(e,t)=>{rO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function GM(e){return new WM({type:`nullable`,innerType:e})}var KM=Y(`ZodDefault`,(e,t)=>{iO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qM(e,t){return new KM({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():aw(t)}})}var JM=Y(`ZodPrefault`,(e,t)=>{oO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function YM(e,t){return new JM({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():aw(t)}})}var XM=Y(`ZodNonOptional`,(e,t)=>{sO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ZM(e,t){return new XM({type:`nonoptional`,innerType:e,...q(t)})}var QM=Y(`ZodCatch`,(e,t)=>{uO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $M(e,t){return new QM({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Gw(t)})}var eN=Y(`ZodPipe`,(e,t)=>{dO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fj(e,t,n,r),e.in=t.in,e.out=t.out});function tN(e,t){return new eN({type:`pipe`,in:e,out:t})}var nN=Y(`ZodReadonly`,(e,t)=>{pO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pj(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rN(e){return new nN({type:`readonly`,innerType:e})}var iN=Y(`ZodLazy`,(e,t)=>{hO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gj(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function aN(e){return new iN({type:`lazy`,getter:e})}var oN=Y(`ZodCustom`,(e,t)=>{gO.init(e,t),Ij.init(e,t),e._zod.processJSONSchema=(t,n,r)=>WA(e,t,n,r)});function sN(e,t){return Gk(oN,e??(()=>!0),t)}function cN(e,t={}){return Kk(oN,e,t)}function lN(e,t){return qk(e,t)}var uN=Y(`ZodInstanceOf`,(e,t)=>{oN.init(e,t)},{properties(e,t){return this.check(Lk(e,t))}});function dN(e,t={}){let n=new uN({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...q(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var fN=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},pN=10,mN=13,hN=32;function gN(e){}function _N(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=gN,onError:n=gN,onRetry:r=gN,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
147
+ `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new fN(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
148
+ `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(`
149
+ `,n);continue}let i=e.charCodeAt(n);if(vN(e,n,i)){let i=e.charCodeAt(n+5)===hN?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===pN){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
150
+ `,n);continue}u=d===0?a:`${u}
151
+ ${a}`,d++}else yN(e,n,i)?f=e.slice(e.charCodeAt(n+6)===hN?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
152
+ `,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
153
+ `,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;_(e,n,i),n=i+1,e.charCodeAt(n-1)===mN&&e.charCodeAt(n)===pN&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(vN(e,t,r)){let r=e.charCodeAt(t+5)===hN?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
154
+ ${i}`,d++;return}if(yN(e,t,r)){f=e.slice(e.charCodeAt(t+6)===hN?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===hN?t+4:t+3,n);r.includes(`\0`)||(l=r);return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===hN?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){v(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===hN?2:1;v(s,a.slice(o+c),a)}function v(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
155
+ ${t}`,d++;break;case`id`:t.includes(`\0`)||(l=t);break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new fN(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new fN(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}))}}function y(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function b(e={}){if(e.consume&&o.length>0){let e=o.join(``);_(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:b}}function vN(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function yN(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var bN=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=_N({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}};new TextDecoder;var{btoa:xN,atob:SN}=globalThis,CN=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get,wN=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get;function TN(e){return ArrayBuffer.isView(e)&&CN.call(e)===`Uint8Array`}function EN(e){if(typeof e!=`object`||!e||!(`byteLength`in e))return!1;try{return wN.call(e),!0}catch{return!1}}function DN(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var ON=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new SC({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},kN=ON();function AN(e){return globalThis.Buffer?.isBuffer(e)??!1}var jN=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,MN=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function NN(e){let t=JSON.parse(e);return typeof t!=`object`||!t||jN.test(e)===!1&&MN.test(e)===!1?t:PN(t)}function PN(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function FN(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return NN(e)}try{return NN(e)}finally{Error.stackTraceLimit=t}}function IN(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&LN(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=LN(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(LN):LN(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(LN)),e.allOf!=null&&(e.allOf=e.allOf.map(LN)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(LN));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=LN(t[e]);return e}function LN(e){return typeof e==`boolean`?e:IN(e)}var RN=Symbol(`Let zodToJsonSchema decide on which parser to use`),zN={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},BN=e=>typeof e==`string`?{...zN,name:e}:{...zN,...e};function VN(){return{}}function HN(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=X(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function UN(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function WN(){return{type:`boolean`}}function GN(e,t){return X(e.type._def,t)}var KN=(e,t)=>X(e.innerType._def,t);function qN(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>qN(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return JN(e)}}var JN=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value}return t};function YN(e,t){return{...X(e.innerType._def,t),default:e.defaultValue()}}function XN(e,t){return t.effectStrategy===`input`?X(e.schema._def,t):VN()}function ZN(e){return{type:`string`,enum:Array.from(e.values)}}var QN=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function $N(e,t){let n=[X(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),X(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(QN(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function eP(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var tP=void 0,nP={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(tP===void 0&&(tP=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),tP),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function rP(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:sP(n,`email`,r.message,t);break;case`format:idn-email`:sP(n,`idn-email`,r.message,t);break;case`pattern:zod`:cP(n,nP.email,r.message,t)}break;case`url`:sP(n,`uri`,r.message,t);break;case`uuid`:sP(n,`uuid`,r.message,t);break;case`regex`:cP(n,r.regex,r.message,t);break;case`cuid`:cP(n,nP.cuid,r.message,t);break;case`cuid2`:cP(n,nP.cuid2,r.message,t);break;case`startsWith`:cP(n,RegExp(`^${iP(r.value,t)}`),r.message,t);break;case`endsWith`:cP(n,RegExp(`${iP(r.value,t)}$`),r.message,t);break;case`datetime`:sP(n,`date-time`,r.message,t);break;case`date`:sP(n,`date`,r.message,t);break;case`time`:sP(n,`time`,r.message,t);break;case`duration`:sP(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:cP(n,RegExp(iP(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&sP(n,`ipv4`,r.message,t),r.version!==`v4`&&sP(n,`ipv6`,r.message,t);break;case`base64url`:cP(n,nP.base64url,r.message,t);break;case`jwt`:cP(n,nP.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&cP(n,nP.ipv4Cidr,r.message,t),r.version!==`v4`&&cP(n,nP.ipv6Cidr,r.message,t);break;case`emoji`:cP(n,nP.emoji(),r.message,t);break;case`ulid`:cP(n,nP.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:sP(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:cP(n,nP.base64,r.message,t)}break;case`nanoid`:cP(n,nP.nanoid,r.message,t)}return n}function iP(e,t){return t.patternStrategy===`escape`?oP(e):e}var aP=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function oP(e){let t=``;for(let n=0;n<e.length;n++)aP.has(e[n])||(t+=`\\`),t+=e[n];return t}function sP(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function cP(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:lP(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=lP(t,r)}function lP(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++)if(a)i+=r[e],a=!1;else{if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
156
+ ]))`;continue}if(r[e]===`$`){i+=`($|(?=[\r
157
+ ]))`;continue}}n.s&&r[e]===`.`?i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`:(i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0))}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function uP(e,t){let n={type:`object`,additionalProperties:X(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===`ZodString`&&e.keyType._def.checks?.length){let{type:r,...i}=rP(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===`ZodEnum`)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===`ZodBranded`&&e.keyType._def.type._def.typeName===`ZodString`&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=GN(e.keyType._def,t);return{...n,propertyNames:i}}return n}function dP(e,t){return t.mapStrategy===`record`?uP(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[X(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||VN(),X(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||VN()],minItems:2,maxItems:2}}}function fP(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function pP(){return{not:VN()}}function mP(){return{type:`null`}}var hP={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function gP(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in hP&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=hP[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return _P(e,t)}var _P=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>X(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function vP(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[hP[e.innerType._def.typeName],`null`]};let n=X(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function yP(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function bP(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=SP(a),s=X(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=xP(e,t);return a!==void 0&&(n.additionalProperties=a),n}function xP(e,t){if(e.catchall._def.typeName!==`ZodNever`)return X(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function SP(e){try{return e.isOptional()}catch{return!0}}var CP=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return X(e.innerType._def,t);let n=X(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:VN()},n]}:VN()},wP=(e,t)=>{if(t.pipeStrategy===`input`)return X(e.in._def,t);if(t.pipeStrategy===`output`)return X(e.out._def,t);let n=X(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,X(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function TP(e,t){return X(e.type._def,t)}function EP(e,t){let n={type:`array`,uniqueItems:!0,items:X(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function DP(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>X(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:X(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>X(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function OP(){return{not:VN()}}function kP(){return VN()}var AP=(e,t)=>X(e.innerType._def,t),jP=(e,t,n)=>{switch(t){case`ZodString`:return rP(e,n);case`ZodNumber`:return yP(e);case`ZodObject`:return bP(e,n);case`ZodBigInt`:return UN(e);case`ZodBoolean`:return WN();case`ZodDate`:return qN(e,n);case`ZodUndefined`:return OP();case`ZodNull`:return mP();case`ZodArray`:return HN(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return gP(e,n);case`ZodIntersection`:return $N(e,n);case`ZodTuple`:return DP(e,n);case`ZodRecord`:return uP(e,n);case`ZodLiteral`:return eP(e);case`ZodEnum`:return ZN(e);case`ZodNativeEnum`:return fP(e);case`ZodNullable`:return vP(e,n);case`ZodOptional`:return CP(e,n);case`ZodMap`:return dP(e,n);case`ZodSet`:return EP(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return TP(e,n);case`ZodNaN`:case`ZodNever`:return pP();case`ZodEffects`:return XN(e,n);case`ZodAny`:return VN();case`ZodUnknown`:return kP();case`ZodDefault`:return YN(e,n);case`ZodBranded`:return GN(e,n);case`ZodReadonly`:return AP(e,n);case`ZodCatch`:return KN(e,n);case`ZodPipeline`:return wP(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},MP=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function X(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==RN)return i}if(r&&!n){let e=NP(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=jP(e,e.typeName,t),o=typeof a==`function`?X(a(),t):a;if(o&&PP(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var NP=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:MP(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),VN()):t.$refStrategy===`seen`?VN():void 0}},PP=(e,t,n)=>(e.description&&(n.description=e.description),n),FP=e=>{let t=BN(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},IP=(e,t)=>{let n=FP(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:X(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??VN()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=X(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??VN(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},LP=Symbol.for(`vercel.ai.schema`);function RP(e){let t;return()=>(t??=e(),t)}function zP(e,{validate:t}={}){return{[LP]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function BP(e){return typeof e==`object`&&!!e&&LP in e&&e[LP]===!0&&`jsonSchema`in e&&`validate`in e}function VP(e){return e==null?zP({type:`object`,properties:{},additionalProperties:!1}):BP(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?qP(e):HP(e):e()}function HP(e){return zP(()=>{if(!UP(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return IN(e[`~standard`].jsonSchema.input({target:`draft-07`}))},{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new AC({value:t,cause:n.issues})}}})}function UP(e){return e[`~standard`].jsonSchema!=null}function WP(e,t){let n=t?.useReferences??!1;return zP(()=>IP(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function GP(e,t){eT().localeError||eT(IO());let n=t?.useReferences??!1;return zP(()=>IN(vj(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await Tj(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function KP(e){return`_zod`in e}function qP(e,t){return KP(e)?GP(e,t):WP(e,t)}async function JP({value:e,schema:t,context:n}){let r=await YP({value:e,schema:t,context:n});if(!r.success)throw AC.wrap({value:e,cause:r.error,context:n});return r.value}async function YP({value:e,schema:t,context:n}){let r=VP(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:AC.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:AC.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function XP({text:e,schema:t}){try{let n=FN(e);return t==null?{success:!0,value:n,rawValue:n}:await YP({value:n,schema:t})}catch(t){return{success:!1,error:EC.isInstance(t)?t:new EC({text:e,cause:t}),rawValue:void 0}}}function ZP({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new bN).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await XP({text:e,schema:t}))}}))}async function QP(e){return typeof e==`function`&&(e=e()),e}new TextDecoder;var $P=Y(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);LE.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){Fw(this,`with`,e)},parse(e,t){return mT(this,e,t,{callee:this.parse})},parseAsync(e,t){return gT(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return vT(this,e,t)},safeParseAsync(e,t){return xT(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return cw(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),eF=Y(`ZodMiniString`,(e,t)=>{VE.init(e,t),$P.init(e,t)});function tF(e){return HO(eF,e)}var nF=Y(`ZodMiniNumber`,(e,t)=>{DD.init(e,t),$P.init(e,t)});function rF(e){return hk(nF,e)}var iF=Y(`ZodMiniNumberFormat`,(e,t)=>{OD.init(e,t),nF.init(e,t)});function aF(e){return gk(iF,e)}var oF=Y(`ZodMiniBoolean`,(e,t)=>{kD.init(e,t),$P.init(e,t)});function sF(e){return _k(oF,e)}var cF=Y(`ZodMiniUnknown`,(e,t)=>{jD.init(e,t),$P.init(e,t)});function lF(){return yk(cF)}var uF=Y(`ZodMiniNever`,(e,t)=>{MD.init(e,t),$P.init(e,t)});function dF(e){return bk(uF,e)}var fF=Y(`ZodMiniArray`,(e,t)=>{ID.init(e,t),$P.init(e,t)});function pF(e,t){return new fF({type:`array`,element:e,...q(t)})}var mF=Y(`ZodMiniObject`,(e,t)=>{VD.init(e,t),$P.init(e,t),Uw(e,`shape`,e=>e._zod.def.shape,!1)});function hF(e,t){return new mF({type:`object`,shape:e??{},...q(t)})}function gF(e,t){return new mF({type:`object`,shape:e,catchall:lF(),...q(t)})}function _F(e,t){return gw(e,t)}var vF=Y(`ZodMiniUnion`,(e,t)=>{WD.init(e,t),$P.init(e,t)});function yF(e,t){return new vF({type:`union`,options:e,...q(t)})}var bF=Y(`ZodMiniDiscriminatedUnion`,(e,t)=>{KD.init(e,t),$P.init(e,t)});function xF(e,t,n){return new bF({type:`union`,options:t,discriminator:e,...q(n)})}var SF=Y(`ZodMiniRecord`,(e,t)=>{XD.init(e,t),$P.init(e,t)});function CF(e,t,n){return!t||!t._zod?new SF({type:`record`,keyType:tF(),valueType:e,...q(t)}):new SF({type:`record`,keyType:e,valueType:t,...q(n)})}var wF=Y(`ZodMiniEnum`,(e,t)=>{ZD.init(e,t),$P.init(e,t),e.options=[...e._zod.values]});function TF(e,t){return new wF({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...q(t)})}var EF=Y(`ZodMiniLiteral`,(e,t)=>{QD.init(e,t),$P.init(e,t)});function DF(e,t){return new EF({type:`literal`,values:Array.isArray(e)?e:[e],...q(t)})}var OF=Y(`ZodMiniTransform`,(e,t)=>{$D.init(e,t),$P.init(e,t)});function kF(e){return new OF({type:`transform`,transform:e})}var AF=Y(`ZodMiniOptional`,(e,t)=>{tO.init(e,t),$P.init(e,t)});function jF(e){return new AF({type:`optional`,innerType:e})}var MF=Y(`ZodMiniPipe`,(e,t)=>{dO.init(e,t),$P.init(e,t)});function NF(e,t){return new MF({type:`pipe`,in:e,out:t})}var PF=Y(`ZodMiniCustom`,(e,t)=>{gO.init(e,t),$P.init(e,t)});function FF(e,t){return Gk(PF,e??(()=>!0),t)}function IF(e,t={}){return Kk(PF,e,t)}var LF=`AI_InvalidArgumentError`,RF=`vercel.ai.error.${LF}`,zF=Symbol.for(RF),BF=class extends lC{constructor({parameter:e,value:t,message:n}){super({name:LF,message:`Invalid argument for parameter ${e}: ${n}`}),this[zF]=!0,this.parameter=e,this.value=t}static isInstance(e){return lC.hasMarker(e,RF)}},VF=`AI_UIMessageStreamError`,HF=`vercel.ai.error.${VF}`,UF=Symbol.for(HF),WF=class extends lC{constructor({chunkType:e,chunkId:t,message:n}){super({name:VF,message:n}),this[UF]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return lC.hasMarker(e,HF)}};function GF(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);n[r]=o&&s?GF(a,i):i}return n}function KF(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`)}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop()}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop()}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop()}break;case`INSIDE_OBJECT_AFTER_COMMA`:u===`"`&&(t.pop(),t.push(`INSIDE_OBJECT_KEY`));break;case`INSIDE_OBJECT_KEY`:u===`"`&&(t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`));break;case`INSIDE_OBJECT_AFTER_KEY`:u===`:`&&(t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`));break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`)}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop()}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function qF(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await XP({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await XP({text:KF(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}ON({prefix:`steer`,size:24}),new TextEncoder,new TextEncoder,ON({prefix:`aitxt`,size:24}),ON({prefix:`call`,size:24}),TransformStream;var Z={NEVER:qw,array:pF,boolean:sF,custom:FF,discriminatedUnion:xF,enum:TF,extend:_F,int:aF,literal:DF,looseObject:gF,maximum:Sk,minLength:kk,never:dF,nonnegative:Ek,number:rF,object:hF,optional:jF,pipe:NF,positive:Tk,record:CF,refine:IF,safeParse:vT,startsWith:Fk,string:tF,transform:kF,union:yF,unknown:lF},Q={array:CM,boolean:hM,custom:sN,discriminatedUnion:kM,instanceof:dN,lazy:aN,literal:LM,null:_M,number:dM,object:TM,record:NM,string:zj,union:DM,unknown:yM},JF=Q.lazy(()=>Q.union([Q.null(),Q.string(),Q.number(),Q.boolean(),Q.record(Q.string(),JF.optional()),Q.array(JF)])),$=Q.record(Q.string(),Q.record(Q.string(),JF.optional())),YF=Z.object({source:Z.discriminatedUnion(`sourceType`,[Z.object({type:Z.literal(`source`),sourceType:Z.literal(`url`),id:Z.string(),url:Z.string(),title:Z.optional(Z.string()),providerMetadata:Z.optional($)}),Z.object({type:Z.literal(`source`),sourceType:Z.literal(`document`),id:Z.string(),mediaType:Z.string(),title:Z.string(),filename:Z.optional(Z.string()),providerMetadata:Z.optional($)})]),startIndex:Z.optional(Z.number().check(Z.int()).check(Z.nonnegative())),endIndex:Z.optional(Z.number().check(Z.int()).check(Z.nonnegative())),citedText:Z.optional(Z.string())}),XF=Z.record(Z.string(),Z.optional(JF)),ZF=RP(()=>qP(Z.union([Z.looseObject({type:Z.literal(`text-start`),id:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`text-delta`),id:Z.string(),delta:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`text-end`),id:Z.string(),citations:Z.optional(Z.array(YF)),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`error`),errorText:Z.string()}),Z.looseObject({type:Z.literal(`tool-input-start`),toolCallId:Z.string(),toolName:Z.string(),inputEncoding:Z.optional(Z.enum([`json`,`text`])),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($),toolMetadata:Z.optional(XF),dynamic:Z.optional(Z.boolean()),title:Z.optional(Z.string())}),Z.looseObject({type:Z.literal(`tool-input-delta`),toolCallId:Z.string(),inputTextDelta:Z.string()}),Z.looseObject({type:Z.literal(`tool-input-available`),toolCallId:Z.string(),toolName:Z.string(),input:Z.unknown(),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($),toolMetadata:Z.optional(XF),dynamic:Z.optional(Z.boolean()),title:Z.optional(Z.string())}),Z.looseObject({type:Z.literal(`tool-input-error`),toolCallId:Z.string(),toolName:Z.string(),input:Z.unknown(),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($),toolMetadata:Z.optional(XF),dynamic:Z.optional(Z.boolean()),errorText:Z.string(),title:Z.optional(Z.string())}),Z.looseObject({type:Z.literal(`tool-approval-request`),approvalId:Z.string(),toolCallId:Z.string(),approvalDescriptor:Z.optional(Z.unknown()),inputSchemaInput:Z.optional(Z.unknown()),reason:Z.optional(Z.string()),isAutomatic:Z.optional(Z.boolean()),signature:Z.optional(Z.string())}),Z.looseObject({type:Z.literal(`tool-approval-response`),approvalId:Z.string(),approved:Z.boolean(),reason:Z.optional(Z.string()),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`tool-output-available`),toolCallId:Z.string(),output:Z.unknown(),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($),toolMetadata:Z.optional(XF),dynamic:Z.optional(Z.boolean()),preliminary:Z.optional(Z.boolean())}),Z.looseObject({type:Z.literal(`tool-output-error`),toolCallId:Z.string(),errorText:Z.string(),providerExecuted:Z.optional(Z.boolean()),providerMetadata:Z.optional($),toolMetadata:Z.optional(XF),dynamic:Z.optional(Z.boolean())}),Z.looseObject({type:Z.literal(`tool-output-denied`),toolCallId:Z.string()}),Z.looseObject({type:Z.literal(`reasoning-start`),id:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`reasoning-delta`),id:Z.string(),delta:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`reasoning-end`),id:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`custom`),kind:Z.pipe(Z.string(),Z.transform(e=>e)),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`source-url`),sourceId:Z.string(),url:Z.string(),title:Z.optional(Z.string()),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`source-document`),sourceId:Z.string(),mediaType:Z.string(),title:Z.string(),filename:Z.optional(Z.string()),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`file`),url:Z.string(),mediaType:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`reasoning-file`),url:Z.string(),mediaType:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`steering-message`),id:Z.string(),parts:Z.array(Z.union([Z.looseObject({type:Z.literal(`text`),text:Z.string(),providerMetadata:Z.optional($)}),Z.looseObject({type:Z.literal(`file`),mediaType:Z.string(),url:Z.string(),filename:Z.optional(Z.string()),providerReference:Z.optional(Z.record(Z.string(),Z.string())),providerMetadata:Z.optional($)})]))}),Z.looseObject({type:Z.custom(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:Z.optional(Z.string()),data:Z.unknown(),transient:Z.optional(Z.boolean())}),Z.looseObject({type:Z.literal(`start-step`)}),Z.looseObject({type:Z.literal(`finish-step`)}),Z.looseObject({type:Z.literal(`reset-step`)}),Z.looseObject({type:Z.literal(`start`),messageId:Z.optional(Z.string()),messageMetadata:Z.optional(Z.unknown())}),Z.looseObject({type:Z.literal(`finish`),finishReason:Z.optional(Z.enum([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`interrupted`,`other`])),messageMetadata:Z.optional(Z.unknown())}),Z.looseObject({type:Z.literal(`abort`),reason:Z.optional(Z.string())}),Z.looseObject({type:Z.literal(`message-metadata`),messageMetadata:Z.unknown()})])));function QF(e){return e.type.startsWith(`data-`)}function $F(){return Object.create(null)}function eI(e){return e.type.startsWith(`tool-`)}function tI(e){return e.type===`dynamic-tool`}function nI(e){return eI(e)||tI(e)}function rI(e){return e.type.split(`-`).slice(1).join(`-`)}function iI(e){return tI(e)?e.toolName:rI(e)}function aI({lastMessage:e,messageId:t}){let n=e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},r=$F(),i=n.parts.findLastIndex(e=>e.type===`step-start`),a=0;for(let e of n.parts.slice(i+1)){if(!nI(e))continue;let t=a;eI(e)&&a++,e.state===`input-streaming`&&(r[e.toolCallId]={text:e.rawInput??``,inputEncoding:e.inputEncoding,index:t,toolName:e.type===`dynamic-tool`?e.toolName:rI(e),dynamic:e.type===`dynamic-tool`,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:$F(),activeReasoningParts:$F(),partialToolCalls:r}}function oI({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o,resetStateOnMessageIdChange:s=!1,resetStateOnFirstMessageStart:c=!1}){let l=!0;return e.pipeThrough(new TransformStream({async transform(e,u){await r(async({state:r,write:d})=>{function f(){let e=r.message.parts,t=e.length-1;for(;t>=0&&e[t].type!==`step-start`;)t--;return e.slice(t+1)}function p(){return f().filter(nI)}function m(e){let t=p().find(t=>t.toolCallId===e);if(t==null){let n=r.message.parts;for(let r=n.length-1;r>=0;r--){let i=n[r];if(nI(i)&&i.toolCallId===e){t=i;break}}}if(t==null)throw new WF({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function h(e){let t=r.message.parts.filter(nI).find(t=>t.approval?.id===e);if(t==null)throw new WF({chunkType:`tool-approval-response`,chunkId:e,message:`No tool invocation found for approval ID "${e}".`});return t}function g(e,t){let n=t??f().find(t=>eI(t)&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.type=`tool-${e.toolName}`,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null){if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary,...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&e.state!==`output-available`&&e.state!==`output-error`?{callProviderMetadata:i.providerMetadata}:{}})}function _(e,t){let n=t??f().find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.toolName=e.toolName,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null){if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,errorText:i.errorText,preliminary:i.preliminary,providerExecuted:i.providerExecuted,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&e.state!==`output-available`&&e.state!==`output-error`?{callProviderMetadata:i.providerMetadata}:{}})}async function v(e){if(e!=null){let n=r.message.metadata==null?e:GF(r.message.metadata,e);t!=null&&await JP({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),d();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new WF({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new WF({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,e.citations!=null&&(t.citations=e.citations),t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],d();break}case`custom`:{let t={type:`custom`,kind:e.kind,providerMetadata:e.providerMetadata};r.message.parts.push(t),d();break}case`reasoning-start`:{let t={type:`reasoning`,id:e.id,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),d();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new WF({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new WF({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],d();break}case`file`:case`reasoning-file`:r.message.parts.push({type:e.type,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),d();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),d();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),d();break;case`tool-input-start`:{let t=f().filter(eI);r.partialToolCalls[e.toolCallId]={text:``,inputEncoding:e.inputEncoding,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),d();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new WF({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let n=t.inputEncoding===`text`?t.text:(await qF(t.text)).value;t.dynamic?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}):g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}),d();break}case`tool-input-available`:e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),d(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=f().filter(nI).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),d();break}case`tool-approval-request`:{let t=m(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId,...e.approvalDescriptor==null?{}:{descriptor:e.approvalDescriptor},...Object.prototype.hasOwnProperty.call(e,`inputSchemaInput`)?{inputSchemaInput:e.inputSchemaInput}:{},...e.reason==null?{}:{requestReason:e.reason},...e.isAutomatic===!0?{isAutomatic:!0}:{},...e.signature==null?{}:{signature:e.signature}},d();break}case`tool-approval-response`:{let t=h(e.approvalId),n=t.approval==null?{id:e.approvalId}:t.approval;t.state=`approval-responded`,t.approval={...n,id:e.approvalId,approved:e.approved,...e.reason==null?{}:{reason:e.reason}},e.providerExecuted!=null&&(t.providerExecuted=e.providerExecuted),e.providerMetadata!=null&&(t.callProviderMetadata=e.providerMetadata),d();break}case`tool-output-denied`:{let t=m(e.toolCallId);t.state=`output-denied`,d();break}case`tool-output-available`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:rI(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`tool-output-error`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:rI(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`steering-message`:r.message.parts.push({type:`steering-message`,id:e.id,parts:e.parts}),d();break;case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:break;case`reset-step`:{let e=f();r.activeTextParts=$F(),r.activeReasoningParts=$F(),r.partialToolCalls=$F(),e.length>0&&(r.message.parts.splice(r.message.parts.length-e.length,e.length),d());break}case`start`:{let t=c&&l||s&&e.messageId!=null&&e.messageId!==r.message.id;l=!1,t&&Object.assign(r,aI({lastMessage:void 0,messageId:e.messageId??r.message.id}),{finishReason:void 0}),e.messageId!=null&&(r.message.id=e.messageId),await v(e.messageMetadata),(t||e.messageId!=null||e.messageMetadata!=null)&&d({updateStatus:!1});break}case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`message-metadata`:await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`error`:i?.(Error(e.errorText));break;default:if(QF(e)){let t=n?.[e.type.slice(5)];if(t!=null){let n=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=n>=0?n:r.message.parts.length;await JP({value:e.data,schema:t,context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let i=e;if(i.transient){o?.(i);break}let a=i.id==null?void 0:r.message.parts.find(e=>i.type===e.type&&i.id===e.id);a==null?r.message.parts.push(i):a.data=i.data,o?.(i),d()}}u.enqueue(e)})}}))}async function sI({stream:e,onError:t,abortSignal:n}){let r=e.getReader(),i=()=>{r.cancel().catch(()=>{})};n?.aborted?i():n?.addEventListener(`abort`,i,{once:!0});try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){t?.(e)}finally{n?.removeEventListener(`abort`,i),r.releaseLock()}}function cI(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}ON({prefix:`aitxt`,size:24}),ON({prefix:`call`,size:24}),ON({prefix:`aitxt`,size:24}),ON({prefix:`call`,size:24});function lI(e,t=[],n=new WeakSet){switch(typeof e){case`number`:return Number.isFinite(e)?void 0:[...t];case`bigint`:case`symbol`:case`function`:return[...t];case`object`:{if(e===null||n.has(e))return;n.add(e);let r=Array.isArray(e)?e.keys():Object.keys(e);for(let i of r){if(i===`__proto__`)continue;t.push(i);let r=lI(e[i],t,n);if(r!=null)return r;t.pop()}return}default:return}}function uI(e,t=[]){return Z.pipe(Z.unknown().check(e=>{let n=e.value;for(let e of t)n=typeof n==`object`&&n?n[e]:void 0;let r=lI(n);r!=null&&e.issues.push({code:`custom`,message:`Invalid JSON value. Expected null, a string, a finite number, a boolean, an array, or an object.`,input:e.value,path:[...t,...r]})}),e)}uI(Z.record(Z.string(),Z.optional(JF))),uI($),Z.record(Z.string(),Z.string()),uI(YF,[`source`,`providerMetadata`]),ON({prefix:`call`,size:24}),ON({prefix:`call`,size:24}),new TextEncoder,ON({prefix:`call`,size:24}),ON({prefix:`aiobj`,size:24});var{atob:dI}=globalThis,fI=class{constructor(){this.queue=[],this.isProcessing=!1,this.idleWaiters=[]}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;this.queue.length>0;)await this.queue[0](),this.queue.shift()}finally{this.isProcessing=!1;for(let e of this.idleWaiters.splice(0))e()}}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}async waitForIdle(){(this.isProcessing||this.queue.length!==0)&&await new Promise(e=>{this.idleWaiters.push(e)})}};ON({prefix:`aiobj`,size:24}),ON({prefix:`call`,size:24});var pI=Q.union([Q.string(),Q.custom(TN,{message:`Must be a Uint8Array`}),Q.custom(EN,{message:`Must be an ArrayBuffer`}),Q.custom(AN,{message:`Must be a Buffer`})]),mI=Q.record(Q.string(),Q.string()),hI=Q.object({type:Q.literal(`text`),text:Q.string(),providerOptions:$.optional()}),gI=Q.object({type:Q.literal(`image`),image:Q.union([pI,Q.instanceof(URL),mI]),mediaType:Q.string().optional(),providerOptions:$.optional()}),_I=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`data`),data:pI}),Q.object({type:Q.literal(`url`),url:Q.instanceof(URL)}),Q.object({type:Q.literal(`reference`),reference:mI}),Q.object({type:Q.literal(`text`),text:Q.string()})]),vI=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`data`),data:pI}),Q.object({type:Q.literal(`url`),url:Q.instanceof(URL)})]),yI=Q.object({type:Q.literal(`file`),data:Q.union([_I,pI,Q.instanceof(URL),mI]),filename:Q.string().optional(),mediaType:Q.string(),providerOptions:$.optional()}),bI=Q.object({type:Q.literal(`reasoning`),text:Q.string(),providerOptions:$.optional()}),xI=Q.object({type:Q.literal(`custom`),kind:Q.string().transform(e=>e),providerOptions:$.optional()}),SI=Q.object({type:Q.literal(`reasoning-file`),data:Q.union([vI,pI,Q.instanceof(URL)]),mediaType:Q.string(),providerOptions:$.optional()}),CI=Q.object({type:Q.literal(`tool-call`),toolCallId:Q.string(),toolName:Q.string(),input:Q.unknown(),providerOptions:$.optional(),providerExecuted:Q.boolean().optional()}),wI=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`text`),value:Q.string(),providerOptions:$.optional()}),Q.object({type:Q.literal(`json`),value:JF,providerOptions:$.optional()}),Q.object({type:Q.literal(`execution-denied`),reason:Q.string().optional(),providerOptions:$.optional()}),Q.object({type:Q.literal(`error-text`),value:Q.string(),providerOptions:$.optional()}),Q.object({type:Q.literal(`error-json`),value:JF,providerOptions:$.optional()}),Q.object({type:Q.literal(`content`),value:Q.array(Q.union([Q.object({type:Q.literal(`text`),text:Q.string(),providerOptions:$.optional()}),Q.object({type:Q.literal(`file`),data:_I,mediaType:Q.string(),filename:Q.string().optional(),providerOptions:$.optional()}),Q.object({type:Q.literal(`file-data`),data:Q.string(),mediaType:Q.string(),filename:Q.string().optional(),providerOptions:$.optional()}),Q.object({type:Q.literal(`file-url`),url:Q.string(),mediaType:Q.string().optional(),providerOptions:$.optional()}),Q.object({type:Q.literal(`file-id`),fileId:Q.union([Q.string(),Q.record(Q.string(),Q.string())]),providerOptions:$.optional()}),Q.object({type:Q.literal(`file-reference`),providerReference:Q.record(Q.string(),Q.string()),providerOptions:$.optional()}),Q.object({type:Q.literal(`image-data`),data:Q.string(),mediaType:Q.string(),providerOptions:$.optional()}),Q.object({type:Q.literal(`image-url`),url:Q.string(),providerOptions:$.optional()}),Q.object({type:Q.literal(`image-file-id`),fileId:Q.union([Q.string(),Q.record(Q.string(),Q.string())]),providerOptions:$.optional()}),Q.object({type:Q.literal(`image-file-reference`),providerReference:Q.record(Q.string(),Q.string()),providerOptions:$.optional()}),Q.object({type:Q.literal(`custom`),providerOptions:$.optional()})]))})]),TI=Q.object({type:Q.literal(`tool-result`),toolCallId:Q.string(),toolName:Q.string(),output:wI,providerOptions:$.optional()}),EI=Q.object({type:Q.literal(`tool-approval-request`),approvalId:Q.string(),toolCallId:Q.string(),reason:Q.string().optional(),isAutomatic:Q.boolean().optional(),signature:Q.string().optional(),inputSchemaInput:Q.unknown().optional()}),DI=Q.object({type:Q.literal(`tool-approval-response`),approvalId:Q.string(),approved:Q.boolean(),reason:Q.string().optional()}),OI=Q.object({role:Q.literal(`system`),content:Q.string(),providerOptions:$.optional()}),kI=Q.object({role:Q.literal(`user`),content:Q.union([Q.string(),Q.array(Q.union([hI,gI,yI]))]),providerOptions:$.optional()}),AI=Q.object({role:Q.literal(`assistant`),content:Q.union([Q.string(),Q.array(Q.union([hI,xI,yI,bI,SI,CI,TI,EI]))]),providerOptions:$.optional()}),jI=Q.object({role:Q.literal(`tool`),content:Q.array(Q.union([TI,DI])),providerOptions:$.optional()});Q.union([OI,kI,AI,jI]),Z.object({token:Z.string().check(Z.refine(e=>e.trim().length>0)),url:Z.string().check(Z.refine(e=>{try{let t=new URL(e);return(t.protocol===`ws:`||t.protocol===`wss:`)&&t.hostname!==``}catch{return!1}})),expiresAt:Z.optional(Z.number().check(Z.positive()).check(Z.maximum(2**53-1))),tools:Z.optional(Z.array(Z.object({type:Z.literal(`function`),name:Z.string().check(Z.minLength(1)),description:Z.optional(Z.string()),parameters:Z.record(Z.string(),Z.unknown())})))}),ON({prefix:`call`,size:24}),ON({prefix:`call`,size:24}),ON({prefix:`call`,size:24});async function MI({response:e,url:t,fallbackMessage:n}){let r=await e.text();return new pC({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function NI(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new PC({functionality:`FileList`,message:`FileList is not supported in the current environment`});return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}function PI(e,t){let n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n);return`${r.endsWith(`/`)&&t.startsWith(`/`)?r.slice(0,-1):r}${t}${i}`}var FI=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await QP(this.body),r=await QP(this.headers),i=await QP(this.credentials),a={...DN(r),...DN(t.headers)},o=await this.prepareSendMessagesRequest?.({api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:DN(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"content-type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw await MI({response:d,url:s,fallbackMessage:`Failed to fetch the chat response.`});if(!d.body)throw new _C({message:`The response body is empty.`});return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await QP(this.body),n=await QP(this.headers),r=await QP(this.credentials),i={...DN(n),...DN(e.headers)},a=await this.prepareReconnectToStreamRequest?.({api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api;if(o==null){if(e.chatId===`.`||e.chatId===`..`)throw new BF({parameter:`chatId`,value:e.chatId,message:`Chat IDs must not be "." or ".." when using the default reconnect URL.`});o=PI(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}let s=a?.headers===void 0?i:DN(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c,signal:e.abortSignal});if(l.status===204)return null;if(!l.ok)throw await MI({response:l,url:o,fallbackMessage:`Failed to fetch the chat response.`});if(!l.body)throw new _C({message:`The response body is empty.`});return this.processResponseStream(l.body)}},II=class extends FI{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return ZP({stream:e,schema:ZF}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},LI=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=kN,id:t,transport:n=new II,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u,experimental_queue:d=!1}){this.queuedMessagesFallback=[],this.queuedMessageOptions=new Map,this.isQueuePaused=!1,this.pendingAutomaticDecisions=[],this.pendingMessagePreparations=new Set,this.interruptedMessageIds=new Set,this.activeResponse=void 0,this.activeResumeRequest=void 0,this.resumableStreamState=void 0,this.jobExecutor=new fI,this.activeStopCount=0,this.stopGeneration=0,this.experimental_removeQueuedMessage=e=>{this.queuedMessageOptions.delete(e),this.setQueuedMessages(this.experimental_queuedMessages.filter(t=>t.id!==e))},this.experimental_sendQueuedMessageNow=async e=>{let t=this.experimental_queuedMessages.find(t=>t.id===e);if(t==null)return;this.setQueuedMessages([t,...this.experimental_queuedMessages.filter(t=>t.id!==e)]);let n=this.stopGeneration+1;await this.stop(),n===this.stopGeneration&&await this.resumeQueue({skipWaitForUser:!0,options:this.queuedMessageOptions.get(e)})},this.sendMessage=async(e,t)=>{if(e==null){let e=this.pendingApprovalMessageId;if(e==null){e=this.lastMessage?.id;for(let t=this.state.messages.length-1;t>=0;t--){let n=this.state.messages[t];if(n.role===`assistant`&&n.parts.some(e=>nI(e)&&e.state===`approval-responded`)){e=n.id;break}}}let n=e!=null&&e===this.pendingApprovalMessageId?this.state.messages.findIndex(t=>t.id===e):-1;await this.makeRequestForToolApproval({messageId:e,messageIndex:n,...t});return}let n;if(`text`in e||`files`in e){let t=new AbortController;this.pendingMessagePreparations.add(t);let r;try{r=Array.isArray(e.files)?e.files:await NI(e.files)}finally{this.pendingMessagePreparations.delete(t)}if(t.signal.aborted)return;n={parts:[...r,...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}}else n=e;if(this.queueEnabled&&e.messageId==null&&(this.isRequestInProgress()||this.isWaitingForUser()||this.experimental_queuedMessages.length>0)){let r={...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata};t!=null&&this.queuedMessageOptions.set(r.id,t),this.setQueuedMessages([...this.experimental_queuedMessages,r]),await this.resumeQueue({skipWaitForUser:this.isQueuePaused,options:t})}else{if(e.messageId!=null){await this.clearQueueForHistoryChange();let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw new BF({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} not found`});if(this.state.messages[t].role!==`user`)throw new BF({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} is not a user message`});this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{id:e.messageId,...n,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});this.isQueuePaused=!1,await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})}},this.regenerate=async({messageId:e,...t}={})=>{await this.clearQueueForHistoryChange();let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw new BF({parameter:`messageId`,value:e,message:`message ${e} not found`});this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this[`~resumeStreamIfDisconnected`]=async({shouldResume:e=()=>!0}={})=>{let t=this.activeResponse;this.resumableStreamState==null&&t!=null&&(await t.completionPromise,this.resumableStreamState!==t.state)||this.resumableStreamState!=null&&e()&&await this.resumeStream()},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.stopGeneration,a=this.state.messages,o=r=>nI(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{...r.approval,id:e,approved:t,reason:n}}:r,s=a.findIndex(t=>t.parts.some(t=>nI(t)&&t.state===`approval-requested`&&t.approval.id===e));if(s!==-1){let e=a[s];this.state.replaceMessage(s,{...e,parts:e.parts.map(o)}),this.pendingApprovalMessageId=e.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),s!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically(a[s].id);if(e){this.runAutomaticRequest(()=>{let e=s===-1?this.lastMessage?.id:a[s].id;return this.makeRequestForToolApproval({messageId:e,messageIndex:s,...r})},e);return}}this.settleQueue({stopGeneration:i})}),this.addToolOutput=async({state:e,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.stopGeneration,o=this.state.messages,s=i=>{if(!nI(i)||i.toolCallId!==t)return i;let{approval:a,...o}=i,s=a?.approved===!0?{approval:{...a,approved:a.approved}}:{};return e===`output-error`?{...o,...s,state:e,input:i.input,output:void 0,errorText:r}:{...o,...s,state:`output-available`,input:i.input,output:n,errorText:void 0}},c=o.findIndex(e=>e.parts.some(e=>nI(e)&&e.toolCallId===t));if(c!==-1){let e=o[c];this.state.replaceMessage(c,{...e,parts:e.parts.map(s)})}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),c!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically(o[c].id);if(e){this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:o[c].id,...i}),e);return}}this.settleQueue({stopGeneration:a})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.activeStopCount++,this.stopGeneration++,this.deferredApprovalSend=void 0;try{let e=this.activeResumeRequest,t=this.activeResponse;for(let e of this.pendingMessagePreparations)e.abort();e?.abortController.abort(),t?.abortController.abort(),await Promise.all([e?.completionPromise,t?.completionPromise]),await this.jobExecutor.waitForIdle(),this.isQueuePaused=!0}finally{this.activeStopCount--}},this.dispose=async()=>{await this.stop(),this.transport.close?.()},this._id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u,this.queueEnabled=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status===e?this.error!==t&&(this.state.error=t):(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}get experimental_queuedMessages(){return this.state.experimental_queuedMessages??this.queuedMessagesFallback}setQueuedMessages(e){`experimental_queuedMessages`in this.state?this.state.experimental_queuedMessages=e:this.queuedMessagesFallback=e}async resumeQueue({skipWaitForUser:e,options:t}){if(this.isQueuePaused=!1,this.hasUnsentApprovalResponse()){if(!this.isRequestInProgress()){await this.sendMessage(void 0,t);return}this.deferredApprovalSend={options:t}}await this.settleQueue({skipWaitForUser:e})}async clearQueueForHistoryChange(){this.queueEnabled&&(this.queuedMessageOptions.clear(),this.setQueuedMessages([]),this.deferredApprovalSend=void 0,this.isRequestInProgress()&&await this.stop())}isRequestInProgress(){return this.pendingAutomaticDecisions.includes(this.stopGeneration)||this.activeResponse!=null||this.status===`submitted`||this.status===`streaming`}isWaitingForUser(){let e=this.lastMessage;return e?.role===`assistant`&&e.parts.some(e=>nI(e)&&(e.state===`approval-requested`||e.state===`approval-responded`||!e.providerExecuted&&(e.state===`input-streaming`||e.state===`input-available`)))}hasUnsentApprovalResponse(){let e=this.lastMessage;return e?.role===`assistant`&&e.parts.some(e=>nI(e)&&e.state===`approval-responded`)&&!e.parts.some(e=>nI(e)&&(e.state===`approval-requested`||!e.providerExecuted&&(e.state===`input-streaming`||e.state===`input-available`)))}async settleQueue({stopGeneration:e=this.stopGeneration,skipWaitForUser:t=!1}={}){if(this.isQueuePaused||this.isRequestInProgress()||this.activeStopCount>0||e!==this.stopGeneration)return;let n=this.deferredApprovalSend;if(this.deferredApprovalSend=void 0,n!=null&&this.hasUnsentApprovalResponse()){await this.sendMessage(void 0,n.options);return}let[r,...i]=this.experimental_queuedMessages;if(r==null||!t&&this.isWaitingForUser())return;let a=this.queuedMessageOptions.get(r.id);this.queuedMessageOptions.delete(r.id),this.setQueuedMessages(i),this.state.pushMessage(r),await this.makeRequest({trigger:`submit-message`,...a})}set messages(e){this.state.messages=e}async shouldSendAutomatically(e=this.lastMessage?.id){let t=e=>e!=null&&this.interruptedMessageIds.has(e);if(!this.sendAutomaticallyWhen||t(e)||t(this.lastMessage?.id))return!1;let n=this.stopGeneration;this.pendingAutomaticDecisions.push(n);let r;try{r=await this.sendAutomaticallyWhen({messages:this.state.messages})}finally{this.pendingAutomaticDecisions.splice(this.pendingAutomaticDecisions.indexOf(n),1)}return r&&!t(e)&&!t(this.lastMessage?.id)}async runAutomaticRequest(e,t){let n=this.stopGeneration,r=this.activeStopCount>0;return!(t??await this.shouldSendAutomatically())||r||n!==this.stopGeneration||this.activeStopCount>0?!1:(await e(),!0)}async makeRequestForToolApproval({messageId:e,messageIndex:t,...n}){this.deferredApprovalSend=void 0;let r=e!=null&&e===this.pendingApprovalMessageId;r&&(this.pendingApprovalMessageId=void 0),await this.makeRequest({trigger:`submit-message`,messageId:e,...n}),r&&this.status===`error`&&this.pendingApprovalMessageId==null&&(this.pendingApprovalMessageId=this.state.messages[t]?.id??e)}async makeRequest(e){let t=cI();try{await this.makeRequestImpl({...e,completionPromise:t.promise})}finally{t.resolve()}}async makeRequestImpl({trigger:e,metadata:t,headers:n,body:r,messageId:i,completionPromise:a}){e!==`resume-stream`&&(this.resumableStreamState=void 0);let o=new AbortController,s=e===`resume-stream`?{abortController:o,completionPromise:a}:void 0;s&&(this.activeResumeRequest?.abortController.abort(),this.activeResumeRequest=s);let c=()=>s==null||this.activeResumeRequest===s,l=()=>{this.activeResumeRequest===s&&(this.activeResumeRequest=void 0)},u;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,abortSignal:o.signal,metadata:t,headers:n,body:r});if(o.signal.aborted||!c()){await e?.cancel().catch(()=>{}),c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(e==null){this.setStatus({status:`ready`}),this.resumableStreamState=void 0,l();return}u=e}catch(e){if(o.signal.aborted||e.name===`AbortError`){c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(!c())return;this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e}),l();return}this.setStatus({status:`submitted`,error:void 0});let d=this.lastMessage,f=e===`submit-message`&&i!=null?this.state.messages.findIndex(e=>e.id===i):this.state.messages.length-1,p=f===-1?d:this.state.messages[f],m=p?.id,h=e===`resume-stream`&&p?.role===`assistant`&&p.parts.some(e=>nI(e)&&(e.state===`input-streaming`||e.state===`input-available`&&e.providerExecuted||e.state===`approval-responded`))?this.state.snapshot(p):void 0,g=f!==-1&&f<this.state.messages.length-1&&p?.role===`assistant`,_=!1,v=!1,y=!1,b;try{let s={state:e===`resume-stream`&&this.resumableStreamState!=null?this.resumableStreamState:aI({lastMessage:e===`resume-stream`?h:e===`regenerate-message`?void 0:this.state.snapshot(p),messageId:this.generateId()}),abortController:o,completionPromise:a};b=s,s.abortController.signal.addEventListener(`abort`,()=>{_=!0}),this.activeResponse=s;let l;if(l=e===`resume-stream`?u:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:s.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await sI({stream:oI({stream:l,resetStateOnMessageIdChange:e===`resume-stream`,resetStateOnFirstMessageStart:e===`resume-stream`&&this.transport.resumeStreamIsReplay,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>s.abortController.signal.aborted?Promise.resolve():e({state:s.state,write:({updateStatus:e=!0}={})=>{if(s.abortController.signal.aborted)return;e&&this.setStatus({status:`streaming`});let t=this.state.messages.findLastIndex(e=>e.id===s.state.message.id);if(t!==-1)this.state.replaceMessage(t,s.state.message);else if(g){let e=this.state.messages.findLastIndex(e=>e.id===m);e===-1?this.state.pushMessage(s.state.message):this.state.replaceMessage(e,s.state.message)}else this.state.pushMessage(s.state.message)}})),onError:e=>{throw e}}),abortSignal:s.abortController.signal,onError:e=>{throw e}}),_)return c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0)),null;c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0))}catch(e){if(_||e.name===`AbortError`)return _=!0,c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0)),null;if(!c())return null;if(y=!0,e instanceof TypeError){let t=e.message.toLowerCase();v=t.includes(`fetch`)||t.includes(`network`)||t===`load failed`}v?this.resumableStreamState=b?.state:this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{if(b){let{message:e,finishReason:t}=b.state;t===`interrupted`?this.interruptedMessageIds.add(e.id):!_&&!y&&this.interruptedMessageIds.delete(e.id),this.onFinish?.({message:b.state.message,messages:this.state.messages,isAbort:_,isDisconnect:v,isError:y,finishReason:b.state.finishReason})}}finally{(_||y||b?.state.finishReason===`interrupted`)&&(this.isQueuePaused=!0),this.activeResponse===b&&(this.activeResponse=void 0),l()}}if(!_&&!y&&b?.state.finishReason!==`interrupted`){let e=this.stopGeneration;await this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r}))||await this.settleQueue({stopGeneration:e})}}},RI=S(T(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}))(),1);function zI(e,t){return t==null?e:(0,RI.default)(e,t)}function BI(e){return Array.isArray(e)?[...e]:typeof e==`object`&&e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var VI=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e=[]){this.#t=`ready`,this.#n=void 0,this.#r=[],this.#i=new Set,this.#a=new Set,this.#o=new Set,this.#s=new Set,this.pushMessage=e=>{this.#e=this.#e.concat(e),this.#c()},this.popMessage=()=>{this.#e=this.#e.slice(0,-1),this.#c()},this.replaceMessage=(e,t)=>{this.#e=[...this.#e.slice(0,e),this.snapshot(t),...this.#e.slice(e+1)],this.#c()},this.snapshot=e=>{if(typeof e!=`object`||!e||!(`parts`in e)||!Array.isArray(e.parts))return e;let t=e,n={...t,parts:t.parts.map(e=>({...e}))};return`metadata`in t&&(n.metadata=BI(t.metadata)),n},this[`~registerMessagesCallback`]=(e,t)=>{let n=t?zI(e,t):e;return this.#i.add(n),()=>{this.#i.delete(n)}},this[`~registerStatusCallback`]=e=>(this.#o.add(e),()=>{this.#o.delete(e)}),this[`~registerErrorCallback`]=e=>(this.#s.add(e),()=>{this.#s.delete(e)}),this[`~registerQueuedMessagesCallback`]=e=>(this.#a.add(e),()=>{this.#a.delete(e)}),this.#c=()=>{this.#i.forEach(e=>e())},this.#l=()=>{this.#o.forEach(e=>e())},this.#u=()=>{this.#s.forEach(e=>e())},this.#e=e}get status(){return this.#t}set status(e){this.#t=e,this.#l()}get error(){return this.#n}set error(e){this.#n=e,this.#u()}get experimental_queuedMessages(){return this.#r}set experimental_queuedMessages(e){this.#r=e,this.#a.forEach(e=>e())}get messages(){return this.#e}set messages(e){this.#e=[...e],this.#c()}#c;#l;#u},HI=class extends LI{#e;constructor({messages:e,...t}){let n=new VI(e);super({...t,state:n}),this[`~registerMessagesCallback`]=(e,t)=>this.#e[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>this.#e[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>this.#e[`~registerErrorCallback`](e),this[`~registerQueuedMessagesCallback`]=e=>this.#e[`~registerQueuedMessagesCallback`](e),this.#e=n}},UI=new WeakMap;function WI({chat:e,state:t}){if(document.visibilityState!==`visible`||t.pendingVisibilityResume!=null)return;let n=()=>UI.get(e)===t&&t.registrations.size>0,r=()=>{t.pendingVisibilityResume=void 0};t.pendingVisibilityResume=e[`~resumeStreamIfDisconnected`]({shouldResume:()=>n()&&document.visibilityState===`visible`}).then(r,r)}function GI({chat:e,registration:t}){let n=UI.get(e);if(n==null){let t={registrations:new Set};if(UI.set(e,t),n=t,typeof document<`u`){let n=()=>WI({chat:e,state:t});document.addEventListener(`visibilitychange`,n),t.cleanupVisibilityListener=()=>{document.removeEventListener(`visibilitychange`,n)}}}let{registrations:r}=n,i=r.size===0;return r.add(t),i&&e.status!==`submitted`&&e.status!==`streaming`&&e.resumeStream(),()=>{r.delete(t),r.size===0&&(n.cleanupVisibilityListener?.(),UI.delete(e))}}function KI(e){return{chat:e,messages:e.messages,status:e.status,error:e.error,experimental_queuedMessages:e.experimental_queuedMessages}}function qI(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error&&e.experimental_queuedMessages===t.experimental_queuedMessages}function JI({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){let i=e??t,a=(0,A.useRef)({}),o=(0,A.useRef)({});`chat`in r||(o.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen,transport:r.transport});let s,c=()=>o.current.transport??(s??=new II),l={...r,transport:{get resumeStreamIsReplay(){return c().resumeStreamIsReplay},sendMessages:e=>c().sendMessages(e),reconnectToStream:e=>c().reconnectToStream(e)},onToolCall:e=>o.current.onToolCall?.(e),onData:e=>o.current.onData?.(e),onFinish:e=>o.current.onFinish?.(e),onError:e=>o.current.onError?.(e),sendAutomaticallyWhen:e=>o.current.sendAutomaticallyWhen?.(e)??!1},u=`chat`in r?r.chat:r.id,{chat:d,isExternallyManaged:f}=(0,A.useMemo)(()=>({chat:`chat`in r?r.chat:new HI(l),isExternallyManaged:`chat`in r}),[u]);(0,A.useEffect)(()=>{if(!f)return()=>{d.stop()}},[d,f]);let[p,m]=(0,A.useState)(()=>KI(d));p.chat!==d&&m(KI(d)),(0,A.useEffect)(()=>{let e=!0,t=()=>{if(!e)return;let t=KI(d);m(e=>e.chat!==d||qI(e,t)?e:t)},n=[d[`~registerMessagesCallback`](t,i),d[`~registerStatusCallback`](t),d[`~registerErrorCallback`](t),d[`~registerQueuedMessagesCallback`](t)],r=KI(d);return m(e=>qI(e,r)?e:r),()=>{e=!1,n.forEach(e=>e())}},[d,i]);let{messages:h,status:g,error:_,experimental_queuedMessages:v}=p,y=(0,A.useCallback)(e=>{typeof e==`function`&&(e=e(d.messages)),d.messages=e},[d]);return(0,A.useEffect)(()=>{if(n)return GI({chat:d,registration:a.current})},[n,d]),{get id(){return d.id},messages:h,setMessages:y,sendMessage:d.sendMessage,regenerate:d.regenerate,clearError:d.clearError,stop:d.stop,error:_,resumeStream:d.resumeStream,status:g,addToolResult:d.addToolOutput,addToolOutput:d.addToolOutput,addToolApprovalResponse:d.addToolApprovalResponse,experimental_queuedMessages:v,experimental_removeQueuedMessage:d.experimental_removeQueuedMessage,experimental_sendQueuedMessageNow:d.experimental_sendQueuedMessageNow}}var YI={damping:.7,stiffness:.05,mass:1.25},XI=70,ZI=1e3/60,QI=350,$I=!1;globalThis.document?.addEventListener(`mousedown`,()=>{$I=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{$I=!1}),globalThis.document?.addEventListener(`click`,()=>{$I=!1});var eL=(e={})=>{let[t,n]=(0,A.useState)(!1),[r,i]=(0,A.useState)(e.initial!==!1),[a,o]=(0,A.useState)(!1),s=(0,A.useRef)(null);s.current=e;let c=(0,A.useCallback)(()=>{if(!$I)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,A.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,A.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,A.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=XI}}},[]),f=(0,A.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=rL(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/ZI;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:rL(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,A.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,A.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;d.animation?.ignoreEscapes?d.scrollTop=r:(i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0))},1)},[u,l,c,d]),h=(0,A.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=tL(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=tL(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=rL(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:QI})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function tL(e,t){let n=(0,A.useCallback)(t=>(n.current=t,e(t)),t);return n}var nL=new Map;function rL(...e){let t={...YI},n=!1;for(let r of e)r===`instant`?n=!0:typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass);let r=JSON.stringify(t);return nL.has(r)||nL.set(r,Object.freeze(t)),n?`instant`:nL.get(r)}var iL=(0,A.createContext)(null),aL=typeof window<`u`?A.useLayoutEffect:A.useEffect;function oL({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,A.useRef)(null),d=eL({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:A.useCallback((e,t)=>(y?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:v}=e??d,y=(0,A.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:v,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,v]);return(0,A.useImperativeHandle)(c,()=>y,[y]),aL(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),A.createElement(iL.Provider,{value:y},A.createElement(`div`,{...l},typeof t==`function`?t(y):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=sL();return A.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},A.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(oL||={});function sL(){let e=(0,A.useContext)(iL);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}function cL({onRestore:e,disabled:t}){return(0,j.jsx)(l,{label:`Edit this question and ask again from here`,side:`bottom`,children:(0,j.jsx)(Se,{"aria-label":`Edit and ask again from here`,className:`mt-1.5 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,"data-chat-checkpoint":!0,disabled:t,onClick:e,size:`icon-sm`,variant:`ghost`,children:(0,j.jsx)(O,{name:`undo`,className:`size-3.5`})})})}var lL=new Intl.NumberFormat(`en`);function uL({used:e,budget:t,className:n}){if(e===0)return null;let r=Math.min(1,e/t),i=Math.round(r*100),a=e>=t;return(0,j.jsx)(l,{label:(0,j.jsxs)(`span`,{className:`block max-w-64`,children:[`The next question replays `,lL.format(e),` of `,lL.format(t),` characters of this conversation.`,a?` Older turns are cut to fit.`:``]}),side:`top`,children:(0,j.jsxs)(`span`,{"aria-label":`History: ${i}% of what a question replays`,className:k(`inline-flex items-center gap-1.5 text-2xs text-muted`,n),"data-chat-context":!0,role:`img`,tabIndex:0,children:[(0,j.jsx)(`span`,{className:`h-1 w-10 overflow-hidden rounded-full bg-rule`,children:(0,j.jsx)(`span`,{className:k(`block h-full rounded-full`,a?`bg-warn`:`bg-accent`),style:{width:`${Math.max(4,i)}%`}})}),(0,j.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[i,`%`]})]})})}function dL({className:e,...t}){return(0,j.jsx)(oL,{className:k(`relative min-h-0 flex-1 overflow-y-hidden`,e),role:`log`,...t})}function fL({className:e,...t}){return(0,j.jsx)(oL.Content,{className:k(`mx-auto flex w-full max-w-[72ch] flex-col gap-6 px-1 py-4`,e),...t})}function pL({className:e,description:t,children:n,...r}){return(0,j.jsxs)(`div`,{className:k(`flex flex-col gap-4 pt-[12vh]`,e),...r,children:[(0,j.jsx)(`p`,{className:`m-0 max-w-[60ch] text-md text-muted`,children:t}),n]})}function mL({className:e,...t}){let{isAtBottom:n,scrollToBottom:r}=sL();return n?null:(0,j.jsx)(Se,{"aria-label":`Scroll to the newest message`,className:k(`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full shadow-float`,e),onClick:()=>void r(),size:`icon`,...t,children:(0,j.jsx)(O,{name:`down`})})}function hL(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=Ee({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Te(a,!0,!0),u=ce(),[d,f]=A.useState(),p=d===null?void 0:d??u,m=ve(e=>{let t=!a,n=ye(ge,e.nativeEvent);r(t,n),n.isCanceled||o(t)});return A.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var gL=A.createContext(void 0);function _L(){let e=A.useContext(gL);if(e===void 0)throw Error(xe(15));return e}var vL=`data-open`,yL=`data-closed`,bL=me,xL=`data-panel-open`,SL={[vL]:``},CL={[yL]:``},wL={open(e){return e?{[xL]:``}:null}},TL={open(e){return e?SL:CL},...Ce},EL=A.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=ve(o),d=hL({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=A.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=A.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=le(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:TL});return(0,j.jsx)(gL.Provider,{value:p,children:m})}),DL={...wL,...Ce},OL=A.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=_L(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=pe({disabled:c,native:u});return le(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:DL})}),kL={height:void 0,width:void 0};function AL(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=A.useRef(null),f=A.useRef(null),[p,m]=A.useState(kL),h=A.useRef(kL),g=A.useRef(!1),_=A.useRef(s),v=A.useRef(!1),[y,b]=A.useState(!1),x=A.useRef(null),ee=ae(t,d),S=oe(s),C=ie(d),w=!s&&!a,T=y?`idle`:u,te=s&&(_.current||v.current),E=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,D=n&&w&&f.current!==`css-animation`,ne=ve((e,t=!0)=>{t&&(h.current=e),m(e)}),re=ve(()=>{x.current?.(),x.current=null}),ce=ve(e=>{re(),x.current=()=>{x.current=null,e()}}),le=ve(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});he(()=>{y&&u!==`starting`&&b(!1)},[y,u]),A.useEffect(()=>()=>{le(),re()},[le,re]),he(()=>{s||(_.current=!1,v.current=!1);let e=d.current;if(!e)return;!s&&x.current&&re();let t=ML(e,te);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=jL(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){ne(jL(e)),b(!0);return}if(t===`css-transition`){let t=FL(e);if(ne(jL(e)),!n)return t;let r=PL(e,`transition-duration`,`0s`);return ce(r),b(!0),t}ne(jL(e));let r=PL(e,`animation-name`,`none`);if(!n){r();return}let i=PL(e,`animation-duration`,`0s`);r(),ce(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){ne(kL,!1),c(!1);return}ne(jL(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=jL(e);n.height>0||n.width>0?(ne(n),t===`css-animation`&&PL(e,`animation-name`,`none`)()):c(!1)},[a,s,re,ne,c,ce,te,u]),ue({enabled:s&&a&&T===`idle`,open:!0,ref:d,onComplete(){s&&ne(kL,!1)}}),A.useEffect(()=>{if(s||!a||T!==`ending`)return;if(!d.current){c(!1),ne(kL,!1);return}let e=new AbortController,t=-1;function n(){S.current||(c(!1),ne(kL,!1))}return t=de.request(()=>{C(n,e.signal)}),()=>{de.cancel(t),e.abort()}},[S,a,s,T,C,ne,c]),he(()=>{let e=d.current;e&&n&&w&&e.setAttribute(`hidden`,`until-found`)},[w,n]),A.useEffect(function(){let e=d.current;if(!e)return;let t=se.create(),n=-1,r=(r,i)=>{t.start(0,()=>{S.current||(n=de.request(()=>{S.current||(r&&(g.current=!1),i&&e.setAttribute(bL,``),e.setAttribute(`hidden`,`until-found`))}))})},i=be(e,`beforematch`,t=>{let n=ye(fe,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(bL);e.removeAttribute(bL),l(!0),r(!0,i)});return()=>{t.clear(),de.cancel(n),i()}},[S,o,l]);let pe=i||n||a||s;return{height:E.height,props:{...D?{[bL]:``}:void 0,hidden:w,id:r},ref:ee,shouldPreventOpenAnimation:te,shouldRender:pe,transitionStatus:T,width:E.width}}function jL(e){return{height:e.scrollHeight,width:e.scrollWidth}}function ML(e,t){let n=we(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&NL(n.animationDuration),i=NL(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function NL(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function PL(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function FL(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=de.request(n);return()=>{de.cancel(r),n()}}var IL=`--collapsible-panel-height`,LL=`--collapsible-panel-width`,RL=A.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=_L(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;he(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:ee,props:S,ref:C,shouldPreventOpenAnimation:w,shouldRender:T,transitionStatus:te,width:E}=AL({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),D={...g,transitionStatus:te},re=ne(s,D),ie=le(`div`,{...e,style:void 0},{state:D,ref:C,props:[S,{style:{[IL]:ee===void 0?`auto`:`${ee}px`,[LL]:E===void 0?`auto`:`${E}px`}},c,re?{style:re}:void 0,w?{style:{animationName:`none`}}:void 0],stateAttributesMapping:TL});return T?ie:null});function zL({count:e,className:t,children:n}){return(0,j.jsxs)(EL,{className:k(`min-w-0`,t),"data-chat-sources":!0,children:[(0,j.jsxs)(OL,{className:`group/sources inline-flex items-center gap-1.5 rounded-control px-1.5 py-1 text-xs text-muted transition-colors hover:bg-surface hover:text-text`,children:[(0,j.jsx)(O,{name:`doc`,className:`size-3.5`}),`Read `,e,` `,e===1?`file`:`files`,(0,j.jsx)(O,{name:`chevron`,className:`size-3.5 transition-transform group-data-[panel-open]/sources:rotate-180`})]}),(0,j.jsx)(RL,{children:(0,j.jsx)(`ul`,{className:`m-0 mt-1 grid list-none gap-0.5 p-0 pl-1.5`,children:n})})]})}function BL({children:e}){return(0,j.jsx)(`li`,{className:`min-w-0`,children:e})}var VL=`inline-flex max-w-full items-center gap-1.5 rounded-control px-1.5 py-0.5 font-mono text-2xs text-muted no-underline hover:bg-surface hover:text-accent`,HL=`inline-flex max-w-full items-baseline gap-1 rounded-[4px] border border-rule bg-surface px-1 font-mono text-[0.86em] text-text no-underline hover:border-accent hover:text-accent`,UL=(0,A.createContext)(null);function WL({cite:e,children:t}){return(0,j.jsx)(UL,{value:e,children:t})}function GL({children:e}){let t=(0,A.useContext)(UL);return(t&&typeof e==`string`?t(e):null)??(0,j.jsx)(`code`,{children:e})}function KL({className:e,from:t,...n}){return(0,j.jsx)(`div`,{"data-from":t,className:k(`group flex w-full flex-col gap-2`,t===`user`?`items-end`:`items-start`,e),...n})}function qL({className:e,...t}){return(0,j.jsx)(`div`,{className:k(`flex min-w-0 max-w-full flex-col gap-2 text-base text-text`,`group-data-[from=user]:max-w-[85%] group-data-[from=user]:rounded-card group-data-[from=user]:border group-data-[from=user]:border-rule group-data-[from=user]:bg-surface group-data-[from=user]:px-3.5 group-data-[from=user]:py-2.5`,`group-data-[from=assistant]:w-full`,e),...t})}var JL={img:({alt:e})=>e?(0,j.jsxs)(`span`,{className:`text-muted`,children:[`[`,e,`]`]}):null,strong:({children:e})=>(0,j.jsx)(`strong`,{children:e}),em:({children:e})=>(0,j.jsx)(`em`,{children:e}),h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,p:`p`,ul:`ul`,ol:`ol`,li:`li`,blockquote:`blockquote`,hr:`hr`,inlineCode:({children:e})=>(0,j.jsx)(GL,{children:e}),code:({children:e,className:t})=>(0,j.jsx)(`code`,{className:t,children:e}),pre:({children:e})=>(0,j.jsx)(`pre`,{children:e}),table:({children:e})=>(0,j.jsx)(`div`,{className:`md-table`,children:(0,j.jsx)(`table`,{children:e})}),thead:`thead`,tbody:`tbody`,tr:`tr`,th:`th`,td:`td`,a:({href:e,children:t})=>(0,j.jsxs)(`span`,{"data-chat-link":!0,children:[t,e&&e!==String(t)?(0,j.jsxs)(`span`,{className:`text-muted`,children:[` (`,(0,j.jsx)(`code`,{children:e}),`)`]}):null]})},YL=(0,A.memo)(({className:e,...t})=>(0,j.jsx)(XS,{className:k(`markdown-body chat-answer`,e),components:JL,controls:!1,linkSafety:{enabled:!1},skipHtml:!0,...t}),(e,t)=>e.children===t.children&&e.isAnimating===t.isAnimating);YL.displayName=`MessageResponse`;var XL=A.createContext(void 0);function ZL(){let e=A.useContext(XL);if(e===void 0)throw Error(xe(56));return e}var QL=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=A.useState(),c=A.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=le(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,j.jsx)(XL.Provider,{value:c,children:l})}),$L=A.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=ZL(),c=ce(a);return he(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),le(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),eR=`inline-flex h-7 min-w-0 items-center gap-1 rounded-control border border-transparent px-2 text-xs text-muted outline-none transition-colors hover:border-rule hover:bg-page hover:text-text focus-visible:border-accent data-popup-open:border-rule data-popup-open:bg-page data-popup-open:text-text disabled:pointer-events-none disabled:opacity-50`;function tR({label:e,group:t,options:n,value:r,onChange:i,disabled:a=!1,prefix:o,className:s}){let c=n.find(e=>e.value===r);return(0,j.jsxs)(Ne,{disabled:a,onValueChange:e=>{e!==null&&i(e)},value:r,children:[(0,j.jsxs)(Ue,{"aria-label":e,className:k(eR,s),children:[o?(0,j.jsx)(`span`,{children:o}):null,(0,j.jsx)(`span`,{className:`truncate font-medium text-text`,children:c?.name??r}),(0,j.jsx)(He,{className:`flex`,children:(0,j.jsx)(O,{name:`chevron`,className:`size-3.5`})})]}),(0,j.jsx)(Me,{children:(0,j.jsx)(Ie,{align:`start`,alignItemWithTrigger:!1,className:`z-40`,side:`top`,sideOffset:6,children:(0,j.jsx)(Le,{className:k(Re,`w-64`),children:(0,j.jsxs)(QL,{children:[(0,j.jsx)($L,{className:`px-2.5 pt-1 pb-1.5 text-2xs font-semibold text-muted`,children:t??e}),n.map(e=>(0,j.jsxs)(ze,{className:k(Be,`items-start`),value:e.value,children:[(0,j.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,j.jsx)(Pe,{className:`truncate font-medium`,children:e.name}),e.description?(0,j.jsx)(`span`,{className:`text-2xs text-muted`,children:e.description}):null]}),(0,j.jsx)(Fe,{className:k(Ve,`top-2`),children:(0,j.jsx)(O,{name:`check`,className:`size-4`})})]},e.value))]})})})})]})}function nR({className:e,onSubmit:t,...n}){return(0,j.jsx)(`form`,{className:k(`flex w-full flex-col gap-1 rounded-card border border-rule bg-surface p-2 transition-colors focus-within:border-accent`,e),onSubmit:e=>{e.preventDefault();let n=e.currentTarget.elements.namedItem(`message`);if(!(n instanceof HTMLTextAreaElement))return;let r=n.value.trim();r&&(t(r),n.value=``)},...n})}function rR({className:e,onKeyDown:t,...n}){return(0,j.jsx)(We,{name:`message`,rows:1,className:k(`field-sizing-content max-h-48 min-h-10 w-full resize-none border-0 bg-transparent px-1.5 py-1.5 text-md`,e),onKeyDown:e=>{t?.(e),e.defaultPrevented||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e.currentTarget.form?.requestSubmit())},...n})}function iR({className:e,...t}){return(0,j.jsx)(`div`,{className:k(`flex items-center justify-between gap-2`,e),...t})}function aR({className:e,...t}){return(0,j.jsx)(`div`,{className:k(`flex min-w-0 items-center gap-0.5`,e),...t})}function oR({className:e,...t}){return(0,j.jsxs)(`p`,{className:k(`m-0 flex items-center gap-1 text-2xs text-muted`,e),...t,children:[(0,j.jsx)(Ge,{children:`Enter`}),` to send · `,(0,j.jsx)(Ge,{children:`Shift`}),(0,j.jsx)(Ge,{children:`Enter`}),` for a new line`]})}function sR({status:e,onStop:t,className:n,...r}){return e===`submitted`||e===`streaming`?(0,j.jsx)(Se,{"aria-label":`Stop the answer`,className:n,onClick:t,size:`icon`,type:`button`,...r,children:(0,j.jsx)(O,{name:`stop`})}):(0,j.jsx)(Se,{"aria-label":`Send`,className:n,size:`icon`,type:`submit`,variant:`primary`,...r,children:(0,j.jsx)(O,{name:`send`})})}function cR({items:e,onRemove:t,note:n,className:r}){return e.length===0?null:(0,j.jsxs)(`section`,{"aria-label":`Queued questions`,className:k(`rounded-card border border-rule bg-page px-2 py-1.5`,r),"data-chat-queue":!0,children:[(0,j.jsxs)(`p`,{className:`m-0 flex items-center gap-1.5 px-1 pb-1 text-2xs font-semibold text-muted`,children:[(0,j.jsx)(O,{name:`queue`,className:`size-3.5`}),`Queued `,(0,j.jsx)(`span`,{className:`font-mono tabular-nums`,children:e.length}),n?(0,j.jsxs)(`span`,{className:`font-normal text-warn`,children:[`· `,n]}):null]}),(0,j.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,j.jsxs)(`li`,{className:`group/queued flex min-w-0 items-center gap-2 rounded-control px-1 py-0.5 hover:bg-surface`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-text`,children:e.text}),(0,j.jsx)(Se,{"aria-label":`Remove “${e.text}” from the queue`,className:`opacity-0 group-hover/queued:opacity-100 focus-visible:opacity-100`,onClick:()=>t(e.id),size:`icon-sm`,variant:`ghost`,children:(0,j.jsx)(O,{name:`close`,className:`size-3.5`})})]},e.id))})]})}function lR({text:e,streaming:t,className:n}){let[r,i]=(0,A.useState)(null);return(0,j.jsxs)(EL,{className:k(`w-full`,n),"data-chat-reasoning":!0,onOpenChange:i,open:r??t,children:[(0,j.jsxs)(OL,{className:`group/reasoning inline-flex items-center gap-1.5 rounded-control py-0.5 text-xs text-muted transition-colors hover:text-text`,children:[t?(0,j.jsx)(re,{"aria-hidden":`true`,role:void 0,className:`size-3.5 text-accent`}):(0,j.jsx)(O,{name:`spark`,className:`size-3.5`}),t?`Thinking…`:`Reasoning`,(0,j.jsx)(O,{name:`chevron`,className:`size-3.5 transition-transform group-data-[panel-open]/reasoning:rotate-180`})]}),(0,j.jsx)(RL,{className:`mt-1.5 max-h-72 overflow-y-auto border-l border-rule pl-3 text-sm leading-relaxed whitespace-pre-wrap text-muted`,children:e})]})}function uR({className:e,...t}){return(0,j.jsx)(`ul`,{className:k(`m-0 flex list-none flex-col items-start gap-1.5 p-0`,e),...t})}function dR({suggestion:e,onAsk:t,className:n}){return(0,j.jsx)(`li`,{className:`max-w-full`,children:(0,j.jsxs)(Se,{className:k(`group/suggestion h-auto max-w-full justify-start gap-2 py-2 text-left text-sm font-normal whitespace-normal`,n),onClick:()=>t(e),children:[e,(0,j.jsx)(O,{name:`right`,className:`size-3.5 text-muted transition-transform group-hover/suggestion:translate-x-0.5 group-hover/suggestion:text-accent`})]})})}function fR(e){return e===`output-error`||e===`output-denied`}function pR(e){return e===`input-streaming`||e===`input-available`}var mR=`w-full overflow-hidden rounded-control border border-rule-soft bg-page`,hR=`flex w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left text-xs text-muted hover:bg-surface hover:text-text`;function gR({failed:e}){return(0,j.jsx)(O,{name:e?`close`:`check`,className:k(`size-3.5`,e?`text-bad`:`text-done`)})}function _R({className:e,children:t,summary:n,failed:r=!1}){return n?(0,j.jsxs)(EL,{className:k(mR,e),"data-chat-steps":!0,children:[(0,j.jsxs)(OL,{className:k(hR,`group/steps`),children:[(0,j.jsx)(gR,{failed:r}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,j.jsx)(O,{name:`chevron`,className:`size-3.5 transition-transform group-data-[panel-open]/steps:rotate-180`})]}),(0,j.jsx)(RL,{className:`divide-y divide-rule-soft border-t border-rule-soft`,children:t})]}):(0,j.jsx)(`div`,{className:k(mR,`divide-y divide-rule-soft`,e),children:t})}function vR({name:e,label:t,targets:n,running:r,failed:i,children:a}){return(0,j.jsxs)(EL,{className:`w-full`,"data-chat-batch":e,children:[(0,j.jsxs)(OL,{className:k(hR,`group/batch`),children:[r?(0,j.jsx)(re,{"aria-hidden":`true`,role:void 0,className:`size-3.5 text-accent`}):(0,j.jsx)(gR,{failed:i>0}),(0,j.jsx)(`span`,{className:`font-semibold text-text`,children:t}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:n.join(`, `)}),i>0?(0,j.jsxs)(`span`,{className:`text-bad`,children:[i,` failed`]}):null,(0,j.jsx)(O,{name:`chevron`,className:`size-3.5 transition-transform group-data-[panel-open]/batch:rotate-180`})]}),(0,j.jsx)(RL,{className:`divide-y divide-rule-soft border-t border-rule-soft pl-4`,children:a})]})}function yR({className:e,...t}){return(0,j.jsx)(EL,{className:k(`w-full`,e),...t})}var bR={"input-streaming":`starting`,"input-available":`running`,"approval-requested":`waiting`,"approval-responded":`answered`,"output-available":`done`,"output-error":`failed`,"output-denied":`denied`};function xR({name:e,target:t,state:n,stopped:r=!1,className:i}){let a=fR(n),o=pR(n),s=(0,j.jsx)(gR,{failed:a});return o&&(s=r?(0,j.jsx)(O,{name:`close`,className:`size-3.5 text-muted`}):(0,j.jsx)(re,{"aria-hidden":`true`,role:void 0,className:`size-3.5 text-accent`})),(0,j.jsxs)(OL,{className:k(hR,`group/tool`,i),children:[s,(0,j.jsx)(`span`,{className:`font-semibold text-text`,children:e}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t}),(0,j.jsx)(`span`,{className:k(n===`output-available`?`sr-only`:a&&`text-bad`),children:o&&r?`stopped`:bR[n]}),(0,j.jsx)(O,{name:`chevron`,className:`size-3.5 transition-transform group-data-[panel-open]/tool:rotate-180`})]})}function SR({className:e,...t}){return(0,j.jsx)(RL,{className:k(`grid gap-2 border-t border-rule-soft bg-surface px-2.5 py-2`,e),...t})}var CR=4e3;function wR(e){let t=typeof e==`string`?e:JSON.stringify(e,null,2)??``;return t.length>CR?`${t.slice(0,CR)}\n…`:t}function TR({input:e,className:t,...n}){return(0,j.jsxs)(`div`,{className:k(`grid gap-1`,t),...n,children:[(0,j.jsx)(`span`,{className:`text-2xs font-semibold tracking-wider text-muted uppercase`,children:`Input`}),(0,j.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded-control bg-page p-2 font-mono text-2xs text-text`,children:wR(e)})]})}function ER({output:e,errorText:t,className:n,...r}){return e===void 0&&!t?null:(0,j.jsxs)(`div`,{className:k(`grid gap-1`,n),...r,children:[(0,j.jsx)(`span`,{className:`text-2xs font-semibold tracking-wider text-muted uppercase`,children:t?`Error`:`Result`}),(0,j.jsx)(`pre`,{className:k(`max-h-56 overflow-auto rounded-control p-2 font-mono text-2xs`,t?`bg-bad-soft text-bad`:`bg-page text-text`),children:t??wR(e)})]})}var DR=[`Which capabilities does this companion describe?`,`What changed in the last archived changes?`,`Which changes are still open, and what do they plan?`],OR=80,kR=e=>`chat-question-${e}`;function AR(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function jR(e){return typeof e!=`object`||!e?``:AR(Object.values(e).find(e=>typeof e==`string`)??``,OR)}function MR(e,t){let n=[];for(let r of e){let e=n.at(-1);e&&t(e[0])===t(r)?e.push(r):n.push([r])}return n}function NR(e,t){return e===`read`?`Read ${t} files`:e===`grep`?`Searched ${t} patterns`:e===`glob`?`Listed ${t} file patterns`:`${e} ×${t}`}function PR(e){let t=new Map;for(let{name:n}of e)t.set(n,(t.get(n)??0)+1);let n=[...t].map(([e,t])=>`${e} ${t}`).join(`, `),r=e.filter(e=>e.failed).length;return[`${e.length} steps`,n,r?`${r} failed`:``].filter(Boolean).join(` · `)}var FR=40,IR=64e3;function LR(e){let t=[],n=0;for(let r of e.toReversed()){let e=r.parts.filter(e=>e.type===`text`);if(e.length!==0){if(n+=e.reduce((e,t)=>e+t.text.length,0),t.length>0&&(t.length>=FR||n>IR))break;t.push({...r,parts:e})}}return t.toReversed()}function RR(e,t){let n=e.trim().replace(/\\/g,`/`);if(n.startsWith(`/`)){let e=t.map(e=>e.replace(/\\/g,`/`).replace(/\/+$/,``)).find(e=>e&&n.startsWith(`${e}/`));if(!e)return null;n=n.slice(e.length+1)}return n=n.replace(/^(?:\.\/)+/,``),!n||n.split(`/`).some(e=>e===`..`||e===``)?null:n}function zR(e,t){let n=new Set;for(let r of e.parts){if(!nI(r)||iI(r).toLowerCase()!==`read`||r.state!==`output-available`)continue;let e=r.input,i=typeof e?.file_path==`string`?RR(e.file_path,t):null;i&&n.add(i)}return[...n]}function BR(e){try{let t=JSON.parse(e.message);if(typeof t.reason==`string`)return t.reason}catch{}return e.message||`the chat failed`}var VR=t=>e(`claude-code`,t)?.effortless===!0,HR=null;function UR(e,t){if(HR?.companion===e)return HR;g();let n=D(()=>({queued:[]})),r=new HI({transport:new II({api:b,credentials:`same-origin`,prepareSendMessagesRequest:({id:t,messages:n,trigger:r,messageId:i})=>{let a=m.getState();return{body:{companion:e,id:t,messages:LR(n),trigger:r,messageId:i,model:a.model,...VR(a.model)?{}:{effort:a.effort}}}},...t}),onFinish:({isError:e,isAbort:t,isDisconnect:i})=>{let[a,...o]=n.getState().queued;e||t||i||!a||(n.setState({queued:o}),r.sendMessage({text:a.text}))}});return HR={companion:e,chat:r,queue:n},d(e,()=>{r.stop(),HR=null}),HR}var WR=e=>y({queryKey:[e,`chat-session`],queryFn:()=>t(`GET`,`${v}?${new URLSearchParams({companion:e}).toString()}`),staleTime:1/0}),GR=90,KR=`rounded-card border border-rule bg-surface`;function qR({title:e,names:t}){return(0,j.jsxs)(`div`,{className:`grid gap-1.5 px-3 py-2.5`,"data-chat-session-group":e,children:[(0,j.jsx)(`h3`,{className:`m-0 text-2xs font-semibold tracking-wider text-muted uppercase`,children:e}),t.length===0?(0,j.jsx)(`p`,{className:`m-0 text-[0.82rem] text-muted`,children:`None loaded`}):(0,j.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:t.map(e=>(0,j.jsx)(`li`,{className:`rounded-full border border-rule bg-page px-2 py-0.5 font-mono text-2xs`,children:e},e))})]})}function JR(){let e=i(h());return(0,j.jsxs)(`section`,{"aria-labelledby":`chat-credential-title`,className:k(KR,`grid shrink-0 gap-1.5 px-3 py-2.5`),"data-chat-credential":!0,children:[(0,j.jsx)(`h3`,{className:`m-0 text-2xs font-semibold tracking-wider text-muted uppercase`,id:`chat-credential-title`,children:`Credential`}),(0,j.jsx)(`p`,{className:k(`m-0 text-[0.82rem]`,e.isError?`text-bad`:`text-muted`),"data-chat-credential-status":!0,role:e.isError?`alert`:void 0,children:e.isError?`The credential could not be read: ${e.error.message}`:c(e.data)})]})}function YR({companion:e}){let t=i(WR(e));return(0,j.jsx)(`section`,{"aria-label":`What the chat loads`,className:k(KR,`shrink-0 divide-y divide-rule-soft`),"data-chat-session":!0,children:t.data?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(qR,{title:`MCP servers`,names:t.data.mcpServers}),(0,j.jsx)(qR,{title:`Plugins`,names:t.data.plugins})]}):(0,j.jsx)(`p`,{className:k(`m-0 px-3 py-2.5 text-[0.82rem]`,t.isError?`text-bad`:`text-muted`),role:t.isError?`alert`:void 0,children:t.isError?`What the chat loads could not be read: ${t.error.message}`:`Reading what the chat loads…`})})}function XR({questions:e,busy:t,onRestore:n,scroll:r}){let{scrollRef:i,stopScroll:a}=r,o=(0,A.useRef)(null),[s,c]=(0,A.useState)(null),u=e.map(e=>e.id).join(` `),d=s??e.at(-1)?.id;if((0,A.useEffect)(()=>{let e=i.current;if(!e||!u)return;let t=u.split(` `),n=()=>{let n=e.getBoundingClientRect().top+e.clientHeight/3,r=t[0];for(let e of t){let t=document.getElementById(kR(e));if(!t||t.getBoundingClientRect().top>n)break;r=e}c(r)},r=0,a=()=>{r||=requestAnimationFrame(()=>{r=0,n()})};return n(),e.addEventListener(`scroll`,a,{passive:!0}),()=>{cancelAnimationFrame(r),e.removeEventListener(`scroll`,a)}},[i,u]),(0,A.useEffect)(()=>{let e=o.current,t=d?e?.querySelector(`[data-chat-question-row="${d}"]`):null;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.top<n.top?e.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(e.scrollTop+=r.bottom-n.bottom)},[d]),e.length===0)return null;let f=e=>{a(),document.getElementById(kR(e))?.scrollIntoView({behavior:`smooth`,block:`start`})},p=e.length-1;return(0,j.jsx)(`nav`,{"aria-label":`Jump to a question`,className:k(KR,`flex min-h-0 flex-col overflow-hidden`),"data-chat-questions":!0,children:(0,j.jsx)(`ol`,{ref:o,className:`m-0 min-h-0 list-none overflow-y-auto overscroll-contain p-1.5`,children:e.map((r,i)=>{let a=r.id===d,o=AR(r.text,GR);return(0,j.jsxs)(`li`,{"data-chat-question-row":r.id,className:`group/question relative flex items-center rounded-control pl-5 transition-colors duration-150 ease-out hover:bg-page`,children:[e.length>1?(0,j.jsx)(`span`,{"aria-hidden":`true`,className:k(`absolute left-[11px] w-px bg-rule`,i===0&&`top-1/2 bottom-0`,i===p&&`top-0 bottom-1/2`,i!==0&&i!==p&&`inset-y-0`)}):null,(0,j.jsx)(`span`,{"aria-hidden":`true`,className:k(`absolute top-1/2 left-2 size-[7px] -translate-y-1/2 rounded-full ring-2 ring-surface transition-colors duration-150 ease-out group-hover/question:ring-page`,a?`bg-accent`:`bg-muted/60 group-hover/question:bg-text`)}),(0,j.jsx)(`button`,{"aria-current":a?`true`:void 0,className:k(`min-w-0 flex-1 truncate rounded-control py-1.5 pr-1 pl-1.5 text-left text-[0.82rem] transition-colors duration-150 ease-out`,a?`font-medium text-text`:`text-muted group-hover/question:text-text`),"data-chat-question":!0,onClick:()=>f(r.id),title:o,type:`button`,children:o}),(0,j.jsx)(l,{label:`Edit this question and ask again from here`,side:`left`,children:(0,j.jsx)(Se,{"aria-label":`Edit “${o}” and ask again from here`,className:`mr-0.5 shrink-0 opacity-0 group-hover/question:opacity-100 focus-visible:opacity-100`,"data-chat-question-restore":!0,disabled:t,onClick:()=>n(r.index),size:`icon-sm`,variant:`ghost`,children:(0,j.jsx)(O,{name:`undo`,className:`size-3.5`})})})]},r.id)})})})}function ZR({companion:e,...t}){let n=m(e=>e.panelOpen),r=m(e=>e.setPanelOpen),i=m(e=>e.setCredentialOpen),a=n?`Hide the session panel`:`Show the session panel`;return(0,j.jsxs)(`aside`,{"aria-label":`Chat session`,className:k(`hidden min-h-0 shrink-0 flex-col gap-2 pt-3 xl:flex`,n?`w-72`:`w-8 items-center`),"data-chat-panel":n?`open`:`closed`,children:[(0,j.jsxs)(`div`,{className:k(`flex shrink-0 items-center gap-1 pl-1`,n?`h-7`:`flex-col-reverse gap-2`),children:[n?(0,j.jsx)(`h2`,{className:`m-0 mr-auto text-sm font-semibold`,children:`Session`}):null,(0,j.jsx)(l,{label:`Set the Claude credential chat answers with`,side:`left`,children:(0,j.jsxs)(Se,{"aria-haspopup":`dialog`,"aria-label":`Chat credential`,"data-open-chat-credential":!0,onClick:()=>i(!0),size:n?`sm`:`icon-sm`,variant:`ghost`,children:[(0,j.jsx)(O,{name:`key`,className:`size-3.5`}),n?`Credential`:null]})}),(0,j.jsx)(l,{label:a,side:`left`,children:(0,j.jsx)(Se,{"aria-controls":n?`chat-panel-body`:void 0,"aria-expanded":n,"aria-label":a,"data-chat-panel-toggle":!0,onClick:()=>r(!n),size:`icon-sm`,variant:`ghost`,children:(0,j.jsx)(O,{name:`sidebar`,className:`size-3.5`})})})]}),n?(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,id:`chat-panel-body`,children:[(0,j.jsx)(JR,{}),(0,j.jsx)(YR,{companion:e}),(0,j.jsx)(XR,{...t})]}):null]})}var QR=`Claude Code`,$R=[],ez=p[`claude-code`].map(({id:e,name:t,description:n})=>({value:e,name:t,description:n})),tz=[{value:`low`,name:`Low`,description:`Answers sooner, thinks less`},{value:`medium`,name:`Medium`,description:`The usual balance`},{value:`high`,name:`High`,description:`Thinks longest before answering`}];function nz({file:e,className:t,children:n}){return(0,j.jsx)(ee,{className:t,search:t=>({companion:t.companion,studioMode:t.studioMode,path:e}),title:`Open ${e} in the Vault`,to:`/vault`,children:n})}function rz({part:e,stopped:t,roots:n}){let r=iI(e);return(0,j.jsxs)(yR,{"data-chat-tool":r,children:[(0,j.jsx)(xR,{name:r,target:sz(e,n),state:e.state,stopped:t}),(0,j.jsxs)(SR,{children:[(0,j.jsx)(TR,{input:e.input}),(0,j.jsx)(ER,{output:`output`in e?e.output:void 0,errorText:`errorText`in e?e.errorText:void 0})]})]})}var iz=3,az=e=>fR(e.state),oz=e=>pR(e.state);function sz(e,t){let n=jR(e.input);return RR(n,t)??n}function cz({run:e,stopped:t,roots:n}){let r=e.map(e=>(0,j.jsx)(rz,{part:e,roots:n,stopped:t},e.toolCallId));if(e.length===1)return r[0];let i=iI(e[0]),a=e.map(e=>{let t=sz(e,n);return i===`read`?t.split(`/`).at(-1)??t:t});return(0,j.jsx)(vR,{failed:e.filter(az).length,label:NR(i,e.length),name:i,running:!t&&e.some(oz),targets:a,children:r})}function lz(e,t,n){let r=[],i=[],a=a=>{if(i.length===0)return;let o=MR(i,iI),s=a&&o.length>iz,c=PR(i.map(e=>({name:iI(e),failed:az(e)}))),l=e.parts.indexOf(i[0]);r.push((0,j.jsx)(_R,{summary:s?c:void 0,failed:i.some(az),children:o.map(e=>(0,j.jsx)(cz,{roots:n,run:e,stopped:!t},e[0].toolCallId))},`${e.id}-steps-${l}`)),i=[]},o=e.parts.length-1;return e.parts.forEach((n,s)=>{let c=`${e.id}-${s}`;if(nI(n))i.push(n);else if(n.type===`reasoning`){let e=t&&s===o;if(!n.text.trim()&&!e)return;a(!0),r.push((0,j.jsx)(lR,{streaming:e,text:n.text},c))}else n.type===`text`&&(a(!0),r.push(e.role===`user`?(0,j.jsx)(`p`,{className:`m-0 whitespace-pre-wrap`,children:n.text},c):(0,j.jsx)(YL,{isAnimating:t,children:n.text},c)))}),a(!t),r}var uz=(0,A.memo)(function({message:e,streaming:t,roots:n}){let r=t?``:a(e),i=zR(e,n);return(0,j.jsxs)(KL,{from:`assistant`,"data-chat-message":`assistant`,children:[(0,j.jsx)(WL,{cite:e=>{let t=RR(e,n);return!t||!i.includes(t)?null:(0,j.jsxs)(nz,{className:HL,file:t,children:[(0,j.jsx)(O,{name:`doc`,className:`size-3 self-center`}),(0,j.jsx)(`span`,{className:`truncate`,children:e})]})},children:(0,j.jsx)(qL,{children:lz(e,t,n)})}),!t&&(i.length>0||r)?(0,j.jsxs)(`div`,{className:`-ml-1.5 flex w-full flex-wrap items-start gap-1`,children:[i.length>0?(0,j.jsx)(zL,{count:i.length,children:i.map(e=>(0,j.jsx)(BL,{children:(0,j.jsx)(nz,{className:VL,file:e,children:(0,j.jsx)(`span`,{className:`truncate`,children:e})})},e))}):null,r?(0,j.jsx)(l,{label:`Copy the answer`,side:`bottom`,children:(0,j.jsx)(Se,{"aria-label":`Copy the answer`,className:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:()=>_(r,`the answer`),size:`icon-sm`,variant:`ghost`,children:(0,j.jsx)(O,{name:`copy`,className:`size-3.5`})})}):null]}):null]})});function dz({message:e,onRestore:t,busy:n}){return(0,j.jsx)(KL,{className:`scroll-mt-4`,"data-chat-message":`user`,from:`user`,id:kR(e.id),children:(0,j.jsxs)(`div`,{className:`flex w-full items-start justify-end gap-1`,children:[(0,j.jsx)(cL,{disabled:n,onRestore:t}),(0,j.jsx)(qL,{children:lz(e,!1,$R)})]})})}function fz({onAsk:e}){return(0,j.jsx)(pL,{id:`chat-empty`,description:`The agent answers from this companion's specs, changes, notes and reports. It reads, and changes nothing.`,children:(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`h2`,{className:`m-0 text-xs font-semibold text-muted`,children:`Try asking`}),(0,j.jsx)(uR,{children:DR.map(t=>(0,j.jsx)(dR,{onAsk:e,suggestion:t},t))})]})})}function pz({companion:e,roots:t=$R,transport:r}){let i=m(e=>e.model),c=m(e=>e.effort),l=m(e=>e.setModel),u=m(e=>e.setEffort),[d]=(0,A.useState)(()=>UR(e,r)),p=E(d.queue,e=>e.queued),h=()=>d.queue.getState().queued,g=e=>d.queue.setState({queued:e}),{messages:_,sendMessage:v,regenerate:y,setMessages:b,clearError:x,status:ee,stop:S,error:C}=JI({chat:d.chat}),w=(0,A.useRef)(null),T=m(e=>e.setCredentialOpen),te=C?BR(C):null,D=ee===`submitted`||ee===`streaming`,ne=e=>{D?g([...h(),{id:crypto.randomUUID(),text:e}]):v({text:e}),w.current?.focus()},ie=()=>{b([]),g([]),x(),w.current?.focus()},ae=e=>{let t=a(_[e]);b(_.slice(0,e)),g([]),x(),w.current&&(w.current.value=t,w.current.focus())},oe=_.flatMap((e,t)=>e.role===`user`?[{id:e.id,text:a(e),index:t}]:[]),se=eL({initial:`instant`,resize:`smooth`});return(0,j.jsxs)(`section`,{className:k(_e,`flex min-h-0 flex-1 gap-4 pb-4`),"data-chat-view":!0,"aria-label":`Chat`,children:[(0,j.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:[(0,j.jsxs)(dL,{instance:se,children:[(0,j.jsxs)(fL,{children:[_.length===0?(0,j.jsx)(fz,{onAsk:ne}):_.map((e,n)=>e.role===`user`?(0,j.jsx)(dz,{busy:D,message:e,onRestore:()=>ae(n)},e.id):(0,j.jsx)(uz,{message:e,roots:t,streaming:ee===`streaming`&&n===_.length-1},e.id)),ee===`submitted`?(0,j.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-muted`,id:`chat-thinking`,"aria-live":`polite`,children:[(0,j.jsx)(re,{"aria-hidden":`true`,role:void 0,className:`size-3.5 text-accent`}),`Reading the companion…`]}):null,te===null?null:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-bad bg-bad-soft px-3 py-2 text-sm`,id:`chat-error`,role:`alert`,children:[(0,j.jsxs)(`p`,{className:`m-0 min-w-0 flex-1 text-bad`,children:[`The answer failed: `,te]}),f(te)?(0,j.jsxs)(Se,{"data-chat-error-credential":!0,onClick:()=>T(!0),size:`sm`,variant:`primary`,children:[(0,j.jsx)(O,{name:`key`,className:`size-3.5`}),`Open credential`]}):null,(0,j.jsxs)(Se,{onClick:()=>{y(),w.current?.focus()},size:`sm`,children:[(0,j.jsx)(O,{name:`refresh`,className:`size-3.5`}),`Try again`]})]})]}),(0,j.jsx)(mL,{})]}),(0,j.jsxs)(`div`,{className:`mx-auto grid w-full max-w-[72ch] gap-1.5`,children:[(0,j.jsx)(cR,{items:p,note:D?void 0:`held until an answer succeeds`,onRemove:e=>{g(h().filter(t=>t.id!==e)),w.current?.focus()}}),(0,j.jsxs)(nR,{onSubmit:ne,children:[(0,j.jsx)(rR,{ref:w,autoFocus:!0,"aria-label":`Your question`,placeholder:D?`Ask a follow-up; it sends when this answer ends`:`Ask about this companion's specs, changes or notes`}),(0,j.jsxs)(iR,{children:[(0,j.jsxs)(aR,{children:[(0,j.jsx)(tR,{group:QR,label:`Model`,onChange:l,options:ez,value:i}),(0,j.jsx)(tR,{disabled:VR(i),label:`Effort`,onChange:u,options:tz,prefix:`Effort`,value:VR(i)?n[1]:c})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(uL,{budget:s,used:o(_)}),(0,j.jsx)(sR,{status:ee,onStop:()=>void S()})]})]})]}),(0,j.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3 px-1`,children:[(0,j.jsx)(oR,{}),_.length>0&&!D?(0,j.jsxs)(Se,{onClick:ie,size:`sm`,variant:`ghost`,children:[(0,j.jsx)(O,{name:`plus`,className:`size-3.5`}),`New conversation`]}):null]})]})]}),(0,j.jsx)(ZR,{busy:D,companion:e,onRestore:ae,questions:oe,scroll:se})]})}var mz=C({component:()=>hz}),hz=function(){let e=u.useLoaderData(),t=u.useSearch(),{data:n}=r(x({companion:t.companion,studioMode:t.studioMode})),i=n.selected,a=i?[i.path,...i.realPath?[i.realPath]:[]]:[];return e?(0,j.jsx)(pz,{companion:e,roots:a},e):null};export{oC as a,hz as component,sb as i,Ay as n,KS as r,mz as t};