@brainfish-ai/editor 0.0.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/README.md +3 -0
  2. package/dist/BrainfishEditor.d.ts +3 -0
  3. package/dist/apl-CXdQSnD-.js +2 -0
  4. package/dist/apl-CXdQSnD-.js.map +1 -0
  5. package/dist/apl-zQnQXYyi.cjs +2 -0
  6. package/dist/apl-zQnQXYyi.cjs.map +1 -0
  7. package/dist/asciiarmor-BjFlPGAR.cjs +2 -0
  8. package/dist/asciiarmor-BjFlPGAR.cjs.map +1 -0
  9. package/dist/asciiarmor-D5V0T9Cu.js +2 -0
  10. package/dist/asciiarmor-D5V0T9Cu.js.map +1 -0
  11. package/dist/asn1-DWPaVWf6.js +2 -0
  12. package/dist/asn1-DWPaVWf6.js.map +1 -0
  13. package/dist/asn1-Dn9-fgGr.cjs +2 -0
  14. package/dist/asn1-Dn9-fgGr.cjs.map +1 -0
  15. package/dist/asterisk-B46aRdXb.js +2 -0
  16. package/dist/asterisk-B46aRdXb.js.map +1 -0
  17. package/dist/asterisk-DIP73UbG.cjs +2 -0
  18. package/dist/asterisk-DIP73UbG.cjs.map +1 -0
  19. package/dist/brainfuck-CtZaYBKt.js +2 -0
  20. package/dist/brainfuck-CtZaYBKt.js.map +1 -0
  21. package/dist/brainfuck-DNcy2VoQ.cjs +2 -0
  22. package/dist/brainfuck-DNcy2VoQ.cjs.map +1 -0
  23. package/dist/clike-CSjUq15U.cjs +2 -0
  24. package/dist/clike-CSjUq15U.cjs.map +1 -0
  25. package/dist/clike-D9ynMLA9.js +2 -0
  26. package/dist/clike-D9ynMLA9.js.map +1 -0
  27. package/dist/clojure-C7e7OTgK.cjs +2 -0
  28. package/dist/clojure-C7e7OTgK.cjs.map +1 -0
  29. package/dist/clojure-DiuoqK-z.js +2 -0
  30. package/dist/clojure-DiuoqK-z.js.map +1 -0
  31. package/dist/cmake-DK3UdjBB.cjs +2 -0
  32. package/dist/cmake-DK3UdjBB.cjs.map +1 -0
  33. package/dist/cmake-DXn5xaP-.js +2 -0
  34. package/dist/cmake-DXn5xaP-.js.map +1 -0
  35. package/dist/cobol-D7gesrhf.cjs +2 -0
  36. package/dist/cobol-D7gesrhf.cjs.map +1 -0
  37. package/dist/cobol-stawOqaz.js +2 -0
  38. package/dist/cobol-stawOqaz.js.map +1 -0
  39. package/dist/coffeescript-BTDxI-eT.js +2 -0
  40. package/dist/coffeescript-BTDxI-eT.js.map +1 -0
  41. package/dist/coffeescript-CMaRvZDo.cjs +2 -0
  42. package/dist/coffeescript-CMaRvZDo.cjs.map +1 -0
  43. package/dist/commonlisp-BsK54Tey.cjs +2 -0
  44. package/dist/commonlisp-BsK54Tey.cjs.map +1 -0
  45. package/dist/commonlisp-vq6DHwts.js +2 -0
  46. package/dist/commonlisp-vq6DHwts.js.map +1 -0
  47. package/dist/crystal-BueyCNDj.cjs +2 -0
  48. package/dist/crystal-BueyCNDj.cjs.map +1 -0
  49. package/dist/crystal-CRzZ78HM.js +2 -0
  50. package/dist/crystal-CRzZ78HM.js.map +1 -0
  51. package/dist/css-C4GSMmGA.js +2 -0
  52. package/dist/css-C4GSMmGA.js.map +1 -0
  53. package/dist/css-DQQ8GO25.cjs +2 -0
  54. package/dist/css-DQQ8GO25.cjs.map +1 -0
  55. package/dist/cypher-CX8oWNVh.cjs +2 -0
  56. package/dist/cypher-CX8oWNVh.cjs.map +1 -0
  57. package/dist/cypher-gJDei3ni.js +2 -0
  58. package/dist/cypher-gJDei3ni.js.map +1 -0
  59. package/dist/d-BShv7fp-.js +2 -0
  60. package/dist/d-BShv7fp-.js.map +1 -0
  61. package/dist/d-Cer4WZq7.cjs +2 -0
  62. package/dist/d-Cer4WZq7.cjs.map +1 -0
  63. package/dist/diff-DanWUMqA.cjs +2 -0
  64. package/dist/diff-DanWUMqA.cjs.map +1 -0
  65. package/dist/diff-UJJ5BM9S.js +2 -0
  66. package/dist/diff-UJJ5BM9S.js.map +1 -0
  67. package/dist/dockerfile-D72m9Krh.cjs +2 -0
  68. package/dist/dockerfile-D72m9Krh.cjs.map +1 -0
  69. package/dist/dockerfile-DVQ9Q8O9.js +2 -0
  70. package/dist/dockerfile-DVQ9Q8O9.js.map +1 -0
  71. package/dist/dtd-DI9Herc-.js +2 -0
  72. package/dist/dtd-DI9Herc-.js.map +1 -0
  73. package/dist/dtd-N9E8mrwW.cjs +2 -0
  74. package/dist/dtd-N9E8mrwW.cjs.map +1 -0
  75. package/dist/dylan-BmN4EGo8.cjs +2 -0
  76. package/dist/dylan-BmN4EGo8.cjs.map +1 -0
  77. package/dist/dylan-DkEP81N9.js +2 -0
  78. package/dist/dylan-DkEP81N9.js.map +1 -0
  79. package/dist/ebnf-B-Df8AvO.js +2 -0
  80. package/dist/ebnf-B-Df8AvO.js.map +1 -0
  81. package/dist/ebnf-CHmKiAoS.cjs +2 -0
  82. package/dist/ebnf-CHmKiAoS.cjs.map +1 -0
  83. package/dist/ecl-DPFc0Uaf.js +2 -0
  84. package/dist/ecl-DPFc0Uaf.js.map +1 -0
  85. package/dist/ecl-DjtL7UT3.cjs +2 -0
  86. package/dist/ecl-DjtL7UT3.cjs.map +1 -0
  87. package/dist/editor.css +1892 -0
  88. package/dist/eiffel-DR5c0IrL.js +2 -0
  89. package/dist/eiffel-DR5c0IrL.js.map +1 -0
  90. package/dist/eiffel-u8sFjvpJ.cjs +2 -0
  91. package/dist/eiffel-u8sFjvpJ.cjs.map +1 -0
  92. package/dist/elm-DJqCmzHQ.cjs +2 -0
  93. package/dist/elm-DJqCmzHQ.cjs.map +1 -0
  94. package/dist/elm-DompmV0j.js +2 -0
  95. package/dist/elm-DompmV0j.js.map +1 -0
  96. package/dist/erlang-BuqgqA5h.js +2 -0
  97. package/dist/erlang-BuqgqA5h.js.map +1 -0
  98. package/dist/erlang-aNM9Wno5.cjs +2 -0
  99. package/dist/erlang-aNM9Wno5.cjs.map +1 -0
  100. package/dist/factor-Bk9_H-XT.js +2 -0
  101. package/dist/factor-Bk9_H-XT.js.map +1 -0
  102. package/dist/factor-DAjbIl49.cjs +2 -0
  103. package/dist/factor-DAjbIl49.cjs.map +1 -0
  104. package/dist/fcl-CVaBTCzQ.js +2 -0
  105. package/dist/fcl-CVaBTCzQ.js.map +1 -0
  106. package/dist/fcl-CplLEkwW.cjs +2 -0
  107. package/dist/fcl-CplLEkwW.cjs.map +1 -0
  108. package/dist/forth-CqDKyQE2.cjs +2 -0
  109. package/dist/forth-CqDKyQE2.cjs.map +1 -0
  110. package/dist/forth-POgR1ypr.js +2 -0
  111. package/dist/forth-POgR1ypr.js.map +1 -0
  112. package/dist/fortran-DL7KluxX.js +2 -0
  113. package/dist/fortran-DL7KluxX.js.map +1 -0
  114. package/dist/fortran-N3iQ92Ni.cjs +2 -0
  115. package/dist/fortran-N3iQ92Ni.cjs.map +1 -0
  116. package/dist/gas-8mz5Q3qN.js +2 -0
  117. package/dist/gas-8mz5Q3qN.js.map +1 -0
  118. package/dist/gas-BZkkcdED.cjs +2 -0
  119. package/dist/gas-BZkkcdED.cjs.map +1 -0
  120. package/dist/gherkin-B6X1vGSW.js +2 -0
  121. package/dist/gherkin-B6X1vGSW.js.map +1 -0
  122. package/dist/gherkin-CxCA0y5R.cjs +2 -0
  123. package/dist/gherkin-CxCA0y5R.cjs.map +1 -0
  124. package/dist/groovy-BQvSfgjf.cjs +2 -0
  125. package/dist/groovy-BQvSfgjf.cjs.map +1 -0
  126. package/dist/groovy-DnIzCrpZ.js +2 -0
  127. package/dist/groovy-DnIzCrpZ.js.map +1 -0
  128. package/dist/haskell-CLQs6EAM.js +2 -0
  129. package/dist/haskell-CLQs6EAM.js.map +1 -0
  130. package/dist/haskell-D7NTJ5RY.cjs +2 -0
  131. package/dist/haskell-D7NTJ5RY.cjs.map +1 -0
  132. package/dist/haxe-Cd8JQ-kk.cjs +2 -0
  133. package/dist/haxe-Cd8JQ-kk.cjs.map +1 -0
  134. package/dist/haxe-D25e-2l-.js +2 -0
  135. package/dist/haxe-D25e-2l-.js.map +1 -0
  136. package/dist/http-BKJkqRj4.js +2 -0
  137. package/dist/http-BKJkqRj4.js.map +1 -0
  138. package/dist/http-t7fOg_NY.cjs +2 -0
  139. package/dist/http-t7fOg_NY.cjs.map +1 -0
  140. package/dist/idl-CMWyLfiW.cjs +2 -0
  141. package/dist/idl-CMWyLfiW.cjs.map +1 -0
  142. package/dist/idl-pcmmZuaN.js +2 -0
  143. package/dist/idl-pcmmZuaN.js.map +1 -0
  144. package/dist/index-ACxdSjMI.js +2 -0
  145. package/dist/index-ACxdSjMI.js.map +1 -0
  146. package/dist/index-B8g-Emd_.cjs +2 -0
  147. package/dist/index-B8g-Emd_.cjs.map +1 -0
  148. package/dist/index-B8qgDwc2.cjs +2 -0
  149. package/dist/index-B8qgDwc2.cjs.map +1 -0
  150. package/dist/index-BA_fGRsg.cjs +2 -0
  151. package/dist/index-BA_fGRsg.cjs.map +1 -0
  152. package/dist/index-BB6ubjey.js +2 -0
  153. package/dist/index-BB6ubjey.js.map +1 -0
  154. package/dist/index-BP_HzP4g.cjs +2 -0
  155. package/dist/index-BP_HzP4g.cjs.map +1 -0
  156. package/dist/index-BVBmfxRp.js +2 -0
  157. package/dist/index-BVBmfxRp.js.map +1 -0
  158. package/dist/index-BWxF9mHQ.js +2 -0
  159. package/dist/index-BWxF9mHQ.js.map +1 -0
  160. package/dist/index-B_5Ht033.js +2 -0
  161. package/dist/index-B_5Ht033.js.map +1 -0
  162. package/dist/index-BeFrSIhU.js +2 -0
  163. package/dist/index-BeFrSIhU.js.map +1 -0
  164. package/dist/index-BfJWuhtD.js +2 -0
  165. package/dist/index-BfJWuhtD.js.map +1 -0
  166. package/dist/index-BjVxfywp.cjs +2 -0
  167. package/dist/index-BjVxfywp.cjs.map +1 -0
  168. package/dist/index-BrJMv-jH.js +2 -0
  169. package/dist/index-BrJMv-jH.js.map +1 -0
  170. package/dist/index-C2hO0yQX.cjs +2 -0
  171. package/dist/index-C2hO0yQX.cjs.map +1 -0
  172. package/dist/index-CCnrTHCt.js +2 -0
  173. package/dist/index-CCnrTHCt.js.map +1 -0
  174. package/dist/index-CJJ4VsSg.js +2 -0
  175. package/dist/index-CJJ4VsSg.js.map +1 -0
  176. package/dist/index-CJfX-kOc.cjs +2 -0
  177. package/dist/index-CJfX-kOc.cjs.map +1 -0
  178. package/dist/index-CLd2kktb.js +2 -0
  179. package/dist/index-CLd2kktb.js.map +1 -0
  180. package/dist/index-CLgcgbOT.cjs +2 -0
  181. package/dist/index-CLgcgbOT.cjs.map +1 -0
  182. package/dist/index-CaI_tf2M.js +2 -0
  183. package/dist/index-CaI_tf2M.js.map +1 -0
  184. package/dist/index-Cag-iwMt.js +2 -0
  185. package/dist/index-Cag-iwMt.js.map +1 -0
  186. package/dist/index-CdQh0Fyo.cjs +2 -0
  187. package/dist/index-CdQh0Fyo.cjs.map +1 -0
  188. package/dist/index-Cdt7DehW.cjs +30 -0
  189. package/dist/index-Cdt7DehW.cjs.map +1 -0
  190. package/dist/index-ChoC78fj.cjs +2 -0
  191. package/dist/index-ChoC78fj.cjs.map +1 -0
  192. package/dist/index-CnaX07f3.cjs +2 -0
  193. package/dist/index-CnaX07f3.cjs.map +1 -0
  194. package/dist/index-CrA_KK1J.cjs +2 -0
  195. package/dist/index-CrA_KK1J.cjs.map +1 -0
  196. package/dist/index-D1-a3lpN.cjs +2 -0
  197. package/dist/index-D1-a3lpN.cjs.map +1 -0
  198. package/dist/index-D5CLEDVN.js +2 -0
  199. package/dist/index-D5CLEDVN.js.map +1 -0
  200. package/dist/index-D7bPdN0E.js +30 -0
  201. package/dist/index-D7bPdN0E.js.map +1 -0
  202. package/dist/index-DD3pDFDN.cjs +2 -0
  203. package/dist/index-DD3pDFDN.cjs.map +1 -0
  204. package/dist/index-DJuPAZHh.cjs +2 -0
  205. package/dist/index-DJuPAZHh.cjs.map +1 -0
  206. package/dist/index-DKdNdnL4.js +2 -0
  207. package/dist/index-DKdNdnL4.js.map +1 -0
  208. package/dist/index-DgjCLKdD.cjs +2 -0
  209. package/dist/index-DgjCLKdD.cjs.map +1 -0
  210. package/dist/index-DhqL6bag.cjs +2 -0
  211. package/dist/index-DhqL6bag.cjs.map +1 -0
  212. package/dist/index-Dqz1jwXo.js +2 -0
  213. package/dist/index-Dqz1jwXo.js.map +1 -0
  214. package/dist/index-DvuuGDob.cjs +2 -0
  215. package/dist/index-DvuuGDob.cjs.map +1 -0
  216. package/dist/index-HXoeN679.js +2 -0
  217. package/dist/index-HXoeN679.js.map +1 -0
  218. package/dist/index-MEXcFr58.cjs +2 -0
  219. package/dist/index-MEXcFr58.cjs.map +1 -0
  220. package/dist/index-QYTegilJ.js +2 -0
  221. package/dist/index-QYTegilJ.js.map +1 -0
  222. package/dist/index-WCX-tAQC.js +2 -0
  223. package/dist/index-WCX-tAQC.js.map +1 -0
  224. package/dist/index-Y2ncXqt9.cjs +2 -0
  225. package/dist/index-Y2ncXqt9.cjs.map +1 -0
  226. package/dist/index-a2kYnnvX.cjs +2 -0
  227. package/dist/index-a2kYnnvX.cjs.map +1 -0
  228. package/dist/index-fzHicfTR.js +2 -0
  229. package/dist/index-fzHicfTR.js.map +1 -0
  230. package/dist/index-g6UtrOym.js +2 -0
  231. package/dist/index-g6UtrOym.js.map +1 -0
  232. package/dist/index-gIqivS4c.cjs +2 -0
  233. package/dist/index-gIqivS4c.cjs.map +1 -0
  234. package/dist/index-r8ALDJTU.js +2 -0
  235. package/dist/index-r8ALDJTU.js.map +1 -0
  236. package/dist/index.cjs.js +2 -0
  237. package/dist/index.cjs.js.map +1 -0
  238. package/dist/index.d.ts +3 -0
  239. package/dist/index.js +2 -0
  240. package/dist/index.js.map +1 -0
  241. package/dist/javascript-BVaBnk3P.js +2 -0
  242. package/dist/javascript-BVaBnk3P.js.map +1 -0
  243. package/dist/javascript-D6Y0eXWo.cjs +2 -0
  244. package/dist/javascript-D6Y0eXWo.cjs.map +1 -0
  245. package/dist/julia-BFjC6Od-.cjs +2 -0
  246. package/dist/julia-BFjC6Od-.cjs.map +1 -0
  247. package/dist/julia-DjdwvFuI.js +2 -0
  248. package/dist/julia-DjdwvFuI.js.map +1 -0
  249. package/dist/livescript-BEKRTOP4.cjs +2 -0
  250. package/dist/livescript-BEKRTOP4.cjs.map +1 -0
  251. package/dist/livescript-HO6ttBFx.js +2 -0
  252. package/dist/livescript-HO6ttBFx.js.map +1 -0
  253. package/dist/lua-8DXOpKDz.js +2 -0
  254. package/dist/lua-8DXOpKDz.js.map +1 -0
  255. package/dist/lua-B3w2r80v.cjs +2 -0
  256. package/dist/lua-B3w2r80v.cjs.map +1 -0
  257. package/dist/mathematica-BeWz3n7v.cjs +2 -0
  258. package/dist/mathematica-BeWz3n7v.cjs.map +1 -0
  259. package/dist/mathematica-IIbmv7SK.js +2 -0
  260. package/dist/mathematica-IIbmv7SK.js.map +1 -0
  261. package/dist/mbox-B-KNExnr.cjs +2 -0
  262. package/dist/mbox-B-KNExnr.cjs.map +1 -0
  263. package/dist/mbox-z_N2Mo3d.js +2 -0
  264. package/dist/mbox-z_N2Mo3d.js.map +1 -0
  265. package/dist/mirc-DKj7vbBK.cjs +2 -0
  266. package/dist/mirc-DKj7vbBK.cjs.map +1 -0
  267. package/dist/mirc-DkvFAiy5.js +2 -0
  268. package/dist/mirc-DkvFAiy5.js.map +1 -0
  269. package/dist/mllike-3c2dg9RT.js +2 -0
  270. package/dist/mllike-3c2dg9RT.js.map +1 -0
  271. package/dist/mllike-DNBMjfDT.cjs +2 -0
  272. package/dist/mllike-DNBMjfDT.cjs.map +1 -0
  273. package/dist/modelica-D0zQ5M5B.cjs +2 -0
  274. package/dist/modelica-D0zQ5M5B.cjs.map +1 -0
  275. package/dist/modelica-DSrSSXCg.js +2 -0
  276. package/dist/modelica-DSrSSXCg.js.map +1 -0
  277. package/dist/mscgen-B2igx18G.js +2 -0
  278. package/dist/mscgen-B2igx18G.js.map +1 -0
  279. package/dist/mscgen-DXB_4N_e.cjs +2 -0
  280. package/dist/mscgen-DXB_4N_e.cjs.map +1 -0
  281. package/dist/mumps-DQ_3S9Ud.cjs +2 -0
  282. package/dist/mumps-DQ_3S9Ud.cjs.map +1 -0
  283. package/dist/mumps-zvxmGV4l.js +2 -0
  284. package/dist/mumps-zvxmGV4l.js.map +1 -0
  285. package/dist/nginx-B4hAVlXN.js +2 -0
  286. package/dist/nginx-B4hAVlXN.js.map +1 -0
  287. package/dist/nginx-BxNxyOuV.cjs +2 -0
  288. package/dist/nginx-BxNxyOuV.cjs.map +1 -0
  289. package/dist/nsis-Cx8FAvMN.js +2 -0
  290. package/dist/nsis-Cx8FAvMN.js.map +1 -0
  291. package/dist/nsis-DPoxhFCA.cjs +2 -0
  292. package/dist/nsis-DPoxhFCA.cjs.map +1 -0
  293. package/dist/ntriples-BSwWqoLa.js +2 -0
  294. package/dist/ntriples-BSwWqoLa.js.map +1 -0
  295. package/dist/ntriples-D7LF77EX.cjs +2 -0
  296. package/dist/ntriples-D7LF77EX.cjs.map +1 -0
  297. package/dist/octave-C3xiZjFR.cjs +2 -0
  298. package/dist/octave-C3xiZjFR.cjs.map +1 -0
  299. package/dist/octave-C4hdQ5Hf.js +2 -0
  300. package/dist/octave-C4hdQ5Hf.js.map +1 -0
  301. package/dist/oz-hv8iHpBf.cjs +2 -0
  302. package/dist/oz-hv8iHpBf.cjs.map +1 -0
  303. package/dist/oz-qQq7irPq.js +2 -0
  304. package/dist/oz-qQq7irPq.js.map +1 -0
  305. package/dist/pascal-CafrKXZF.js +2 -0
  306. package/dist/pascal-CafrKXZF.js.map +1 -0
  307. package/dist/pascal-Dik6Bdx0.cjs +2 -0
  308. package/dist/pascal-Dik6Bdx0.cjs.map +1 -0
  309. package/dist/perl-Dc23MFYf.cjs +2 -0
  310. package/dist/perl-Dc23MFYf.cjs.map +1 -0
  311. package/dist/perl-tdMlh9QA.js +2 -0
  312. package/dist/perl-tdMlh9QA.js.map +1 -0
  313. package/dist/pig-CwGJVRC4.js +2 -0
  314. package/dist/pig-CwGJVRC4.js.map +1 -0
  315. package/dist/pig-DnhgnaAt.cjs +2 -0
  316. package/dist/pig-DnhgnaAt.cjs.map +1 -0
  317. package/dist/powershell-D1ly3AHC.js +2 -0
  318. package/dist/powershell-D1ly3AHC.js.map +1 -0
  319. package/dist/powershell-DIx6LGo6.cjs +2 -0
  320. package/dist/powershell-DIx6LGo6.cjs.map +1 -0
  321. package/dist/properties-C6mOHf2m.cjs +2 -0
  322. package/dist/properties-C6mOHf2m.cjs.map +1 -0
  323. package/dist/properties-_nPj978X.js +2 -0
  324. package/dist/properties-_nPj978X.js.map +1 -0
  325. package/dist/protobuf-B4y9do6W.js +2 -0
  326. package/dist/protobuf-B4y9do6W.js.map +1 -0
  327. package/dist/protobuf-zKe6cAIt.cjs +2 -0
  328. package/dist/protobuf-zKe6cAIt.cjs.map +1 -0
  329. package/dist/pug-Dlfivyh-.js +2 -0
  330. package/dist/pug-Dlfivyh-.js.map +1 -0
  331. package/dist/pug-fO_wg3KT.cjs +2 -0
  332. package/dist/pug-fO_wg3KT.cjs.map +1 -0
  333. package/dist/puppet-BVD6XdcM.cjs +2 -0
  334. package/dist/puppet-BVD6XdcM.cjs.map +1 -0
  335. package/dist/puppet-Bc-yJKzi.js +2 -0
  336. package/dist/puppet-Bc-yJKzi.js.map +1 -0
  337. package/dist/python-4hVbH2VM.cjs +2 -0
  338. package/dist/python-4hVbH2VM.cjs.map +1 -0
  339. package/dist/python-On6Xi21R.js +2 -0
  340. package/dist/python-On6Xi21R.js.map +1 -0
  341. package/dist/q-mUfi2b_o.js +2 -0
  342. package/dist/q-mUfi2b_o.js.map +1 -0
  343. package/dist/q-xj0roXkX.cjs +2 -0
  344. package/dist/q-xj0roXkX.cjs.map +1 -0
  345. package/dist/r-BA4EbLKE.js +2 -0
  346. package/dist/r-BA4EbLKE.js.map +1 -0
  347. package/dist/r-D3PcvI1z.cjs +2 -0
  348. package/dist/r-D3PcvI1z.cjs.map +1 -0
  349. package/dist/rpm-DI_rRufH.js +2 -0
  350. package/dist/rpm-DI_rRufH.js.map +1 -0
  351. package/dist/rpm-en7QUikA.cjs +2 -0
  352. package/dist/rpm-en7QUikA.cjs.map +1 -0
  353. package/dist/ruby-B5mrZV-E.cjs +2 -0
  354. package/dist/ruby-B5mrZV-E.cjs.map +1 -0
  355. package/dist/ruby-CR-u2WLS.js +2 -0
  356. package/dist/ruby-CR-u2WLS.js.map +1 -0
  357. package/dist/sas-Bqaci40L.js +2 -0
  358. package/dist/sas-Bqaci40L.js.map +1 -0
  359. package/dist/sas-DihmCBR4.cjs +2 -0
  360. package/dist/sas-DihmCBR4.cjs.map +1 -0
  361. package/dist/scheme-D4lhRHzG.cjs +2 -0
  362. package/dist/scheme-D4lhRHzG.cjs.map +1 -0
  363. package/dist/scheme-qjP0V5Ag.js +2 -0
  364. package/dist/scheme-qjP0V5Ag.js.map +1 -0
  365. package/dist/shell-5Optxxtq.cjs +2 -0
  366. package/dist/shell-5Optxxtq.cjs.map +1 -0
  367. package/dist/shell-BLav31RL.js +2 -0
  368. package/dist/shell-BLav31RL.js.map +1 -0
  369. package/dist/sieve-r025o_jW.js +2 -0
  370. package/dist/sieve-r025o_jW.js.map +1 -0
  371. package/dist/sieve-woNLjsDA.cjs +2 -0
  372. package/dist/sieve-woNLjsDA.cjs.map +1 -0
  373. package/dist/simple-mode-5nlGhSi7.cjs +2 -0
  374. package/dist/simple-mode-5nlGhSi7.cjs.map +1 -0
  375. package/dist/simple-mode-CjHKX61j.js +2 -0
  376. package/dist/simple-mode-CjHKX61j.js.map +1 -0
  377. package/dist/smalltalk-C7J3IyEP.js +2 -0
  378. package/dist/smalltalk-C7J3IyEP.js.map +1 -0
  379. package/dist/smalltalk-WUDknFHI.cjs +2 -0
  380. package/dist/smalltalk-WUDknFHI.cjs.map +1 -0
  381. package/dist/solr-78MBEUkU.js +2 -0
  382. package/dist/solr-78MBEUkU.js.map +1 -0
  383. package/dist/solr-Dv5yQw8C.cjs +2 -0
  384. package/dist/solr-Dv5yQw8C.cjs.map +1 -0
  385. package/dist/sparql-BRLJFz69.js +2 -0
  386. package/dist/sparql-BRLJFz69.js.map +1 -0
  387. package/dist/sparql-Ne__rGfz.cjs +2 -0
  388. package/dist/sparql-Ne__rGfz.cjs.map +1 -0
  389. package/dist/spreadsheet-CGlWr0eM.js +2 -0
  390. package/dist/spreadsheet-CGlWr0eM.js.map +1 -0
  391. package/dist/spreadsheet-sA8wKbVn.cjs +2 -0
  392. package/dist/spreadsheet-sA8wKbVn.cjs.map +1 -0
  393. package/dist/sql-ByLYq2fX.js +2 -0
  394. package/dist/sql-ByLYq2fX.js.map +1 -0
  395. package/dist/sql-YL702_qL.cjs +2 -0
  396. package/dist/sql-YL702_qL.cjs.map +1 -0
  397. package/dist/stex-0KIfGD5U.cjs +2 -0
  398. package/dist/stex-0KIfGD5U.cjs.map +1 -0
  399. package/dist/stex-BuioYw3P.js +2 -0
  400. package/dist/stex-BuioYw3P.js.map +1 -0
  401. package/dist/stylus-Bdo_Aemu.js +2 -0
  402. package/dist/stylus-Bdo_Aemu.js.map +1 -0
  403. package/dist/stylus-CaoJxDo0.cjs +2 -0
  404. package/dist/stylus-CaoJxDo0.cjs.map +1 -0
  405. package/dist/swift-B_XXVlXX.js +2 -0
  406. package/dist/swift-B_XXVlXX.js.map +1 -0
  407. package/dist/swift-D7nDGOwE.cjs +2 -0
  408. package/dist/swift-D7nDGOwE.cjs.map +1 -0
  409. package/dist/tcl-B2fODqDH.js +2 -0
  410. package/dist/tcl-B2fODqDH.js.map +1 -0
  411. package/dist/tcl-CKXdgq-y.cjs +2 -0
  412. package/dist/tcl-CKXdgq-y.cjs.map +1 -0
  413. package/dist/textile-BuVhTOzU.js +2 -0
  414. package/dist/textile-BuVhTOzU.js.map +1 -0
  415. package/dist/textile-CCW3yDUP.cjs +2 -0
  416. package/dist/textile-CCW3yDUP.cjs.map +1 -0
  417. package/dist/tiddlywiki-BgR6AEZu.js +2 -0
  418. package/dist/tiddlywiki-BgR6AEZu.js.map +1 -0
  419. package/dist/tiddlywiki-C-W_icqq.cjs +2 -0
  420. package/dist/tiddlywiki-C-W_icqq.cjs.map +1 -0
  421. package/dist/tiki-CI-ztowC.js +2 -0
  422. package/dist/tiki-CI-ztowC.js.map +1 -0
  423. package/dist/tiki-DrQIeHRf.cjs +2 -0
  424. package/dist/tiki-DrQIeHRf.cjs.map +1 -0
  425. package/dist/toml-BVJm5Fzd.js +2 -0
  426. package/dist/toml-BVJm5Fzd.js.map +1 -0
  427. package/dist/toml-CY1HDY9K.cjs +2 -0
  428. package/dist/toml-CY1HDY9K.cjs.map +1 -0
  429. package/dist/troff-Ce85hlLp.js +2 -0
  430. package/dist/troff-Ce85hlLp.js.map +1 -0
  431. package/dist/troff-Yww0HU2c.cjs +2 -0
  432. package/dist/troff-Yww0HU2c.cjs.map +1 -0
  433. package/dist/ttcn-BxnYHtq8.js +2 -0
  434. package/dist/ttcn-BxnYHtq8.js.map +1 -0
  435. package/dist/ttcn-D-KkrC_Y.cjs +2 -0
  436. package/dist/ttcn-D-KkrC_Y.cjs.map +1 -0
  437. package/dist/ttcn-cfg-CKJxb-l2.js +2 -0
  438. package/dist/ttcn-cfg-CKJxb-l2.js.map +1 -0
  439. package/dist/ttcn-cfg-DEW0CUak.cjs +2 -0
  440. package/dist/ttcn-cfg-DEW0CUak.cjs.map +1 -0
  441. package/dist/turtle-BkSuIpt-.js +2 -0
  442. package/dist/turtle-BkSuIpt-.js.map +1 -0
  443. package/dist/turtle-CNPaIIfW.cjs +2 -0
  444. package/dist/turtle-CNPaIIfW.cjs.map +1 -0
  445. package/dist/types.d.ts +14 -0
  446. package/dist/vb-BHgjm0DN.js +2 -0
  447. package/dist/vb-BHgjm0DN.js.map +1 -0
  448. package/dist/vb-CW7t9lKI.cjs +2 -0
  449. package/dist/vb-CW7t9lKI.cjs.map +1 -0
  450. package/dist/vbscript-D2Gs3oEd.cjs +2 -0
  451. package/dist/vbscript-D2Gs3oEd.cjs.map +1 -0
  452. package/dist/vbscript-VzWlGt02.js +2 -0
  453. package/dist/vbscript-VzWlGt02.js.map +1 -0
  454. package/dist/velocity-BdD_26Jv.js +2 -0
  455. package/dist/velocity-BdD_26Jv.js.map +1 -0
  456. package/dist/velocity-BpfD1zFY.cjs +2 -0
  457. package/dist/velocity-BpfD1zFY.cjs.map +1 -0
  458. package/dist/verilog-C8nH2N0M.js +2 -0
  459. package/dist/verilog-C8nH2N0M.js.map +1 -0
  460. package/dist/verilog-CcB4aIua.cjs +2 -0
  461. package/dist/verilog-CcB4aIua.cjs.map +1 -0
  462. package/dist/vhdl-9LHG0O1e.cjs +2 -0
  463. package/dist/vhdl-9LHG0O1e.cjs.map +1 -0
  464. package/dist/vhdl-CWWH2SUo.js +2 -0
  465. package/dist/vhdl-CWWH2SUo.js.map +1 -0
  466. package/dist/webidl-CGwyPRYs.js +2 -0
  467. package/dist/webidl-CGwyPRYs.js.map +1 -0
  468. package/dist/webidl-YkXkSuHd.cjs +2 -0
  469. package/dist/webidl-YkXkSuHd.cjs.map +1 -0
  470. package/dist/xquery-CVDBqZPY.js +2 -0
  471. package/dist/xquery-CVDBqZPY.js.map +1 -0
  472. package/dist/xquery-DwwVyz90.cjs +2 -0
  473. package/dist/xquery-DwwVyz90.cjs.map +1 -0
  474. package/dist/yacas-I8QjZlxf.js +2 -0
  475. package/dist/yacas-I8QjZlxf.js.map +1 -0
  476. package/dist/yacas-cn_NTwBk.cjs +2 -0
  477. package/dist/yacas-cn_NTwBk.cjs.map +1 -0
  478. package/dist/z80-B9lBbT6u.cjs +2 -0
  479. package/dist/z80-B9lBbT6u.cjs.map +1 -0
  480. package/dist/z80-DMVFMNEx.js +2 -0
  481. package/dist/z80-DMVFMNEx.js.map +1 -0
  482. package/package.json +69 -0
@@ -0,0 +1,30 @@
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("react");var n="object"==typeof global&&global&&global.Object===Object&&global,r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")(),o=i.Symbol,s=Object.prototype,a=s.hasOwnProperty,l=s.toString,c=o?o.toStringTag:void 0;var h=Object.prototype.toString;var u=o?o.toStringTag:void 0;function d(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?function(e){var t=a.call(e,c),n=e[c];try{e[c]=void 0;var r=!0}catch(e){}var i=l.call(e);return r&&(t?e[c]=n:delete e[c]),i}(e):function(e){return h.call(e)}(e)}function p(e){return null!=e&&"object"==typeof e}var f=Array.isArray,m=/\s/;var g=/^\s+/;function v(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&m.test(e.charAt(t)););return t}(e)+1).replace(g,""):e}function y(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var w=/^[-+]0x[0-9a-f]+$/i,b=/^0b[01]+$/i,x=/^0o[0-7]+$/i,k=parseInt;function S(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==d(e)}(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=v(e);var n=b.test(e);return n||x.test(e)?k(e.slice(2),n?2:8):w.test(e)?NaN:+e}function C(e){return e}function M(e){if(!y(e))return!1;var t=d(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var T=i["__core-js_shared__"],A=function(){var e=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var O=Function.prototype.toString;var N=/^\[object .+?Constructor\]$/,E=Function.prototype,D=Object.prototype,I=E.toString,_=D.hasOwnProperty,P=RegExp("^"+I.call(_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function R(e){return!(!y(e)||(t=e,A&&A in t))&&(M(e)?P:N).test(function(e){if(null!=e){try{return O.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function L(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return R(n)?n:void 0}var B=Object.create,z=function(){function e(){}return function(t){if(!y(t))return{};if(B)return B(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function V(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var F=Date.now;var H,q,j,$=function(){try{var e=L(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),W=$?function(e,t){return $(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:C,U=(H=W,q=0,j=0,function(){var e=F(),t=16-(e-j);if(j=e,t>0){if(++q>=800)return arguments[0]}else q=0;return H.apply(void 0,arguments)}),K=/^(?:0|[1-9]\d*)$/;function G(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&K.test(e))&&e>-1&&e%1==0&&e<t}function J(e,t,n){"__proto__"==t&&$?$(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Y(e,t){return e===t||e!=e&&t!=t}var X=Object.prototype.hasOwnProperty;function Z(e,t,n){var r=e[t];X.call(e,t)&&Y(r,n)&&(void 0!==n||t in e)||J(e,t,n)}var Q=Math.max;function ee(e,t){return U(function(e,t,n){return t=Q(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Q(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),V(e,this,a)}}(e,t,C),e+"")}function te(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ne(e){return null!=e&&te(e.length)&&!M(e)}var re=Object.prototype;function ie(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||re)}function oe(e){return p(e)&&"[object Arguments]"==d(e)}var se=Object.prototype,ae=se.hasOwnProperty,le=se.propertyIsEnumerable,ce=oe(function(){return arguments}())?oe:function(e){return p(e)&&ae.call(e,"callee")&&!le.call(e,"callee")};var he="object"==typeof exports&&exports&&!exports.nodeType&&exports,ue=he&&"object"==typeof module&&module&&!module.nodeType&&module,de=ue&&ue.exports===he?i.Buffer:void 0,pe=(de?de.isBuffer:void 0)||function(){return!1},fe={};fe["[object Float32Array]"]=fe["[object Float64Array]"]=fe["[object Int8Array]"]=fe["[object Int16Array]"]=fe["[object Int32Array]"]=fe["[object Uint8Array]"]=fe["[object Uint8ClampedArray]"]=fe["[object Uint16Array]"]=fe["[object Uint32Array]"]=!0,fe["[object Arguments]"]=fe["[object Array]"]=fe["[object ArrayBuffer]"]=fe["[object Boolean]"]=fe["[object DataView]"]=fe["[object Date]"]=fe["[object Error]"]=fe["[object Function]"]=fe["[object Map]"]=fe["[object Number]"]=fe["[object Object]"]=fe["[object RegExp]"]=fe["[object Set]"]=fe["[object String]"]=fe["[object WeakMap]"]=!1;var me="object"==typeof exports&&exports&&!exports.nodeType&&exports,ge=me&&"object"==typeof module&&module&&!module.nodeType&&module,ve=ge&&ge.exports===me&&n.process,ye=function(){try{var e=ge&&ge.require&&ge.require("util").types;return e||ve&&ve.binding&&ve.binding("util")}catch(e){}}(),we=ye&&ye.isTypedArray,be=we?function(e){return function(t){return e(t)}}(we):function(e){return p(e)&&te(e.length)&&!!fe[d(e)]};function xe(e,t){var n=f(e),r=!n&&ce(e),i=!n&&!r&&pe(e),o=!n&&!r&&!i&&be(e),s=n||r||i||o,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],l=a.length;for(var c in e)s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||G(c,l))||a.push(c);return a}var ke=Object.prototype.hasOwnProperty;function Se(e){if(!y(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ie(e),n=[];for(var r in e)("constructor"!=r||!t&&ke.call(e,r))&&n.push(r);return n}function Ce(e){return ne(e)?xe(e):Se(e)}var Me=L(Object,"create");var Te=Object.prototype.hasOwnProperty;var Ae=Object.prototype.hasOwnProperty;function Oe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e,t){for(var n=e.length;n--;)if(Y(e[n][0],t))return n;return-1}Oe.prototype.clear=function(){this.__data__=Me?Me(null):{},this.size=0},Oe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Oe.prototype.get=function(e){var t=this.__data__;if(Me){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Te.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return Me?void 0!==t[e]:Ae.call(t,e)},Oe.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Me&&void 0===t?"__lodash_hash_undefined__":t,this};var Ee=Array.prototype.splice;function De(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}De.prototype.clear=function(){this.__data__=[],this.size=0},De.prototype.delete=function(e){var t=this.__data__,n=Ne(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ee.call(t,n,1),--this.size,!0)},De.prototype.get=function(e){var t=this.__data__,n=Ne(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ne(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,r=Ne(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Ie=L(i,"Map");function _e(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pe.prototype.clear=function(){this.size=0,this.__data__={hash:new Oe,map:new(Ie||De),string:new Oe}},Pe.prototype.delete=function(e){var t=_e(this,e).delete(e);return this.size-=t?1:0,t},Pe.prototype.get=function(e){return _e(this,e).get(e)},Pe.prototype.has=function(e){return _e(this,e).has(e)},Pe.prototype.set=function(e,t){var n=_e(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var Re=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Le=Function.prototype,Be=Object.prototype,ze=Le.toString,Ve=Be.hasOwnProperty,Fe=ze.call(Object);function He(e){var t=this.__data__=new De(e);this.size=t.size}He.prototype.clear=function(){this.__data__=new De,this.size=0},He.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},He.prototype.get=function(e){return this.__data__.get(e)},He.prototype.has=function(e){return this.__data__.has(e)},He.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var r=n.__data__;if(!Ie||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pe(r)}return n.set(e,t),this.size=n.size,this};var qe="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=qe&&"object"==typeof module&&module&&!module.nodeType&&module,$e=je&&je.exports===qe?i.Buffer:void 0;$e&&$e.allocUnsafe;var We=i.Uint8Array;function Ue(e,t){var n,r,i=(n=e.buffer,r=new n.constructor(n.byteLength),new We(r).set(new We(n)),r);return new e.constructor(i,e.byteOffset,e.length)}var Ke=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e},Ge=function(){return i.Date.now()},Je=Math.max,Ye=Math.min;function Xe(e,t,n){var r,i,o,s,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,o=i;return r=i=void 0,c=t,s=e.apply(o,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=o}function m(){var e=Ge();if(f(e))return g(e);a=setTimeout(m,function(e){var n=t-(e-l);return u?Ye(n,o-(e-c)):n}(e))}function g(e){return a=void 0,d&&r?p(e):(r=i=void 0,s)}function v(){var e=Ge(),n=f(e);if(r=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(m,t),h?p(e):s}(l);if(u)return clearTimeout(a),a=setTimeout(m,t),p(l)}return void 0===a&&(a=setTimeout(m,t)),s}return t=S(t)||0,y(n)&&(h=!!n.leading,o=(u="maxWait"in n)?Je(S(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=i=a=void 0},v.flush=function(){return void 0===a?s:g(Ge())},v}function Ze(e,t,n){(void 0!==n&&!Y(e[t],n)||void 0===n&&!(t in e))&&J(e,t,n)}function Qe(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function et(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var s=t[i],a=void 0;void 0===a&&(a=e[s]),r?J(n,s,a):Z(n,s,a)}return n}(e,Ce(e))}function tt(e,t,n,r,i,o,s){var a=Qe(e,n),l=Qe(t,n),c=s.get(l);if(c)Ze(e,n,c);else{var h,u=o?o(a,l,n+"",e,t,s):void 0,m=void 0===u;if(m){var g=f(l),v=!g&&pe(l),w=!g&&!v&&be(l);u=l,g||v||w?f(a)?u=a:p(h=a)&&ne(h)?u=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(a):v?(m=!1,u=function(e){return e.slice()}(l)):w?(m=!1,u=Ue(l)):u=[]:function(e){if(!p(e)||"[object Object]"!=d(e))return!1;var t=Re(e);if(null===t)return!0;var n=Ve.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ze.call(n)==Fe}(l)||ce(l)?(u=a,ce(a)?u=et(a):y(a)&&!M(a)||(u=function(e){return"function"!=typeof e.constructor||ie(e)?{}:z(Re(e))}(l))):m=!1}m&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),Ze(e,n,u)}}function nt(e,t,n,r,i){e!==t&&Ke(t,function(o,s){if(i||(i=new He),y(o))tt(e,t,s,n,nt,r,i);else{var a=r?r(Qe(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),Ze(e,s,a)}},Ce)}function rt(e,t,n,r,i,o){return y(e)&&y(t)&&(o.set(t,e),nt(e,t,void 0,rt,o),o.delete(t)),e}var it,ot=(it=function(e,t,n,r){nt(e,t,n,r)},ee(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=it.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!y(n))return!1;var r=typeof t;return!!("number"==r?ne(n)&&G(t,n.length):"string"==r&&t in n)&&Y(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var s=t[n];s&&it(e,s,n,i)}return e})),st=ee(function(e){return e.push(void 0,rt),V(ot,void 0,e)});function at(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return y(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Xe(e,t,{leading:r,maxWait:t,trailing:i})}const lt=1024;let ct=0,ht=class{constructor(e,t){this.from=e,this.to=t}};class ut{constructor(e={}){this.id=ct++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=ft.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}ut.closedBy=new ut({deserialize:e=>e.split(" ")}),ut.openedBy=new ut({deserialize:e=>e.split(" ")}),ut.group=new ut({deserialize:e=>e.split(" ")}),ut.isolate=new ut({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),ut.contextHash=new ut({perNode:!0}),ut.lookAhead=new ut({perNode:!0}),ut.mounted=new ut({perNode:!0});class dt{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ut.mounted.id]}}const pt=Object.create(null);let ft=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):pt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new e(t.name||"",n,t.id,r);if(t.props)for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[e[0].id]=e[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(ut.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(ut.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};ft.none=new ft("",Object.create(null),0,8);class mt{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new ft(n.name,r,n.id,n.flags):n)}return new mt(t)}}const gt=new WeakMap,vt=new WeakMap;var yt;exports.IterMode=void 0,(yt=exports.IterMode||(exports.IterMode={}))[yt.ExcludeBuffers=1]="ExcludeBuffers",yt[yt.IncludeAnonymous=2]="IncludeAnonymous",yt[yt.IgnoreMounts=4]="IgnoreMounts",yt[yt.IgnoreOverlays=8]="IgnoreOverlays";class wt{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=dt.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new It(this.topNode,e)}cursorAt(e,t=0,n=0){let r=gt.get(this)||this.topNode,i=new It(r);return i.moveTo(e,t),gt.set(this,i._tree),i}get topNode(){return new Mt(this,0,0,null)}resolve(e,t=0){let n=St(gt.get(this)||this.topNode,e,t,!1);return gt.set(this,n),n}resolveInner(e,t=0){let n=St(vt.get(this)||this.topNode,e,t,!0);return vt.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Mt?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=dt.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new Mt(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(St(s,t,n,!1))}}return i?Et(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&exports.IterMode.IncludeAnonymous)>0;for(let e=this.cursor(o|exports.IterMode.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Lt(ft.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new wt(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new wt(ft.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=lt,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new bt(n,n.length):n,l=r.types,c=0,h=0;function u(e,t,n,y,w,b){let{id:x,start:k,end:S,size:C}=a,M=h,T=c;if(C<0){if(a.next(),-1==C){let t=o[x];return n.push(t),void y.push(k-e)}if(-3==C)return void(c=x);if(-4==C)return void(h=x);throw new RangeError(`Unrecognized record size: ${C}`)}let A,O,N=l[x],E=k-e;if(S-k<=i&&(O=g(a.pos-t,w))){let t=new Uint16Array(O.size-O.skip),n=a.pos-O.size,i=t.length;for(;a.pos>n;)i=v(O.start,t,i);A=new xt(t,S-O.start,r),E=O.start-e}else{let e=a.pos-C;a.next();let t=[],n=[],r=x>=s?x:-1,o=0,l=S;for(;a.pos>e;)r>=0&&a.id==r&&a.size>=0?(a.end<=l-i&&(f(t,n,k,o,a.end,l,r,M,T),o=t.length,l=a.end),a.next()):b>2500?d(k,e,t,n):u(k,e,t,n,r,b+1);if(r>=0&&o>0&&o<t.length&&f(t,n,k,o,k,l,r,M,T),t.reverse(),n.reverse(),r>-1&&o>0){let e=p(N,T);A=Lt(N,t,n,0,t.length,0,S-k,e,e)}else A=m(N,t,n,S-k,M-S,T)}n.push(A),y.push(E)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-i),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new xt(t,s[2]-i,r)),o.push(i-e)}}function p(e,t){return(n,r,i)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof wt){if(!l&&o.type==e&&o.length==i)return o;(s=o.prop(ut.lookAhead))&&(a=r[l]+o.length+s)}return m(e,n,r,i,a,t)}}function f(e,t,n,i,o,s,a,l,c){let h=[],u=[];for(;e.length>i;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(m(r.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function m(e,t,n,r,i,o,s){if(o){let e=[ut.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[ut.lookAhead,i];s=s?[e].concat(s):[e]}return new wt(e,t,n,r,s)}function g(e,t){let n=a.fork(),r=0,o=0,l=0,c=n.end-i,h={size:0,start:0,skip:0};e:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){h.size=r,h.start=o,h.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<c)break;let u=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,r+=e,l+=u}return(t<0||r==e)&&(h.size=r,h.start=o,h.skip=l),h.size>4?h:void 0}function v(e,t,n){let{id:r,start:i,end:o,size:l}=a;if(a.next(),l>=0&&r<s){let s=n;if(l>4){let r=a.pos-(l-4);for(;a.pos>r;)n=v(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==l?c=r:-4==l&&(h=r);return n}let y=[],w=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,y,w,-1,0);let b=null!==(t=e.length)&&void 0!==t?t:y.length?w[0]+y[0].length:0;return new wt(l[e.topID],y.reverse(),w.reverse(),b)}(e)}}wt.empty=new wt(ft.none,[],[],0);class bt{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new bt(this.buffer,this.index)}}class xt{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return ft.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&!(kt(i,r,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new xt(i,o,this.set)}}function kt(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function St(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof Mt&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:exports.IterMode.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;r=s,s=r.parent)r instanceof Mt&&r.index<0&&(null===(i=s.enter(t,n,o))||void 0===i?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class Ct{cursor(e=0){return new It(this,e)}getChild(e,t=null,n=null){let r=Tt(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Tt(this,e,t,n)}resolve(e,t=0){return St(this,e,t,!1)}resolveInner(e,t=0){return St(this,e,t,!0)}matchContext(e){return At(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class Mt extends Ct{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,i=0){for(let o=this;;){for(let{children:s,positions:a}=o._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+o.from;if(kt(r,n,c,c+l.length))if(l instanceof xt){if(i&exports.IterMode.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,r);if(s>-1)return new Nt(new Ot(o,l,e,c),null,s)}else if(i&exports.IterMode.IncludeAnonymous||!l.type.isAnonymous||_t(l)){let s;if(!(i&exports.IterMode.IgnoreMounts)&&(s=dt.get(l))&&!s.overlay)return new Mt(s.tree,c,e,o);let a=new Mt(l,c,e,o);return i&exports.IterMode.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,r)}}if(i&exports.IterMode.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&exports.IterMode.IgnoreOverlays)&&(r=dt.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:e,to:i}of r.overlay)if((t>0?e<=n:e<n)&&(t<0?i>=n:i>n))return new Mt(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Tt(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function At(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class Ot{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class Nt extends Ct{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new Nt(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&exports.IterMode.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new Nt(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Nt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Nt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new wt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Et(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof Mt&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Dt(i,n)}class Dt{constructor(e,t){this.heads=e,this.node=t}get next(){return Et(this.heads)}}class It{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Mt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof Mt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&exports.IterMode.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&exports.IterMode.IncludeAnonymous||e instanceof xt||!e.type.isAnonymous||_t(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new Nt(this.buffer,t,this.stack[e]);return this.bufferNode=new Nt(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return At(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return At(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function _t(e){return e.children.some(e=>e instanceof xt||!e.type.isAnonymous||_t(e))}const Pt=new WeakMap;function Rt(e,t){if(!e.isAnonymous||t instanceof xt||t.type!=e)return 1;let n=Pt.get(t);if(null==n){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof wt)){n=1;break}n+=Rt(e,r)}Pt.set(t,n)}return n}function Lt(e,t,n,r,i,o,s,a,l){let c=0;for(let n=r;n<i;n++)c+=Rt(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,r,i,s,a){for(let c=i;c<s;){let i=c,p=r[c],f=Rt(e,n[c]);for(c++;c<s;c++){let t=Rt(e,n[c]);if(f+t>=h)break;f+=t}if(c==i+1){if(f>h){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}u.push(n[i])}else{let t=r[c-1]+n[c-1].length-p;u.push(Lt(e,n,r,i,c,p,t,null,l))}d.push(p+a-o)}}(t,n,r,i,0),(a||l)(u,d,s)}class Bt{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new Bt(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let t=o;if(a>=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Bt(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&r.push(t),o.to>h)break;o=i<e.length?e[i++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return r}}let zt=class{startParse(e,t,n){return"string"==typeof e&&(e=new Vt(e)),n=n?n.length?n.map(e=>new ht(e.from,e.to)):[new ht(0,0)]:[new ht(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}};class Vt{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}class Ft{constructor(e,t,n,r,i){this.parser=e,this.parse=t,this.overlay=n,this.target=r,this.from=i}}function Ht(e){if(!e.length||e.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class qt{constructor(e,t,n,r,i,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}}const jt=new ut({perNode:!0});class $t{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new wt(e.type,e.children,e.positions,e.length,e.propValues.concat([[jt,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[ut.mounted.id]=new dt(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Jt(this.fragments),t=null,n=null,r=new It(new Mt(this.baseTree,this.ranges[0].from,0,null),exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts);e:for(let i,o;;){let s,a=!0;if(null!=this.stoppedAt&&r.from>=this.stoppedAt)a=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,o=n.to+e.pos;i>=r.from&&o<=r.to&&!t.ranges.some(e=>e.from<o&&e.to>i)&&t.ranges.push({from:i,to:o})}}a=!1}else if(n&&(o=Wt(n.ranges,r.from,r.to)))a=2!=o;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(Kt(r),t&&t.depth++,n&&n.depth++);let o=e.findMounts(r.from,i.parser);if("function"==typeof i.overlay)t=new qt(i.parser,i.overlay,o,this.inner.length,r.from,r.tree,t);else{let e=Yt(this.ranges,i.overlay||(r.from<r.to?[new ht(r.from,r.to)]:[]));e.length&&Ht(e),!e.length&&i.overlay||this.inner.push(new Ft(i.parser,e.length?i.parser.startParse(this.input,Zt(o,e),e):i.parser.startParse(""),i.overlay?i.overlay.map(e=>new ht(e.from-r.from,e.to-r.from)):null,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):a=!1}}else if(t&&(s=t.predicate(r))&&(!0===s&&(s=new ht(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(a&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&! --t.depth){let e=Yt(this.ranges,t.ranges);e.length&&(Ht(e),this.inner.splice(t.index,0,new Ft(t.parser,t.parser.startParse(this.input,Zt(t.mounts,e),e),t.ranges.map(e=>new ht(e.from-t.start,e.to-t.start)),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function Wt(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function Ut(e,t,n,r,i,o){if(t<n){let s=e.buffer[t+1];r.push(e.slice(t,n,s)),i.push(s-o)}}function Kt(e){let{node:t}=e,n=[],r=t.context.buffer;do{n.push(e.index),e.parent()}while(!e.tree);let i=e.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];i.children[o]=function e(r,i,o,c,h,u){let d=n[u],p=[],f=[];Ut(s,r,d,p,f,c);let m=a[d+1],g=a[d+2];l.push(p.length);let v=u?e(d+4,a[d+3],s.set.types[a[d]],m,g-m,u-1):t.toTree();return p.push(v),f.push(m-c),Ut(s,a[d+3],i,p,f,c),new wt(o,p,f,h)}(0,a.length,ft.none,0,s.length,n.length-1);for(let t of l){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new Mt(n,r+e.from,t,e._tree))}}class Gt{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,exports.IterMode.IgnoreOverlays|exports.IterMode.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof wt))break;t=t.children[0]}return!1}}class Jt{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(jt))&&void 0!==t?t:n.to,this.inner=new Gt(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(jt))&&void 0!==e?e:t.to,this.inner=new Gt(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let i=null===(n=e.tree)||void 0===n?void 0:n.prop(ut.mounted);if(i&&i.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let n=this.fragments[t];if(n.from>=e.to)break;n.tree==this.curFrag.tree&&r.push({frag:n,pos:e.from-n.offset,mount:i})}}}return r}}function Yt(e,t){let n=null,r=t;for(let i=1,o=0;i<e.length;i++){let s=e[i-1].to,a=e[i].from;for(;o<r.length;o++){let e=r[o];if(e.from>=a)break;e.to<=s||(n||(r=n=t.slice()),e.from<s?(n[o]=new ht(e.from,s),e.to>a&&n.splice(o+1,0,new ht(a,e.to))):e.to>a?n[o--]=new ht(a,e.to):n.splice(o--,1))}}return r}function Xt(e,t,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let h=i==e.length?1e9:s?e[i].to:e[i].from,u=o==t.length?1e9:a?t[o].to:t[o].from;if(s!=a){let e=Math.max(l,n),t=Math.min(h,u,r);e<t&&c.push(new ht(e,t))}if(l=Math.min(h,u),1e9==l)break;h==l&&(s?(s=!1,i++):s=!0),u==l&&(a?(a=!1,o++):a=!0)}return c}function Zt(e,t){let n=[];for(let{pos:r,mount:i,frag:o}of e){let e=r+(i.overlay?i.overlay[0].from:0),s=e+i.tree.length,a=Math.max(o.from,e),l=Math.min(o.to,s);if(i.overlay){let s=i.overlay.map(e=>new ht(e.from+r,e.to+r)),c=Xt(t,s,a,l);for(let t=0,r=a;;t++){let s=t==c.length,a=s?l:c[t].from;if(a>r&&n.push(new Bt(r,a,i.tree,-e,o.from>=r||o.openStart,o.to<=a||o.openEnd)),s)break;r=c[t].to}}else n.push(new Bt(a,l,i.tree,-e,o.from>=e||o.openStart,o.to<=s||o.openEnd))}return n}let Qt=[],en=[];function tn(e){if(e<768)return!1;for(let t=0,n=Qt.length;;){let r=t+n>>1;if(e<Qt[r])n=r;else{if(!(e>=en[r]))return!0;t=r+1}if(t==n)return!1}}function nn(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?en:Qt).push(n+=e[t])})();function rn(e,t,n=!0,r=!0){return(n?on:sn)(e,t,r)}function on(e,t,n){if(t==e.length)return t;t&&ln(e.charCodeAt(t))&&cn(e.charCodeAt(t-1))&&t--;let r=an(e,t);for(t+=hn(r);t<e.length;){let i=an(e,t);if(8205==r||8205==i||n&&tn(i))t+=hn(i),r=i;else{if(!nn(i))break;{let n=0,r=t-2;for(;r>=0&&nn(an(e,r));)n++,r-=2;if(n%2==0)break;t+=2}}}return t}function sn(e,t,n){for(;t>0;){let r=on(e,t-2,n);if(r<t)return r;t--}return 0}function an(e,t){let n=e.charCodeAt(t);if(!cn(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ln(r)?r-56320+(n-55296<<10)+65536:n}function ln(e){return e>=56320&&e<57344}function cn(e){return e>=55296&&e<56320}function hn(e){return e<65536?1:2}let un=class e{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=bn(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),pn.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=bn(this,e,t);let n=[];return this.decompose(e,t,n,0),pn.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),i=new gn(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new vn(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new yn(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new dn(t):pn.from(dn.split(t,[])):e.empty}};class dn extends un{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new wn(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new dn(mn(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=fn(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new dn(t,e.length+i.length));else{let e=t.length>>1;n.push(new dn(t.slice(0,e)),new dn(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof dn))return super.replace(e,t,n);[e,t]=bn(this,e,t);let r=fn(this.text,fn(n.text,mn(this.text,0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new dn(r,i):pn.from(dn.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=bn(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new dn(n,r)),n=[],r=-1);return r>-1&&t.push(new dn(n,r)),t}}let pn=class e extends un{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(t,n,r){if([t,n]=bn(this,t,n),r.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(t>=o&&n<=a){let l=s.replace(t-o,n-o,r),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let o=this.children.slice();return o[i]=l,new e(o,this.length-(n-t)+r.length)}return super.replace(o,a,l)}o=a+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n="\n"){[e,t]=bn(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,o,s,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,o+=n){if(i==s||o==a)return r;let e=this.children[i],l=t.children[o];if(e!=l)return r+e.scanIdentical(l,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new dn(e,n)}let i=Math.max(32,r>>5),o=i<<1,s=i>>1,a=[],l=0,c=-1,h=[];function u(t){let n;if(t.lines>o&&t instanceof e)for(let e of t.children)u(e);else t.lines>s&&(l>s||!l)?(d(),a.push(t)):t instanceof dn&&l&&(n=h[h.length-1])instanceof dn&&t.lines+n.lines<=32?(l+=t.lines,c+=t.length+1,h[h.length-1]=new dn(n.text.concat(t.text),n.length+1+t.length)):(l+t.lines>i&&d(),l+=t.lines,c+=t.length+1,h.push(t))}function d(){0!=l&&(a.push(1==h.length?h[0]:e.from(h,c)),c=-1,l=h.length=0)}for(let e of t)u(e);return d(),1==a.length?a[0]:new e(a,n)}};function fn(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}function mn(e,t,n){return fn(e,[""],t,n)}un.empty=new dn([""],0);class gn{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof dn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof dn?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof dn){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof dn?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class vn{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new gn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class yn{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(un.prototype[Symbol.iterator]=function(){return this.iter()},gn.prototype[Symbol.iterator]=vn.prototype[Symbol.iterator]=yn.prototype[Symbol.iterator]=function(){return this});class wn{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function bn(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function xn(e,t,n=!0,r=!0){return rn(e,t,n,r)}function kn(e,t){let n=e.charCodeAt(t);if(!function(e){return e>=55296&&e<56320}(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function Sn(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Cn(e){return e<65536?1:2}const Mn=/\r\n?|\n/;var Tn=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Tn||(Tn={}));class An{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){Dn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new An(e)}composeDesc(e){return this.empty?e:e.empty?this:_n(this,e)}mapDesc(e,t=!1){return e.empty?this:In(this,e,t)}mapPos(e,t=-1,n=Tn.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=Tn.Simple&&l>=e&&(n==Tn.TrackDel&&r<e&&l>e||n==Tn.TrackBefore&&r<e||n==Tn.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=r+this.sections[n++];if(this.sections[n++]>=0&&r<=t&&i>=e)return!(r<e&&i>t)||"cover";r=i}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new An(e)}static create(e){return new An(e)}}class On extends An{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Dn(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return In(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(un.empty);n.push(o?e.slice(i,i+o):un.empty)}i+=o}return new On(t,n)}compose(e){return this.empty?e:e.empty?this:_n(this,e,!0)}map(e,t=!1){return e.empty?this:In(this,e,t,!0)}iterChanges(e,t=!1){Dn(this,e,t)}get desc(){return An.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new Pn(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-s);Nn(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;Nn(t,e,o),o>0&&En(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break e;let e=Math.min(i.len,l-s);Nn(t,e,-1),Nn(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new On(t,n),filtered:An.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;o<t&&Nn(r,t-o,-1);let n=new On(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof On){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?un.of(c.split(n||Mn)):c:un.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&Nn(r,e-o,-1),Nn(r,s-e,u),En(i,r,h),o=s}}(e),a(!s),s}static empty(e){return new On(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else{if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(un.empty);n[r]=un.of(i.slice(1)),t.push(i[0],n[r].length)}}}return new On(t,n)}static createSet(e,t){return new On(e,t)}}function Nn(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function En(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(un.empty);e.push(n)}}function Dn(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,h=o,u=un.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,c,o,h,u),i=c,o=h}}}function In(e,t,n,r=!1){let i=[],o=r?[]:null,s=new Pn(e),a=new Pn(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Nn(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(Nn(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Nn(i,0,s.ins),o&&En(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?On.createSet(i,o):An.create(i);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}Nn(i,t,e<s.i?s.ins:0),o&&e<s.i&&En(o,i,s.text),e=s.i,s.forward(s.len-n)}}}}function _n(e,t,n=!1){let r=[],i=n?[]:null,o=new Pn(e),s=new Pn(t);for(let e=!1;;){if(o.done&&s.done)return i?On.createSet(r,i):An.create(r);if(0==o.ins)Nn(r,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Nn(r,t,n,e),i&&n&&En(i,r,s.text)}else-1==s.ins?(Nn(r,o.off?0:o.len,t,e),i&&En(i,r,o.textBit(t))):(Nn(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&En(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}}else Nn(r,0,s.ins,e),i&&En(i,r,s.text),s.next()}}class Pn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?un.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?un.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let Rn=class e{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Ln.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Ln.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Ln.range(e.anchor,e.head)}static create(t,n,r){return new e(t,n,r)}};class Ln{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Ln.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Ln([this.main],0)}addRange(e,t=!0){return Ln.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Ln.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ln(e.ranges.map(e=>Rn.fromJSON(e)),e.main)}static single(e,t=e){return new Ln([Ln.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return Ln.normalized(e.slice(),t);n=i.to}return new Ln(e,t)}static cursor(e,t=0,n,r){return Rn.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}static range(e,t,n,r){let i=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return t<e?Rn.create(t,e,48|i):Rn.create(e,t,(t>e?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?Ln.range(s,o):Ln.range(o,s))}}return new Ln(e,t)}}function Bn(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let zn=0;class Vn{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=zn++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new Vn(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Fn),!!e.static,e.enables)}of(e){return new Hn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hn(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function Fn(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Hn{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=zn++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||jn(e,c)){let t=n(e);if(s?!qn(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=ir(t,l);if(this.dependencies.every(n=>n instanceof Vn?t.facet(n)===e.facet(n):!(n instanceof Un)||t.field(n,!1)==e.field(n,!1))||(s?qn(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function qn(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function jn(e,t){let n=!1;for(let r of t)1&rr(e,r)&&(n=!0);return n}function $n(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<r.length;t++){let o=ir(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)rr(e,t);return e.values[s]=a(e),1},update(e,n){if(!jn(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=jn(e,r),l=i.config.facets[t.id],c=i.facet(t);if(l&&!o&&Fn(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const Wn=Vn.define({static:!0});class Un{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new Un(zn++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Wn).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r,i=e.facet(Wn),o=n.facet(Wn);return(r=i.find(e=>e.field==this))&&r!=o.find(e=>e.field==this)?(e.values[t]=r.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,Wn.of({field:this,create:e})]}get extension(){return this}}const Kn=4,Gn=3,Jn=2,Yn=1;function Xn(e){return t=>new Qn(t,e)}const Zn={highest:Xn(0),high:Xn(Yn),default:Xn(Jn),low:Xn(Gn),lowest:Xn(Kn)};class Qn{constructor(e,t){this.inner=e,this.prec=t}}class er{of(e){return new tr(this,e)}reconfigure(e){return er.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class tr{constructor(e,t){this.compartment=e,this.inner=t}}let nr=class e{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],o=Object.create(null),s=new Map;for(let e of function(e,t,n){let r=[[],[],[],[],[]],i=new Map;function o(e,s){let a=i.get(e);if(null!=a){if(a<=s)return;let t=r[a].indexOf(e);t>-1&&r[a].splice(t,1),e instanceof tr&&n.delete(e.compartment)}if(i.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof tr){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),o(r,s)}else if(e instanceof Qn)o(e.inner,e.prec);else if(e instanceof Un)r[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof Hn)r[s].push(e),e.facet.extensions&&o(e.facet.extensions,Jn);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(t,s)}}return o(e,Jn),r.reduce((e,t)=>e.concat(t))}(t,n,s))e instanceof Un?i.push(e):(o[e.facet.id]||(o[e.facet.id]=[])).push(e);let a=Object.create(null),l=[],c=[];for(let e of i)a[e.id]=c.length<<1,c.push(t=>e.slot(t));let h=null==r?void 0:r.config.facets;for(let e in o){let t=o[e],n=t[0].facet,i=h&&h[e]||[];if(t.every(e=>0==e.type))if(a[n.id]=l.length<<1|1,Fn(i,t))l.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));l.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}else{for(let e of t)0==e.type?(a[e.id]=l.length<<1|1,l.push(e.value)):(a[e.id]=c.length<<1,c.push(t=>e.dynamicSlot(t)));a[n.id]=c.length<<1,c.push(e=>$n(e,n,t))}}let u=c.map(e=>e(a));return new e(t,s,u,a,l,o)}};function rr(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function ir(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const or=Vn.define(),sr=Vn.define({combine:e=>e.some(e=>e),static:!0}),ar=Vn.define({combine:e=>e.length?e[0]:void 0,static:!0}),lr=Vn.define(),cr=Vn.define(),hr=Vn.define(),ur=Vn.define({combine:e=>!!e.length&&e[0]});class dr{constructor(e,t){this.type=e,this.value=t}static define(){return new pr}}class pr{of(e){return new dr(this,e)}}class fr{constructor(e){this.map=e}of(e){return new mr(this,e)}}class mr{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new mr(this.type,t)}is(e){return this.type==e}static define(e={}){return new fr(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}mr.reconfigure=mr.define(),mr.appendConfig=mr.define();let gr=class e{constructor(t,n,r,i,o,s){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&Bn(r,n.newLength),o.some(t=>t.type==e.time)||(this.annotations=o.concat(e.time.of(Date.now())))}static create(t,n,r,i,o,s){return new e(t,n,r,i,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!(!n||!(n==t||n.length>t.length&&n.slice(0,t.length)==t&&"."==n[t.length]))}};function vr(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function yr(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=On.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null===(r=e.selection)||void 0===r?void 0:r.map(i),effects:mr.mapEffects(e.effects,i).concat(mr.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function wr(e,t,n){let r=t.selection,i=kr(t.annotations);return t.userEvent&&(i=i.concat(gr.userEvent.of(t.userEvent))),{changes:t.changes instanceof On?t.changes:On.of(t.changes||[],n,e.facet(ar)),selection:r&&(r instanceof Ln?r:Ln.single(r.anchor,r.head)),effects:kr(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function br(e,t,n){let r=wr(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let i=1;i<t.length;i++){!1===t[i].filter&&(n=!1);let o=!!t[i].sequential;r=yr(r,wr(e,t[i],o?r.changes.newLength:e.doc.length),o)}let i=gr.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return function(e){let t=e.startState,n=t.facet(hr),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=yr(r,wr(t,o,e.changes.newLength),!0))}return r==e?e:gr.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let r of t.facet(lr)){let t=r(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:vr(n,t))}if(!0!==n){let r,i;if(!1===n)i=e.changes.invertedDesc,r=On.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=gr.create(t,r,e.selection&&e.selection.map(i),mr.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(cr);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof gr?i:Array.isArray(i)&&1==i.length&&i[0]instanceof gr?i[0]:br(t,kr(i),!1)}return e}(i):i)}gr.time=dr.define(),gr.userEvent=dr.define(),gr.addToHistory=dr.define(),gr.remote=dr.define();const xr=[];function kr(e){return null==e?xr:Array.isArray(e)?e:[e]}var Sr=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Sr||(Sr={}));const Cr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Mr;try{Mr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function Tr(e){return t=>{if(!/\S/.test(t))return Sr.Space;if(function(e){if(Mr)return Mr.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||Cr.test(n)))return!0}return!1}(t))return Sr.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Sr.Word;return Sr.Other}}let Ar=class e{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)rr(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return rr(this,n),ir(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return br(this,e,!0)}applyTransaction(t){let n,r=this.config,{base:i,compartments:o}=r;for(let e of t.effects)e.is(er.reconfigure)?(r&&(o=new Map,r.compartments.forEach((e,t)=>o.set(t,e)),r=null),o.set(e.value.compartment,e.value.extension)):e.is(mr.reconfigure)?(r=null,i=e.value):e.is(mr.appendConfig)&&(r=null,i=kr(i).concat(e.value));if(r)n=t.startState.values.slice();else{r=nr.resolve(i,o,this),n=new e(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values}let s=t.startState.facet(sr)?t.newSelection:t.newSelection.asSingle();new e(r,t.newDoc,s,n,(e,n)=>n.update(e,t),t)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Ln.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=kr(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let c=r.mapDesc(a,!0);i.push(s.range.map(c)),r=r.compose(l),o=mr.mapEffects(o,l).concat(mr.mapEffects(kr(s.effects),c))}return{changes:r,selection:Ln.create(i,t.mainIndex),effects:o}}changes(t=[]){return t instanceof On?t:On.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return un.of(t.split(this.facet(e.lineSeparator)||Mn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(rr(this,t),ir(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Un&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r)for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],o=t[e];i.push(n.init(e=>n.spec.fromJSON(o,e)))}return e.create({doc:t.doc,selection:Ln.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=nr.resolve(t.extensions||[],new Map),r=t.doc instanceof un?t.doc:un.of((t.doc||"").split(n.staticFacet(e.lineSeparator)||Mn)),i=t.selection?t.selection instanceof Ln?t.selection:Ln.single(t.selection.anchor,t.selection.head):Ln.single(0);return Bn(i,r.length),n.staticFacet(sr)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||"\n"}get readOnly(){return this.facet(ur)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if("$"==t)return"$";let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(or))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return Tr(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=xn(t,o,!1);if(i(t.slice(e,o))!=Sr.Word)break;o=e}for(;s<r;){let e=xn(t,s);if(i(t.slice(s,e))!=Sr.Word)break;s=e}return o==s?null:Ln.range(o+n,s+n)}};function Or(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);r[e]=n[e](o,i)}}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}Ar.allowMultipleSelections=sr,Ar.tabSize=Vn.define({combine:e=>e.length?e[0]:4}),Ar.lineSeparator=ar,Ar.readOnly=ur,Ar.phrases=Vn.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),Ar.languageData=or,Ar.changeFilter=lr,Ar.transactionFilter=cr,Ar.transactionExtender=hr,er.reconfigure=mr.define();class Nr{eq(e){return this==e}range(e,t=e){return Er.create(e,t,this)}}Nr.prototype.startSide=Nr.prototype.endSide=0,Nr.prototype.point=!1,Nr.prototype.mapMode=Tn.TrackDel;class Er{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Er(e,t,n)}}function Dr(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Ir{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),r.push(l-o),i.push(c-o))}return{mapped:n.length?new Ir(r,i,n,s):null,pos:o}}}class _r{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new _r(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(Dr)),this.isEmpty)return t.length?_r.of(t):this;let s=new Lr(this,null,-1).goto(0),a=0,l=[],c=new Pr;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(Er.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?_r.empty:this.nextLayer.update({add:l,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new _r(n,t,i||_r.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Br.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Br.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=Rr(o,s,n),l=new Vr(o,a,i),c=new Vr(s,a,i);n.iterGaps((e,t,n)=>Fr(l,e,c,t,n,r)),n.empty&&0==n.length&&Fr(l,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),o=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let s=Rr(i,o),a=new Vr(i,s,0).goto(n),l=new Vr(o,s,0).goto(n);for(;;){if(a.to!=l.to||!Hr(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new Vr(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Pr;for(let r of e instanceof Er?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Dr(t,r)>0)return e.slice().sort(Dr);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return _r.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=_r.empty;r=r.nextLayer)t=new _r(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}_r.empty=new _r([],[],null,-1),_r.empty.nextLayer=_r.empty;class Pr{finishChunk(e){this.chunks.push(new Ir(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Pr)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(_r.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=_r.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Rr(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class Lr{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Br{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new Lr(o,t,n,i));return 1==r.length?r[0]:new Br(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)zr(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)zr(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),zr(this.heap,0)}}}function zr(e,t){for(let n=e[t];;){let r=1+(t<<1);if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class Vr{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Br.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){qr(this.active,e),qr(this.activeTo,e),qr(this.activeRank,e),this.minActive=$r(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;jr(this.active,t,n),jr(this.activeTo,t,r),jr(this.activeRank,t,i),e&&jr(e,t,this.cursor.from),this.minActive=$r(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&qr(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Fr(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t;for(;;){let t=e.to+l-n.to,r=t||e.endSide-n.endSide,i=r<0?e.to+l:n.to,c=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Hr(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,c,e.point,n.point):c>a&&!Hr(e.active,n.active)&&o.compareRange(a,c,e.active,n.active),i>s)break;(t||e.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(i),a=i,r<=0&&e.next(),r>=0&&n.next()}}function Hr(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function qr(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function jr(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function $r(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function Wr(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=xn(e,i));return r}function Ur(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=xn(e,r)}return!0===r?-1:e.length}const Kr="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Gr="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Jr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Yr{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");i(r(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Jr[Kr]||1;return Jr[Kr]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[Gr],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Zr(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let Xr=new Map;class Zr{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Xr.get(n);if(t)return e[Gr]=t;this.sheet=new r.CSSStyleSheet,Xr.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Gr]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Qr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ei={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ti="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ni="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ri=0;ri<10;ri++)Qr[48+ri]=Qr[96+ri]=String(ri);for(ri=1;ri<=24;ri++)Qr[ri+111]="F"+ri;for(ri=65;ri<=90;ri++)Qr[ri]=String.fromCharCode(ri+32),ei[ri]=String.fromCharCode(ri);for(var ii in Qr)ei.hasOwnProperty(ii)||(ei[ii]=Qr[ii]);function oi(e){var t=!(ti&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ni&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?ei:Qr)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}function si(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)ai(e,arguments[t]);return e}function ai(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)ai(e,t[n])}}let li="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},ci="undefined"!=typeof document?document:{documentElement:{style:{}}};const hi=/Edge\/(\d+)/.exec(li.userAgent),ui=/MSIE \d/.test(li.userAgent),di=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(li.userAgent),pi=!!(ui||di||hi),fi=!pi&&/gecko\/(\d+)/i.test(li.userAgent),mi=!pi&&/Chrome\/(\d+)/.exec(li.userAgent),gi="webkitFontSmoothing"in ci.documentElement.style,vi=!pi&&/Apple Computer/.test(li.vendor),yi=vi&&(/Mobile\/\w+/.test(li.userAgent)||li.maxTouchPoints>2);var wi={mac:yi||/Mac/.test(li.platform),windows:/Win/.test(li.platform),linux:/Linux|X11/.test(li.platform),ie:pi,ie_version:ui?ci.documentMode||6:di?+di[1]:hi?+hi[1]:0,gecko:fi,gecko_version:fi?+(/Firefox\/(\d+)/.exec(li.userAgent)||[0,0])[1]:0,chrome:!!mi,chrome_version:mi?+mi[1]:0,ios:yi,android:/Android\b/.test(li.userAgent),webkit_version:gi?+(/\bAppleWebKit\/(\d+)/.exec(li.userAgent)||[0,0])[1]:0,safari:vi,safari_version:vi?+(/\bVersion\/(\d+(\.\d+)?)/.exec(li.userAgent)||[0,0])[1]:0,tabSize:null!=ci.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function bi(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function xi(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function ki(e,t){if(!t.anchorNode)return!1;try{return xi(e,t.anchorNode)}catch(e){return!1}}function Si(e){return 3==e.nodeType?Li(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Ci(e,t,n,r){return!!n&&(Ai(e,t,n,r,-1)||Ai(e,t,n,r,1))}function Mi(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Ti(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Ai(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Oi(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Mi(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?Oi(e):0}}}function Oi(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ni(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Ei(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Di(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}class Ii{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Oi(t):0),n,Math.min(e.focusOffset,n?Oi(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let _i,Pi=null;function Ri(e){if(e.setActive)return e.setActive();if(Pi)return e.focus(Pi);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Pi?{get preventScroll(){return Pi={preventScroll:!0},!0}}:void 0),!Pi){Pi=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function Li(e,t,n=t){let r=_i||(_i=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function Bi(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function zi(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function Vi(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Fi(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;n=n.childNodes[r-1],r=Oi(n)}else{if(!n.parentNode||Ti(n))return null;r=Mi(n),n=n.parentNode}}}function Hi(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||Ti(n))return null;r=Mi(n)+1,n=n.parentNode}}}wi.safari&&wi.safari_version>=26&&(Pi=!1);class qi{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new qi(e.parentNode,Mi(e),t)}static after(e,t){return new qi(e.parentNode,Mi(e)+1,t)}}const ji=[];class $i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,r=this.dom,i=null;for(let o of this.children){if(7&o.flags){if(!o.dom&&(n=i?i.nextSibling:r.firstChild)){let e=$i.get(n);(!e||!e.parent&&e.canReuseDOM(o))&&o.reuseDOM(n)}o.sync(e,t),o.flags&=-8}if(n=i?i.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&n!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;n&&n!=o.dom;)n=Wi(n);else r.insertBefore(o.dom,n);i=o.dom}for(n=i?i.nextSibling:r.firstChild,n&&t&&t.node==r&&(t.written=!0);n;)n=Wi(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let r=0==Oi(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}n=r<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!$i.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let r=this.children[e];if(r.dom==n)return t;t+=r.length+r.breakAfter}}domBoundsAround(e,t,n=0){let r=-1,i=-1,o=-1,s=-1;for(let a=0,l=n,c=n;a<this.children.length;a++){let n=this.children[a],h=l+n.length;if(l<e&&h>t)return n.domBoundsAround(e,t,l);if(h>=e&&-1==r&&(r=a,i=l),l>t&&n.dom.parentNode==this.dom){o=a,s=c;break}c=h,l=h+n.breakAfter}return{from:i,to:s<0?n+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ji){this.markDirty();for(let r=e;r<t;r++){let e=this.children[r];e.parent==this&&n.indexOf(e)<0&&e.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let e=0;e<n.length;e++)n[e].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ui(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,r,i,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!(8&(this.flags|e.flags))}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}function Wi(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}$i.prototype.breakAfter=0;class Ui{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Ki(e,t,n,r,i,o,s,a,l){let{children:c}=e,h=c.length?c[t]:null,u=o.length?o[o.length-1]:null,d=u?u.breakAfter:s;if(!(t==r&&h&&!s&&!d&&o.length<2&&h.merge(n,i,o.length?u:null,0==n,a,l))){if(r<c.length){let e=c[r];e&&(i<e.length||e.breakAfter&&(null==u?void 0:u.breakAfter))?(t==r&&(e=e.split(i),i=0),!d&&u&&e.merge(0,i,u,!0,0,l)?o[o.length-1]=e:((i||e.children.length&&!e.children[0].length)&&e.merge(0,i,null,!1,0,l),o.push(e))):(null==e?void 0:e.breakAfter)&&(u?u.breakAfter=1:s=1),r++}for(h&&(h.breakAfter=s,n>0&&(!s&&o.length&&h.merge(n,h.length,o[0],!1,a,0)?h.breakAfter=o.shift().breakAfter:(n<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(n,h.length,null,!1,a,0),t++));t<r&&o.length;)if(c[r-1].become(o[o.length-1]))r--,o.pop(),l=o.length?0:a;else{if(!c[t].become(o[0]))break;t++,o.shift(),a=o.length?0:l}!o.length&&t&&r<c.length&&!c[t-1].breakAfter&&c[r].merge(0,0,c[t-1],!1,a,l)&&t--,(t<r||o.length)&&e.replaceChildren(t,r,o)}}function Gi(e,t,n,r,i,o){let s=e.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:c,off:h}=s.findPos(t,-1),u=t-n;for(let e of r)u+=e.length;e.length+=u,Ki(e,c,h,a,l,r,0,i,o)}class Ji extends $i{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Ji)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ji(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new qi(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let r=e.nodeValue.length;t>r&&(t=r);let i=t,o=t,s=0;0==t&&n<0||t==r&&n>=0?wi.chrome||wi.gecko||(t?(i--,s=1):o<r&&(o++,s=-1)):n<0?i--:o<r&&o++;let a=Li(e,i,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:n>=0)?0:a.length-1];wi.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,e=>e.width)||l);return s?Ni(l,s<0):l||null}(this.dom,e,t)}}class Yi extends $i{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(zi(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,r,i,o){return(!n||!(!(n instanceof Yi&&n.mark.eq(this.mark))||e&&i<=0||t<this.length&&o<=0))&&(Gi(this,e,t,n?n.children.slice():[],i-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,r=-1,i=0;for(let o of this.children){let s=n+o.length;s>e&&t.push(n<e?o.split(e-n):o),r<0&&n>=e&&(r=i),n=s,i++}let o=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new Yi(this.mark,t,o)}domAtPos(e){return Qi(this,e)}coordsAt(e,t){return to(this,e,t)}}class Xi extends $i{static create(e,t,n){return new Xi(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Xi.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,r,i,o){return!(n&&(!(n instanceof Xi&&this.widget.compare(n.widget))||e>0&&i<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Xi&&e.side==this.side&&this.widget.constructor==e.widget.constructor&&(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(0==this.length)return un.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,r=this.posAtStart;return n?n.slice(r,r+this.length):un.empty}domAtPos(e){return(this.length?0==e:this.side>0)?qi.before(this.dom):qi.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let r=this.dom.getClientRects(),i=null;if(!r.length)return null;let o=this.side?this.side<0:e>0;for(let t=o?r.length-1:0;i=r[t],!(e>0?0==t:t==r.length-1||i.top<i.bottom);t+=o?-1:1);return Ni(i,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Zi extends $i{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Zi&&e.side==this.side}split(){return new Zi(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?qi.before(this.dom):qi.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return un.empty}get isHidden(){return!0}}function Qi(e,t){let n=e.dom,{children:r}=e,i=0;for(let e=0;i<r.length;i++){let o=r[i],s=e+o.length;if(!(s==e&&o.getSide()<=0)){if(t>e&&t<s&&o.dom.parentNode==n)return o.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=i;e>0;e--){let t=r[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=i;e<r.length;e++){let t=r[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new qi(n,0)}function eo(e,t,n){let r,{children:i}=e;n>0&&t instanceof Yi&&i.length&&(r=i[i.length-1])instanceof Yi&&r.mark.eq(t.mark)?eo(r,t.children[0],n-1):(i.push(t),t.setParent(e)),e.length+=t.length}function to(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(t,a){for(let l=0,c=0;l<t.children.length&&c<=a;l++){let h=t.children[l],u=c+h.length;u>=a&&(h.children.length?e(h,a-c):(!o||o.isHidden&&(n>0||no(o,h)))&&(u>a||c==u&&h.getSide()>0)?(o=h,s=a-c):(c<a||c==u&&h.getSide()<0&&!h.isHidden)&&(r=h,i=a-c)),c=u}}(e,t);let a=(n<0?r:o)||r||o;return a?a.coordsAt(Math.max(0,a==r?i:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Si(t);return n[n.length-1]||null}(e)}function no(e,t){let n=e.coordsAt(0,1),r=t.coordsAt(0,1);return n&&r&&r.top<n.bottom}function ro(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}Ji.prototype.children=Xi.prototype.children=Zi.prototype.children=ji;const io=Object.create(null);function oo(e,t,n){if(e==t)return!0;e||(e=io),t||(t=io);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function so(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function ao(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}let lo=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var co=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(co||(co={}));let ho=class extends Nr{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new uo(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new fo(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:i,end:o}=mo(e,r);t=(i?r?-3e8:-1:5e8)-1,n=1+(o?r?2e8:1:-6e8)}return new fo(e,t,n,r,e.widget||null,!0)}static line(e){return new po(e)}static set(e,t=!1){return _r.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}};ho.none=_r.empty;class uo extends ho{constructor(e){let{start:t,end:n}=mo(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof uo&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&oo(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}uo.prototype.point=!1;class po extends ho{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof po&&this.spec.class==e.spec.class&&oo(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}po.prototype.mapMode=Tn.TrackBefore,po.prototype.point=!0;class fo extends ho{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?Tn.TrackBefore:Tn.TrackAfter:Tn.TrackDel}get type(){return this.startSide!=this.endSide?co.WidgetRange:this.startSide<=0?co.WidgetBefore:co.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof fo&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function mo(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function go(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}fo.prototype.point=!0;class vo extends $i{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,r,i,o){if(n){if(!(n instanceof vo))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),Gi(this,e,t,n?n.children.slice():[],i,o),!0}split(e){let t=new vo;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:r}=this.childPos(e);r&&(t.append(this.children[n].split(r),0),this.children[n].merge(r,this.children[n].length,null,!1,0,0),n++);for(let e=n;e<this.children.length;e++)t.append(this.children[e],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){oo(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){eo(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=ro(t,this.attrs||{})),n&&(this.attrs=ro({class:n},this.attrs||{}))}domAtPos(e){return Qi(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(zi(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(so(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let r=this.dom.lastChild;for(;r&&$i.get(r)instanceof Yi;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(n=$i.get(r))||void 0===n?void 0:n.isEditable)||wi.ios&&this.children.some(e=>e instanceof Ji)))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Ji)||/[^ -~]/.test(n.text))return null;let r=Si(n.dom);if(1!=r.length)return null;t+=r[0].width,e=r[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=to(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight<t){let r=(t-e.textHeight)/2;return{top:n.top+r,bottom:n.bottom-r,left:n.left,right:n.left}}}return n}become(e){return e instanceof vo&&0==this.children.length&&0==e.children.length&&oo(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,r=0;n<e.children.length;n++){let i=e.children[n],o=r+i.length;if(o>=t){if(i instanceof vo)return i;if(o>t)break}r=o+i.breakAfter}return null}}class yo extends $i{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,r,i,o){return!(n&&(!(n instanceof yo&&this.widget.compare(n.widget))||e>0&&i<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return 0==e?qi.before(this.dom):qi.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new yo(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ji}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):un.empty}domBoundsAround(){return null}become(e){return e instanceof yo&&e.widget.constructor==this.widget.constructor&&(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof wo?null:Ni(this.dom.getBoundingClientRect(),this.length?0==e:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t!=n&&(e<0?t<0:n>0)}}class wo extends lo{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class bo{constructor(e,t,n,r){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof yo&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new vo),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(xo(new Zi(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof yo||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e),i=Math.min(r,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(xo(new Ji(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=r<=i?0:t.length}}span(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}point(e,t,n,r,i,o){if(this.disallowBlockEffectsFor[o]&&n instanceof fo){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=t-e;if(n instanceof fo)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new yo(n.widget||ko.block,s,n));else{let o=Xi.create(n.widget||ko.inline,s,s?0:n.startSide),a=this.atCursorPos&&!o.isEditable&&i<=r.length&&(e<t||n.startSide>0),l=!o.isEditable&&(e<t||i>r.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(c.append(xo(new Zi(1),r),i),i=r.length+Math.max(0,i-r.length)),c.append(xo(o,r),i),this.atCursorPos=l,this.pendingBuffer=l?e<t||i>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=i)}static build(e,t,n,r,i){let o=new bo(e,t,n,i);return o.openEnd=_r.spans(r,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function xo(e,t){for(let n of t)e=new Yi(n,[e],e.length);return e}class ko extends lo{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ko.inline=new ko("span"),ko.block=new ko("div");var So=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(So||(So={}));const Co=So.LTR,Mo=So.RTL;function To(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Ao=To("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Oo=To("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),No=Object.create(null),Eo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);No[t]=n,No[n]=-t}function Do(e){return e<=247?Ao[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Oo[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const Io=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _o{get dir(){return this.level%2?Mo:Co}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function Po(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Po(r.inner,i.inner))return!1}return!0}const Ro=[];function Lo(e,t,n,r,i,o,s){let a=r%2?2:1;if(r%2==i%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=Ro[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?r:r+1,p=l;e:for(;;)if(c<o.length&&p==o[c].from){if(h)break e;let f=o[c];if(!t)for(let e=f.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(Ro[e]==a)break e;break}e=o[t++].to}if(c++,u)u.push(f);else{f.from>l&&s.push(new _o(l,f.from,d)),Bo(e,f.direction==Co!=!(d%2)?r+1:r,i,f.inner,f.from,f.to,s),l=f.to}p=f.to}else{if(p==n||(t?Ro[p]!=a:Ro[p]==a))break;p++}u?Lo(e,l,p,r+1,i,u,s):l<p&&s.push(new _o(l,p,d)),l=p}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=Ro[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?r:r+1,p=l;e:for(;;)if(c&&p==o[c-1].to){if(h)break e;let f=o[--c];if(!n)for(let e=f.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(Ro[e-1]==a)break e;break}e=o[--n].from}if(u)u.push(f);else{f.to<l&&s.push(new _o(f.to,l,d)),Bo(e,f.direction==Co!=!(d%2)?r+1:r,i,f.inner,f.from,f.to,s),l=f.from}p=f.from}else{if(p==t||(n?Ro[p-1]!=a:Ro[p-1]==a))break;p--}u?Lo(e,p,l,r+1,i,u,s):p<l&&s.push(new _o(p,l,d)),l=p}}function Bo(e,t,n,r,i,o,s){let a=t%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=Do(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),Ro[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=Ro[e];if(128==i)e<a-1&&t==Ro[e+1]&&24&t?i=Ro[e]=t:Ro[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==Ro[i];)i++;let o=e&&8==t||i<n&&8==Ro[i]?1==r?1:8:256;for(let t=e;t<i;t++)Ro[t]=o;e=i-1}else 8==i&&1==r&&(Ro[e]=1);t=i,7&i&&(r=i)}}}(e,i,o,r,a),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let c=s?r[s-1].to:t,h=s<r.length?r[s].from:n;for(let t,n,r,s=c;s<h;s++)if(n=No[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(Eo[e+1]==-n){let t=Eo[e+2],n=2&t?i:4&t?1&t?o:i:0;n&&(Ro[s]=Ro[Eo[e]]=n),a=e;break}}else{if(189==Eo.length)break;Eo[a++]=s,Eo[a++]=t,Eo[a++]=l}else if(2==(r=Ro[s])||1==r){let e=r==i;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=Eo[t+2];if(2&n)break;if(e)Eo[t+2]|=2;else{if(4&n)break;Eo[t+2]|=4}}}}}(e,i,o,r,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=Ro[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else{if(256!=Ro[s])break;s++}let c=1==o,h=c==(1==(s<t?Ro[s]:r))?c?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),Ro[--t]=h;l=s}else o=s,l++}}}(i,o,r,a),Lo(e,i,o,t,n,r,s)}function zo(e){return[new _o(0,e,0)]}let Vo="";function Fo(e,t,n,r,i){var o;let s=r.head-e.from,a=_o.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],c=l.side(i,n);if(s==c){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!i,n),c=l.side(i,n)}let h=xn(e.text,s,l.forward(i,n));(h<l.from||h>l.to)&&(h=c),Vo=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?Ln.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):Ln.cursor(h+e.from,l.forward(i,n)?-1:1,l.level)}function Ho(e,t,n){for(let r=t;r<n;r++){let t=Do(e.charCodeAt(r));if(1==t)return Co;if(2==t||4==t)return Mo}return Co}const qo=Vn.define(),jo=Vn.define(),$o=Vn.define(),Wo=Vn.define(),Uo=Vn.define(),Ko=Vn.define(),Go=Vn.define(),Jo=Vn.define(),Yo=Vn.define(),Xo=Vn.define({combine:e=>e.some(e=>e)}),Zo=Vn.define({combine:e=>e.some(e=>e)}),Qo=Vn.define();class es{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new es(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new es(Ln.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ts=mr.define({map:(e,t)=>e.map(t)}),ns=mr.define();function rs(e,t,n){let r=e.facet(Wo);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const is=Vn.define({combine:e=>!e.length||e[0]});let ss=0;const as=Vn.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class ls{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(as.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(as.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new ls(ss++,e,n,r,e=>{let t=[];return o&&t.push(ds.of(t=>{let n=t.plugin(e);return n?o(n):ho.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return ls.define((t,n)=>new e(t,n),t)}}class cs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(rs(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){rs(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){rs(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const hs=Vn.define(),us=Vn.define(),ds=Vn.define(),ps=Vn.define(),fs=Vn.define(),ms=Vn.define();function gs(e,t){let n=e.state.facet(ms);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return _r.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n,i=r[e].spec.bidiIsolate;if(null==i&&(i=Ho(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==i)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),i}const vs=Vn.define();function ys(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(vs)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}const ws=Vn.define();class bs{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new bs(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0,s=0;;r++){let a=r==e.length?null:e[r],l=o-s,c=a?a.fromB:1e9;for(;i<t.length&&t[i]<c;){let e=t[i],r=t[i+1],o=Math.max(s,e),a=Math.min(c,r);if(o<=a&&new bs(o+l,a+l,o,a).addToSet(n),r>c)break;i+=2}if(!a)return n;new bs(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,s=a.toB}}}class xs{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=On.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new bs(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new xs(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class ks extends $i{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ho.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new vo],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new bs(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)});return n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let i=r>-1?function(e,t,n){let r=Ss(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc,c=new bs(l.mapPos(o),l.mapPos(s),o,s),h=[];for(let t=i.parentNode;;t=t.parentNode){let n=$i.get(t);if(n instanceof Yi)h.push({node:t,deco:n.mark});else{if(n instanceof vo||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:i,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new uo({inclusive:!0,attributes:ao(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:r}=this.hasComposition;n=new bs(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(wi.ie||wi.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=function(e,t,n){let r=new Cs;return _r.compare(e,t,n,r),r.changes}(this.decorations,this.updateDeco(),e.changes);return n=bs.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=wi.chrome||wi.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||r.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(e=>e.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof yo&&e.widget instanceof wo&&i.push(e.dom);r.updateGaps(i)}updateChildren(e,t,n){let r=n?n.range.addToSet(e.slice()):e,i=this.childCursor(t);for(let e=r.length-1;;e--){let t=e>=0?r[e]:null;if(!t)break;let o,s,a,l,{fromA:c,toA:h,fromB:u,toB:d}=t;if(n&&n.range.fromB<d&&n.range.toB>u){let e=bo.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=bo.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);s=e.breakAtStart,a=e.openStart,l=t.openEnd;let r=this.compositionView(n);t.breakAtStart?r.breakAfter=1:t.content.length&&r.merge(r.length,r.length,t.content[0],!1,t.openStart,0)&&(r.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&r.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),o=e.content.concat(r).concat(t.content)}else({content:o,breakAtStart:s,openStart:a,openEnd:l}=bo.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:p,off:f}=i.findPos(h,1),{i:m,off:g}=i.findPos(c,-1);Ki(this,m,g,p,f,o,s,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(ns)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new Ji(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Yi(n,[t],t.length);let n=new vo;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some(e=>7&e.flags)?1:0),this.markedForComposition.add(t);let n=$i.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),r=this.children[n.i];t(e.line,r);for(let i=e.marks.length-1;i>=-1;i--)n=r.childPos(n.off,1),r=r.children[n.i],t(i>=0?e.marks[i].node:e.text,r)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,i=!r&&!(this.view.state.facet(is)||this.dom.tabIndex>-1)&&ki(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||t||i))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(s.anchor)),l=s.empty?a:this.moveToLine(this.domAtPos(s.head));if(wi.gecko&&s.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new qi(e,0),o=!0}var c;let h=this.view.observer.selectionRange;!o&&h.focusNode&&(Ci(a.node,a.offset,h.anchorNode,h.anchorOffset)&&Ci(l.node,l.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,s))||(this.view.observer.ignore(()=>{wi.android&&wi.chrome&&this.dom.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=bi(this.view.root);if(e)if(s.empty){if(wi.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?Fi:Hi)(a.node,a.offset);t&&(a=new qi(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=s.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();s.anchor>s.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new qi(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new qi(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ci(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=bi(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=vo.find(this,t.head);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(r,i)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let r=e.offset;!t&&r<n.childNodes.length;r++){let e=$i.get(n.childNodes[r]);e instanceof vo&&(t=e.domAtPos(0))}for(let r=e.offset-1;!t&&r>=0;r--){let e=$i.get(n.childNodes[r]);e instanceof vo&&(t=e.domAtPos(e.length))}return t?new qi(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=$i.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let e=this.children[t];if(n<e.length||e instanceof vo)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,r=0;for(let i=this.length,o=this.children.length-1;o>=0;o--){let s=this.children[o],a=i-s.breakAfter,l=a-s.length;if(a<e)break;if(l<=e&&(l<e||s.covers(-1))&&(a>e||s.covers(1))&&(!n||s instanceof vo&&!(n instanceof vo&&t>=0)))n=s,r=l;else if(n&&l==e&&a==e&&s instanceof yo&&Math.abs(t)<2){if(s.deco.startSide<0)break;o&&(n=null)}i=l}return n?n.coordsAt(e-r,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),r=this.children[t];if(!(r instanceof vo))return null;for(;r.children.length;){let{i:e,off:t}=r.childPos(n,1);for(;;e++){if(e==r.children.length)return null;if((r=r.children[e]).length)break}n=t}if(!(r instanceof Ji))return null;let i=xn(r.text,n);if(i==n)return null;let o=Li(r.dom,n,i).getClientRects();for(let e=0;e<o.length;e++){let t=o[e];if(e==o.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==So.LTR;for(let e=0,l=0;l<this.children.length;l++){let c=this.children[l],h=e+c.length;if(h>r)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),o){let t=c.dom.lastChild,r=t?Si(t):[];if(r.length){let t=r[r.length-1],o=a?t.right-n.left:n.right-t.left;o>s&&(s=o,this.minWidth=i,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?So.RTL:So.LTR}measureTextSize(){for(let e of this.children)if(e instanceof vo){let t=e.measureTextSize();if(t)return t}let e,t,n,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(r);let i=Si(r.firstChild)[0];e=r.getBoundingClientRect().height,t=i?i.width/27:7,n=i?i.height:e,r.remove()}),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ui(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ho.replace({widget:new wo(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return ho.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ds).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(ps).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(_r.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(Qo))try{if(t(this.view,e.range,e))return!0}catch(e){rs(this.view.state,e,"scroll handler")}let t,{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!r)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,t.left),top:Math.min(r.top,t.top),right:Math.max(r.right,t.right),bottom:Math.max(r.bottom,t.bottom)});let i=ys(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,p=1,f=1;if(d)e=Ei(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:p,scaleY:f}=Di(h,t)),e={left:t.left,right:t.left+h.clientWidth*p,top:t.top,bottom:t.top+h.clientHeight*f}}let m=0,g=0;if("nearest"==i)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/f,n=(h.scrollTop-e)*f}if(m){let t=h.scrollLeft;h.scrollLeft+=m/p,e=(h.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(r="nearest"),n&&Math.abs(n-g)<1&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==So.LTR)}lineHasWidget(e){let{i:t}=this.childCursor().findPos(e);if(t==this.children.length)return!1;let n=e=>e instanceof Xi||e.children.some(n);return n(this.children[t])}}function Ss(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Fi(n.focusNode,n.focusOffset),i=Hi(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=$i.get(i.node);if(!t||t instanceof Ji&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=$i.get(r.node);!e||e instanceof Ji&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let Cs=class{constructor(){this.changes=[]}compareRange(e,t){go(e,t,this.changes)}comparePoint(e,t){go(e,t,this.changes)}boundChange(e){go(e,e,this.changes)}};function Ms(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function Ts(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function As(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function Os(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function Ns(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Es(e,t,n){let r,i,o,s,a,l,c,h,u=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=Si(d);for(let p=0;p<e.length;p++){let f=e[p];i&&As(i,f)&&(f=Os(Ns(f,i.bottom),i.top));let m=Ms(t,f),g=Ts(n,f);if(0==m&&0==g)return 3==d.nodeType?Ds(d,t,n):Es(d,t,n);(!r||s>g||s==g&&o>m)&&(r=d,i=f,o=m,s=g,u=!m||(t<f.left?p>0:p<e.length-1)),0==m?n>f.bottom&&(!c||c.bottom<f.bottom)?(a=d,c=f):n<f.top&&(!h||h.top>f.top)&&(l=d,h=f):c&&As(c,f)?c=Ns(c,f.bottom):h&&As(h,f)&&(h=Os(h,f.top))}}if(c&&c.bottom>=n?(r=a,i=c):h&&h.top<=n&&(r=l,i=h),!r)return{node:e,offset:0};let d=Math.max(i.left,Math.min(i.right,t));return 3==r.nodeType?Ds(r,d,n):u&&"false"!=r.contentEditable?Es(r,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,r)+(t>=(i.left+i.right)/2?1:0)}}function Ds(e,t,n){let r=e.nodeValue.length,i=-1,o=1e9,s=0;for(let a=0;a<r;a++){let r=Li(e,a,a+1).getClientRects();for(let l=0;l<r.length;l++){let c=r[l];if(c.top==c.bottom)continue;s||(s=t-c.left);let h=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h<o){let n=t>=(c.left+c.right)/2,r=n;if(wi.chrome||wi.gecko){let t=Li(e,a).getBoundingClientRect();Math.abs(t.left-c.right)<.1&&(r=!n)}if(h<=0)return{node:e,offset:a+(r?1:0)};i=a+(r?1:0),o=h}}}return{node:e,offset:i>-1?i:s>0?e.nodeValue.length:0}}function Is(e,t,n,r=-1){var i,o;let s,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,d=u-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,i=!1;s=e.elementAtHeight(d),s.type!=co.Text;)for(;d=r>0?s.bottom+t:s.top-t,!(d>=0&&d<=c);){if(i)return n?null:0;i=!0,r=-r}u=l+d;let p=s.from;if(p<e.viewport.from)return 0==e.viewport.from?0:n?null:_s(e,a,s,h,u);if(p>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:_s(e,a,s,h,u);let f=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:f,g=m.elementFromPoint(h,u);g&&!e.contentDOM.contains(g)&&(g=null),g||(h=Math.max(a.left+1,Math.min(a.right-1,h)),g=m.elementFromPoint(h,u),g&&!e.contentDOM.contains(g)&&(g=null));let v,y=-1;if(g&&0!=(null===(i=e.docView.nearest(g))||void 0===i?void 0:i.isEditable)){if(f.caretPositionFromPoint){let e=f.caretPositionFromPoint(h,u);e&&({offsetNode:v,offset:y}=e)}else if(f.caretRangeFromPoint){let e=f.caretRangeFromPoint(h,u);e&&({startContainer:v,startOffset:y}=e)}v&&(!e.contentDOM.contains(v)||wi.safari&&function(e,t,n){return Ps(e,t,n)}(v,y,h)||wi.chrome&&function(e,t,n){if(0!=t)return Ps(e,t,n);for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}let r=1==e.nodeType?e.getBoundingClientRect():Li(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}(v,y,h))&&(v=void 0),v&&(y=Math.min(Oi(v),y))}if(!v||!e.docView.dom.contains(v)){let t=vo.find(e.docView,p);if(!t)return d>s.top+s.height/2?s.to:s.from;({node:v,offset:y}=Es(t.dom,h,u))}let w=e.docView.nearest(v);if(!w)return null;if(w.isWidget&&1==(null===(o=w.dom)||void 0===o?void 0:o.nodeType)){let e=w.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?w.posAtStart:w.posAtEnd}return w.localPosFromDOM(v,y)+w.posAtStart}function _s(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+Ur(s,o,e.state.tabSize)}function Ps(e,t,n){let r,i=e;if(3!=e.nodeType||t!=(r=e.nodeValue.length))return!1;for(;;){let e=i.nextSibling;if(e){if("BR"==e.nodeName)break;return!1}{let e=i.parentNode;if(!e||"DIV"==e.nodeName)break;i=e}}return Li(e,r-1,r).getBoundingClientRect().right>n}function Rs(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;e&&(i.type!=co.Text||e.type==i.type&&!(n<0?i.from<t:i.to>t))||(e=i)}}return e||r}return r}function Ls(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=Fo(i,o,s,a,n),c=Vo;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return t;l=r(c)}a=t}}function Bs(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function zs(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],o=null;if(i.empty){let t=Bs(e,i.from,0);t!=i.from&&(o=Ln.cursor(t,-1))}else{let t=Bs(e,i.from,-1),n=Bs(e,i.to,1);t==i.from&&n==i.to||(o=Ln.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}o&&(n||(n=t.ranges.slice()),n[r]=o)}return n?Ln.create(n,t.mainIndex):t}function Vs(e,t,n){let r=Bs(e.state.facet(fs).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Ln.cursor(r,r<n.from?1:-1)}const Fs="￿";class Hs{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Ar.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Fs}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=r.nextSibling;if(i==t)break;let o=$i.get(r),s=$i.get(i);(o&&s?o.breakAfter:(o?o.breakAfter:Ti(r))||Ti(i)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>e)&&!js(i,t)&&this.lineBreak(),r=i}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(i=r.exec(t))&&(o=i.index,s=i[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let t=$i.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(qs(e,n.node,n.offset)?t:0))}}function qs(e,t,n){for(;;){if(!t||n<Oi(t))return!1;if(t==e)return!0;n=Mi(t)+1,t=t.parentNode}}function js(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=$i.get(e);if(!(null==t?void 0:t.isWidget)&&!e.cmIgnore)return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class $s{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Ws{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;n&&(t.push(new $s(n,r)),i==n&&o==r||t.push(new $s(i,o)));return t}(e),n=new Hs(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?Ln.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!xi(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!xi(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((wi.ios||wi.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=s.from-t,a=s.to-i;0!=o&&1!=o&&0!=t||0!=a&&-1!=a&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ln.range(r,n)):this.newSel=Ln.single(r,n)}}}function Us(e,t){let n,{newSel:r}=t,i=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,a=i.from,l=null;(8===o||wi.android&&t.text.length<s-r)&&(a=i.to,l="end");let c=Gs(e.state.doc.sliceString(r,s,Fs),t.text,a-r,l);c&&(wi.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Fs+Fs&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:un.of(t.text.slice(c.from,c.toB).split(Fs))})}else r&&(!e.hasFocus&&e.state.facet(is)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,i.to)}:(wi.mac||wi.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=Ln.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:un.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:e.state.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:e.state.toText(e.inputState.insertingText)}:wi.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=Ln.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:un.of([" "])}),n)return Ks(e,n,r,o);if(r&&!r.main.eq(i)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=zs(e.state.facet(fs).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Ks(e,t,n,r=-1){if(wi.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(wi.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&Bi(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>i.head)&&Bi(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&Bi(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let n=t.from<o.from?-1:1,r=n<0?o.from:o.to,a=Bs(i.facet(fs).map(t=>t(e)),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:Ln.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&Ss(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-u,h=r-c.length;if(e.state.sliceDoc(h,r)!=c||r>=l.from&&h<=l.to)return{range:n};let d=i.changes({from:h,to:r,insert:t.insert}),p=n.to-o.to;return{changes:d,range:a?Ln.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):n.map(d)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1));return i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(Ko).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}function Gs(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.length<t.length){o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o}else if(a<o){o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}let Js=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,wi.safari&&e.contentDOM.addEventListener("input",()=>null),wi.gecko&&function(e){xa.has(e)||(xa.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=$i.get(r))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(Ys(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Ys(t.value,r))}}for(let e in na)n(e).handlers.push(na[e]);for(let e in ra)n(e).observers.push(ra[e]);return t}(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&i!=!o.handlers.length&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Qs.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),wi.android&&wi.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!wi.ios||e.synthetic||e.altKey||e.metaKey||!((t=Xs.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Zs.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,Bi(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(wi.safari&&!wi.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function Ys(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){rs(n.state,e)}}}const Xs=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Zs="dthko",Qs=[16,17,18,20,91,92,224,225];function ea(e){return.7*Math.max(0,e)+8}class ta{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,r=e.ownerDocument;for(let i=e.parentNode;i&&!(i==r.body||t&&n);)if(1==i.nodeType)!n&&i.scrollHeight>i.clientHeight&&(n=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(fs).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ar.allowMultipleSelections)&&function(e,t){let n=e.state.facet(qo);return n.length?n[0](t):wi.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=bi(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=ma(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let r=0,i=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=ys(this.view);e.clientX-c.left<=o+6?r=-ea(o-e.clientX):e.clientX+c.right>=a-6&&(r=ea(e.clientX-a)),e.clientY-c.top<=s+6?i=-ea(s-e.clientY):e.clientY+c.bottom>=l-6&&(i=ea(e.clientY-l)),this.setScrollSpeed(r,i)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=zs(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const na=Object.create(null),ra=Object.create(null),ia=wi.ie&&wi.ie_version<15||wi.ios&&wi.webkit_version<604;function oa(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function sa(e,t){t=oa(e.state,Jo,t);let n,{state:r}=e,i=1,o=r.toText(t),s=o.lines==r.selection.ranges.length,a=null!=va&&r.selection.ranges.every(e=>e.empty)&&va==o.toString();if(a){let e=-1;n=r.changeByRange(n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((s?o.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:Ln.cursor(n.from+l.length)}})}else n=s?r.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Ln.cursor(e.from+t.length)}}):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function aa(e,t,n,r){if(1==r)return Ln.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return Ln.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=xn(i.text,o,!1):a=xn(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=xn(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=xn(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return Ln.range(s+i.from,a+i.from)}(e.state,t,n);{let n=vo.find(e.docView,t),r=e.state.doc.lineAt(n?n.posAtEnd:t),i=n?n.posAtStart:r.from,o=n?n.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,Ln.range(i,o)}}ra.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},na.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ra.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},ra.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},na.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet($o))if(n=r(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=ha(e,t),r=ma(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,o,s){let a,l=ha(e,t),c=aa(e,l.pos,l.bias,r);if(n.pos!=l.pos&&!o){let t=aa(e,n.pos,n.bias,r),i=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=i<c.from?Ln.range(i,o):Ln.range(o,i)}return o?i.replaceRange(i.main.extend(c.from,c.to)):s&&1==r&&i.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return Ln.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(i,l.pos))?a:s?i.addRange(c):Ln.create([c])}}}(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ta(e,t,n,r)),r&&e.observer.ignore(()=>{Ri(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),!1===i.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};let la=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function ca(e,t,n,r){let i=vo.find(e.docView,t);if(!i)return 1;let o=t-i.posAtStart;if(0==o)return 1;if(o==i.length)return-1;let s=i.coordsAt(o,-1);if(s&&la(n,r,s))return-1;let a=i.coordsAt(o,1);return a&&la(n,r,a)?1:s&&s.bottom>=r?-1:1}function ha(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:ca(e,n,t.clientX,t.clientY)}}const ua=wi.ie&&wi.ie_version<=11;let da=null,pa=0,fa=0;function ma(e){if(!ua)return e.detail;let t=da,n=fa;return da=e,fa=Date.now(),pa=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(pa+1)%3:1}function ga(e,t,n,r){if(!(n=oa(e.state,Jo,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=r&&o&&function(e,t){let n=e.state.facet(jo);return n.length?n[0](t):wi.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:i,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}na.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.nearest(t.target);if(r&&r.isWidget){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=Ln.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",oa(e.state,Yo,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},na.dragend=e=>(e.inputState.draggedContent=null,!1),na.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&ga(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return ga(e,t,n,!0),!0}return!1},na.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ia?null:t.clipboardData;return n?(sa(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),sa(e,n.value)},50)}(e),!1)};let va=null;na.copy=na.cut=(e,t)=>{let{text:n,ranges:r,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:oa(e,Yo,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;va=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=ia?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,n),!1)};const ya=dr.define();function wa(e,t){let n=[];for(let r of e.facet(Go)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:ya.of(!0)}):null}function ba(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=wa(e.state,t);n?e.dispatch(n):e.update([])}},10)}ra.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ba(e)},ra.blur=e=>{e.observer.clearSelectionRange(),ba(e)},ra.compositionstart=ra.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},ra.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,wi.chrome&&wi.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ra.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},na.beforeinput=(e,t)=>{var n,r;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return Ks(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}let i;if(wi.chrome&&wi.android&&(i=Xs.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return wi.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),wi.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>ra.compositionend(e,t),20),!1};const xa=new Set;const ka=["pre-wrap","normal","pre-line","break-spaces"];let Sa=!1;function Ca(){Sa=!1}class Ma{constructor(e){this.lineWrapping=e,this.doc=un.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ka.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=ka.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class Ta{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Aa{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?co.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof fo?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Aa(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Oa=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Oa||(Oa={}));const Na=.001;class Ea{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Na&&(Sa=!0),this.height=e)}replace(e,t,n){return Ea.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=r[s],u=i.lineAt(a,Oa.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,Oa.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=r[s-1].toA;)a=r[s-1].fromA,c=r[s-1].fromB,s--,a<u.from&&(u=i.lineAt(a,Oa.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let p=Ba.build(n.setDoc(o),e,c,h);i=Da(i,i.replace(a,l,p))}return i.updateHeight(n,0)}static empty(){return new _a(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else{if(!(i>2*r))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}}else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new Ra(Ea.of(e.slice(0,t)),o,Ea.of(e.slice(n)))}}function Da(e,t){return e==t?e:(e.constructor!=t.constructor&&(Sa=!0),t)}Ea.prototype.size=1;class Ia extends Ea{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,r){return new Aa(r,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,r,i){return this.blockAt(0,n,r,i)}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.blockAt(0,n,r,i))}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class _a extends Ia{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new Aa(r,this.length,n,this.height,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof _a||r instanceof Pa&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Pa?r=new _a(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Ea.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setHeight(r.heights[r.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Pa extends Ea{constructor(e){super(e,0)}heightMetrics(e,t){let n,r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-r+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:r,lastLine:i,perLine:n,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),l=s+o.length*a,c=Math.max(n,e-l/2);return new Aa(o.from,o.length,c,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new Aa(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==Oa.ByHeight)return this.blockAt(e,n,r,i);if(t==Oa.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Aa(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=r+s*h+a*(l.from-i-h);return new Aa(l.from,l.length,Math.max(r,Math.min(u,r+this.height-c)),c,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let c=e,h=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new Aa(t.from,t.length,h,r,0)),h+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof Pa?n[n.length-1]=new Pa(e.length+r):n.push(null,new Pa(r-1))}if(e>0){let t=n[0];t instanceof Pa?n[0]=new Pa(e+t.length):n.unshift(new Pa(e-1),null)}return Ea.of(n)}decomposeLeft(e,t){t.push(new Pa(e-1),null)}decomposeRight(e,t){t.push(null,new Pa(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new Pa(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++];-1==s?s=i:Math.abs(i-s)>=Na&&(s=-2);let a=new _a(t,i);a.outdated=!1,n.push(a),o+=t+1}o<=i&&n.push(null,new Pa(i-o).updateHeight(e,o));let a=Ea.of(n);return(s<0||Math.abs(a.height-this.height)>=Na||Math.abs(s-this.heightMetrics(e,t).perLine)>=Na)&&(Sa=!0),Da(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Ra extends Ea{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,a=t==Oa.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==Oa.ByPosNoHeight?Oa.ByPosNoHeight:Oa.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,Oa.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&La(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),La(i,e)}return Ea.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Ea.of(this.break?[e,null,t]:[e,t]):(this.left=Da(this.left,e),this.right=Da(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function La(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof Pa&&(r=e[t+1])instanceof Pa&&e.splice(t-1,3,new Pa(n.length+1+r.length))}class Ba{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof _a?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new _a(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Ia(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new _a(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Pa(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof _a)return e;let t=new _a(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof _a||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new _a(0,-1));let n=e;for(let e of this.nodes)e instanceof _a&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new Ba(n,e);return _r.spans(t,n,r,i,0),i.finish(n)}}class za{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&go(e,t,this.changes,5)}}function Va(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Fa(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Ha{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return ho.replace({widget:new qa(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class qa extends lo{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class ja{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ka,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=So.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(us).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new Ma(t),this.stateDeco=e.facet(ds).filter(e=>"function"!=typeof e),this.heightMap=Ea.empty().applyChanges(this.stateDeco,un.empty,this.heightOracle.setDoc(e.doc),[new bs(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ho.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new $a(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ka:new Ga(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ja(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ds).filter(e=>"function"!=typeof e);let r=e.changedRanges,i=bs.extendWithRanges(r,function(e,t,n){let r=new za;return _r.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:On.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ca(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Sa)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Zo)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?So.RTL:So.LTR;let o=this.heightOracle.mustRefreshForWrapping(i),s=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=Di(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Vi(e.scrollDOM);let p=(this.printing?Fa:Va)(t,this.paddingTop),f=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&r.refresh(i,n,s,a,Math.max(5,v/s),t),o&&(e.docView.minWidth=0,l|=16)}f>0&&m>0?c=Math.max(f,m):f<0&&m<0&&(c=Math.min(f,m)),Ca();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Ea.empty().applyChanges(this.stateDeco,un.empty,this.heightOracle,[new bs(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Ta(n.from,i))}Sa&&(l|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new $a(r.lineAt(o-1e3*n,Oa.ByHeight,i,0,0).from,r.lineAt(s+1e3*(1-n),Oa.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=r.lineAt(e,Oa.ByPos,i,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new $a(r.lineAt(n-500,Oa.ByHeight,i,0,0).from,r.lineAt(n+o+500,Oa.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new $a(this.heightMap.lineAt(n,Oa.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Oa.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Oa.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Oa.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Ha(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=So.LTR&&!n)return[];let s=[],a=(r,o,l,c)=>{if(o-r<i)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>r&&e<o)return a(r,e-10,l,c),void a(e+10,o,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(Ln.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,c);d=new Ha(r,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<o||t.type!=co.Text)return;let i=function(e,t,n){let r=[],i=e,o=0;_r.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),o+=t-i);return{total:o,ranges:r}}(t.from,t.to,this.stateDeco);if(i.total<o)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let r=Ua(i,c),s=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=r-s,n=r+s}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;s=Wa(i,e),l=Wa(i,n)}else{let n=i.total*this.heightOracle.charWidth,o=r*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=Ua(i,c),t=((p-d)/2+o)/n;h=e-t,u=e+t}else h=(d-o)/n,u=(p+o)/n;s=Wa(i,h),l=Wa(i,u)}s>t.from&&a(t.from,s,t,i),l<t.to&&a(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=Ua(r,n)-Ua(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Ha.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ho.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];_r.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];i.from==o.from&&i.to==o.to||(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ja(this.heightMap.lineAt(e,Oa.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ja(this.heightMap.lineAt(this.scaler.fromDOM(e),Oa.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ja(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class $a{constructor(e,t){this.from=e,this.to=t}}function Wa({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function Ua(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}const Ka={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class Ga{constructor(e,t,n){let r=0,i=0,o=0;this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,Oa.ByPos,e,0,0).top,s=t.lineAt(i,Oa.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=o+(e.top-i)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof Ga&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function Ja(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Aa(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Ja(e,t)):e._content)}const Ya=Vn.define({combine:e=>e.join(" ")}),Xa=Vn.define({combine:e=>e.indexOf(!0)>-1}),Za=Yr.newName(),Qa=Yr.newName(),el=Yr.newName(),tl={"&light":"."+Qa,"&dark":"."+el};function nl(e,t,n){return new Yr(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const rl=nl("."+Za,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},tl),il={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ol=wi.ie&&wi.ie_version<=11;let sl=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Ii,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(wi.ie&&wi.ie_version<=11||wi.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!wi.android||!1===e.constructor.EDIT_CONTEXT||wi.chrome&&wi.chrome_version<126||(this.editContext=new cl(e),e.state.facet(is)&&(e.contentDOM.editContext=this.editContext.editContext)),ol&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(is)?n.root.activeElement!=this.dom:!ki(this.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);i&&i.ignoreEvent(e)?t||(this.selectionChanged=!1):(wi.ie&&wi.ie_version<=11||wi.android&&wi.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Ci(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=bi(e.root);if(!t)return!1;let n=wi.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return ll(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?ll(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=ki(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Oi(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:(n=e,r=Oi(n))}else{if(n==e)return!0;r=Mi(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,il),ol&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ol&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Bi(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ki(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Ws(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=Us(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=al(t,e.previousSibling||e.target.previousSibling,-1),r=al(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(is)!=e.state.facet(is)&&(e.view.contentDOM.editContext=e.state.facet(is)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function al(e,t,n){for(;t;){let r=$i.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function ll(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);return Ci(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class cl{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&i<this.from?s=i:a==this.to&&i>this.to&&(a=i);let c=Gs(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!c){let t=Ln.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(t.main.eq(r)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+s,to:c.toA+s,insert:un.of(n.text.slice(c.from,c.toB).split("\n"))};if((wi.mac||wi.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:s,to:a,insert:un.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);Ks(e,h,Ln.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(ho.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:ns.of(ho.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=bi(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,a,l)=>{if(n)return;let c=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l))return r=this.pendingContextChange=null,t+=c,void(this.to+=c);r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==r||this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}let hl=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new ja(e.state||Ar.create(e)),e.scrollTo&&e.scrollTo.is(ts)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(as).map(e=>new cs(e));for(let e of this.plugins)e.update(this);this.observer=new sl(this),this.inputState=new Js(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ks(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=1==e.length&&e[0]instanceof gr?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,i=this.state;for(let t of e){if(t.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed)return void(this.viewState.state=i);let o=this.hasFocus,s=0,a=null;e.some(e=>e.annotation(ya))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=wa(i,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(Ar.phrases)!=this.state.facet(Ar.phrases))return this.setState(i);t=xs.create(this,i,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new es(e.empty?e:Ln.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(ts)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=pl.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(ws)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(Ya)!=t.state.facet(Ya)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(Uo))try{e(t)}catch(e){rs(this.state,e,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Us(this,c)&&l.force&&Bi(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new ja(e),this.plugins=e.facet(as).map(e=>new cs(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new ks(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(as),n=e.state.facet(as);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new cs(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){rs(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(Vi(n))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return rs(this.state,e),dl}}),c=xs.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=dl)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){rs(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Uo))e(t)}get themeClasses(){return Za+" "+(this.state.facet(Xa)?el:Qa)+" "+this.state.facet(Ya)}updateAttrs(){let e=fl(this,hs,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(is)?"true":"false",class:"cm-content",style:`${wi.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),fl(this,us,t);let n=this.observer.ignore(()=>{let n=so(this.contentDOM,this.contentAttrs,t),r=so(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&(this.announceDOM.textContent=""),n=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(ws);let t=this.state.facet(e.cspNonce);Yr.mount(this.root,this.styleModules.concat(rl).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Vs(this,e,Ls(this,e,t,n))}moveByGroup(e,t){return Vs(this,e,Ls(this,e,t,t=>function(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==Sr.Space&&(i=t),i==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return Ln.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=Rs(e,t.head,t.assoc||-1),o=r&&i.type==co.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==So.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return Ln.cursor(s,n?-1:1)}return Ln.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Vs(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return Ln.cursor(i,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),s=(o<0?t.top:t.bottom)+h}let u=l.left+a,d=null!=r?r:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(d+t)*o,r=Is(e,{x:u,y:n},!1,o);if(n<l.top||n>l.bottom||(o<0?r<i:r>i)){let t=e.docView.coordsForChar(r),i=!t||n<t.top?-1:1;return Ln.cursor(r,i,void 0,a)}}}(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Is(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return Ni(n,i[_o.find(i,e-r.from,-1,t)].dir==So.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Xo)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ul)return zo(e.length);let t,n=this.textDirectionAt(e.from);for(let r of this.bidiCache)if(r.from==e.from&&r.dir==n&&(r.fresh||Po(r.isolates,t=gs(this,e))))return r.order;t||(t=gs(this,e));let r=function(e,t,n){if(!e)return[new _o(0,0,t==Mo?1:0)];if(t==Co&&!n.length&&!Io.test(e))return zo(e.length);if(n.length)for(;e.length>Ro.length;)Ro[Ro.length]=256;let r=[],i=t==Co?0:1;return Bo(e,i,i,n,0,e.length,r),r}(e.text,n,t);return this.bidiCache.push(new pl(e.from,e.to,n,t,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||wi.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ri(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return ts.of(new es("number"==typeof e?Ln.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return ts.of(new es(Ln.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ls.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ls.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Yr.newName(),r=[Ya.of(n),ws.of(nl(`.${n}`,e))];return t&&t.dark&&r.push(Xa.of(!0)),r}static baseTheme(e){return Zn.lowest(ws.of(nl("."+Za,e,tl)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&$i.get(n)||$i.get(e);return(null===(t=null==r?void 0:r.rootView)||void 0===t?void 0:t.view)||null}};hl.styleModule=ws,hl.inputHandler=Ko,hl.clipboardInputFilter=Jo,hl.clipboardOutputFilter=Yo,hl.scrollHandler=Qo,hl.focusChangeEffect=Go,hl.perLineTextDirection=Xo,hl.exceptionSink=Wo,hl.updateListener=Uo,hl.editable=is,hl.mouseSelectionStyle=$o,hl.dragMovesSelection=jo,hl.clickAddsSelectionRange=qo,hl.decorations=ds,hl.outerDecorations=ps,hl.atomicRanges=fs,hl.bidiIsolatedRanges=ms,hl.scrollMargins=vs,hl.darkTheme=Xa,hl.cspNonce=Vn.define({combine:e=>e.length?e[0]:""}),hl.contentAttributes=us,hl.editorAttributes=hs,hl.lineWrapping=hl.contentAttributes.of({class:"cm-lineWrapping"}),hl.announce=mr.define();const ul=4096,dl={};class pl{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:So.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new pl(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function fl(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&ro(o,n)}return n}const ml=wi.mac?"mac":wi.windows?"win":wi.linux?"linux":"key";function gl(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const vl=Zn.default(hl.domEventHandlers({keydown:(e,t)=>Cl(bl(t.state),e,t,"editor")})),yl=Vn.define({enables:vl}),wl=new WeakMap;function bl(e){let t=e.facet(yl),n=wl.get(t);return n||wl.set(t,n=function(e,t=ml){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=r.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let r,i,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:i=!0}}return r&&(a="Alt-"+a),i&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");i(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=xl={view:t,prefix:n,scope:e};return setTimeout(()=>{xl==r&&(xl=null)},kl),!0}]})}let d=u.join(" ");i(d,!1);let p=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&p.run.push(o),s&&(p.preventDefault=!0),a&&(p.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Sl))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let xl=null;const kl=4e3;let Sl=null;function Cl(e,t,n,r){Sl=t;let i=oi(t),o=Cn(kn(i,0))==i.length&&" "!=i,s="",a=!1,l=!1,c=!1;xl&&xl.view==n&&xl.scope==r&&(s=xl.prefix+" ",Qs.indexOf(t.keyCode)<0&&(l=!0,xl=null));let h,u,d=new Set,p=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},f=e[r];return f&&(p(f[s+gl(i,t,!o)])?a=!0:!o||!(t.altKey||t.metaKey||t.ctrlKey)||wi.windows&&t.ctrlKey&&t.altKey||wi.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=Qr[t.keyCode])||h==i?o&&t.shiftKey&&p(f[s+gl(i,t,!0)])&&(a=!0):(p(f[s+gl(h,t,!0)])||t.shiftKey&&(u=ei[t.keyCode])!=i&&u!=h&&p(f[s+gl(u,t,!1)]))&&(a=!0),!a&&p(f._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),Sl=null,a}class Ml{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=Tl(e);return[new Ml(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==So.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=Tl(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),p=Rs(e,r,1),f=Rs(e,i,-1),m=p.type==co.Text?p:null,g=f.type==co.Text?f:null;m&&(e.lineWrapping||p.widgetLineBreaks)&&(m=Al(e,r,1,m));g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=Al(e,i,-1,g));if(m&&g&&m.from==g.from&&m.to==g.to)return y(w(n.from,n.to,m));{let t=m?w(n.from,null,m):b(p,!1),r=g?w(null,n.to,g):b(f,!0),i=[];return(m||p).to<(g||f).from-(m&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(u,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==co.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),y(t).concat(i).concat(y(r))}function v(e,n,r,i){return new Ml(t,e-l.left,n-l.top,r-e,i-n)}function y({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function w(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,c,h){let p=e.coordsAtPos(t,t==r.to?-2:2),f=e.coordsAtPos(l,l==r.from?2:-2);p&&f&&(i=Math.min(p.top,f.top,i),s=Math.max(p.bottom,f.bottom,s),h==So.LTR?a.push(o&&n?u:p.left,o&&c?d:f.right):a.push(!o&&c?u:f.left,!o&&n?d:p.right))}let c=null!=t?t:r.from,h=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<h)for(let i=Math.max(r.from,c),o=Math.min(r.to,h);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(i=r.to+1,i>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function b(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Tl(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==So.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Al(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class Ol{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Nl)!=e.state.facet(Nl)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Nl);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;e==this.scaleX&&t==this.scaleY||(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{return n=e,r=this.drawn[t],!(n.constructor==r.constructor&&n.eq(r));var n,r})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,wi.safari&&wi.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Nl=Vn.define();function El(e){return[ls.define(t=>new Ol(t,e)),Nl.of(e)]}const Dl=Vn.define({combine:e=>Or(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Il(e={}){return[Dl.of(e),Pl,Ll,Bl,Zo.of(!0)]}function _l(e){return e.startState.facet(Dl)!=e.state.facet(Dl)}const Pl=El({above:!0,markers(e){let{state:t}=e,n=t.facet(Dl),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:Ln.cursor(i.head,i.head>i.anchor?-1:1);for(let i of Ml.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=_l(e);return n&&Rl(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Rl(t.state,e)},class:"cm-cursorLayer"});function Rl(e,t){t.style.animationDuration=e.facet(Dl).cursorBlinkRate+"ms"}const Ll=El({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:Ml.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||_l(e),class:"cm-selectionLayer"}),Bl=Zn.highest(hl.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),zl=mr.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Vl=Un.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(zl)?t.value:e,e))}),Fl=ls.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(Vl);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Vl)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Vl),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Vl)!=e&&this.view.dispatch({effects:zl.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Hl(e,t,n,r,i){t.lastIndex=0;for(let o,s=e.iterRange(n,r),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}class ql{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n)}this.boundary=i,this.maxLength=o}createDeco(e){let t=new Pr,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))Hl(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,u);else Hl(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}const jl=null!=/x/.unicode?"gu":"g",$l=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",jl),Wl={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ul=null;const Kl=Vn.define({combine(e){let t=Or(e,{render:null,specialChars:$l,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Ul&&"undefined"!=typeof document&&document.body){let t=document.body.style;Ul=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Ul||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,jl)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,jl)),t}});function Gl(e={}){return[Kl.of(e),Jl||(Jl=ls.fromClass(class{constructor(e){this.view=e,this.decorations=ho.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Kl)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new ql({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=kn(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=Wr(e.text,t,r-e.from);return ho.replace({widget:new Xl((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ho.replace({widget:new Yl(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Kl);e.startState.facet(Kl)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let Jl=null;class Yl extends lo{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(Wl[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Xl extends lo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Zl=ho.line({class:"cm-activeLine"}),Ql=ls.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(Zl.range(i.from)),t=i.from)}return ho.set(n)}},{decorations:e=>e.decorations}),ec=2e3;function tc(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>ec?-1:i==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):Wr(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function nc(e,t){let n=tc(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,o){let s=tc(e,t);if(!s)return r;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>ec||n.off>ec||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(Ln.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=Ur(n.text,s,e.tabSize,!0);if(r<0)o.push(Ln.cursor(n.to));else{let t=Ur(n.text,a,e.tabSize);o.push(Ln.range(n.from+r,n.from+t))}}}return o}(e.state,n,s);return a.length?o?Ln.create(a.concat(r.ranges)):Ln.create(a):r}}:null}const rc={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},ic={style:"cursor: crosshair"};function oc(e={}){let[t,n]=rc[e.key||"Alt"],r=ls.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,hl.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?ic:null})]}const sc="-10000px";class ac{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)o.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function lc(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const cc=Vn.define({combine:e=>{var t,n,r;return{position:wi.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||lc}}}),hc=new WeakMap,uc=ls.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(cc);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new ac(e,mc,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(cc);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=sc,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(wi.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=ys(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(cc).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=sc;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=p?7:0,m=d.right-d.left,g=null!==(t=hc.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||fc,y=this.view.textDirection==So.LTR,w=d.width>r.right-r.left?y?r.left:r.right-d.width:y?Math.max(r.left,Math.min(u.left-(p?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,u.left-m+(p?14:0)-v.x),r.right-m),b=this.above[a];!l.strictSide&&(b?u.top-g-f-v.y<r.top:u.bottom+g+f+v.y>r.bottom)&&b==r.bottom-u.bottom>u.top-r.top&&(b=this.above[a]=!b);let x=(b?u.top-r.top:r.bottom-u.bottom)-f;if(x<g&&!1!==c.resize){if(x<this.view.defaultLineHeight){h.style.top=sc;continue}hc.set(c,g),h.style.height=(g=x)/o+"px"}else h.style.height&&(h.style.height="");let k=b?u.top-g-f-v.y:u.bottom+f+v.y,S=w+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>w&&e.top<k+g&&e.bottom>k&&(k=b?e.top-g-2-f:e.bottom+f+2);if("absolute"==this.position?(h.style.top=(k-e.parent.top)/o+"px",dc(h,(w-e.parent.left)/i)):(h.style.top=k/o+"px",dc(h,w/i)),p){let e=u.left+(y?v.x:-v.x)-(w+14-7);p.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:w,top:k,right:S,bottom:k+g}),h.classList.toggle("cm-tooltip-above",b),h.classList.toggle("cm-tooltip-below",!b),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=sc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function dc(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const pc=hl.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),fc={x:0,y:0},mc=Vn.define({enables:[uc,pc]}),gc=Vn.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class vc{static create(e){return new vc(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ac(e,gc,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r)if(void 0===t)t=r;else if(t!==r)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const yc=mc.compute([gc],e=>{let t=e.facet(gc);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:vc.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class wc{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let r,i=1;if(n instanceof Xi)r=n.posAtStart;else{if(r=e.posAtCoords(t),null==r)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==So.RTL?-1:1;i=t.x<n.left?-s:s}let o=this.source(e,r,i);if(null==o?void 0:o.then){let t=this.pending={pos:r};o.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>rs(e.state,t,"hover tooltip"))}else!o||Array.isArray(o)&&!o.length||e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(uc),t=e?e.manager.tooltips.findIndex(e=>e.create==vc.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!function(e,t){let n,{left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=r-bc&&t.clientX<=i+bc&&t.clientY>=o-bc&&t.clientY<=s+bc}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,r,i){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const bc=4;function xc(e,t={}){let n=mr.define(),r=Un.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,Tn.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(Sc)&&(e=[]);return e},provide:e=>gc.from(e)});return{active:r,extension:[r,ls.define(i=>new wc(i,e,r,n,t.hoverTime||300)),yc]}}function kc(e,t){let n=e.plugin(uc);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const Sc=mr.define(),Cc=Vn.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Mc(e,t){let n=e.plugin(Tc),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const Tc=ls.fromClass(class{constructor(e){this.input=e.state.facet(Nc),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Cc);this.top=new Ac(e,!0,t.topContainer),this.bottom=new Ac(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Cc);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ac(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ac(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Nc);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),r.push(t),(t.top?i:o).push(t)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>hl.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ac{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Oc(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Oc(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Oc(e){let t=e.nextSibling;return e.remove(),t}const Nc=Vn.define({enables:Tc});class Ec extends Nr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ec.prototype.elementClass="",Ec.prototype.toDOM=void 0,Ec.prototype.mapMode=Tn.TrackBefore,Ec.prototype.startSide=Ec.prototype.endSide=-1,Ec.prototype.point=!0;const Dc=Vn.define(),Ic=Vn.define(),_c={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_r.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Pc=Vn.define();function Rc(e){return[Bc(),Pc.of({..._c,...e})]}const Lc=Vn.define({combine:e=>e.some(e=>e)});function Bc(e){return[zc]}const zc=ls.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Pc).map(t=>new qc(e,t)),this.fixed=!e.state.facet(Lc);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Lc)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=_r.iter(this.view.state.facet(Dc),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Hc(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==co.Text&&t){Fc(n,r,o.from);for(let e of i)e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==co.Text){Fc(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Pc),n=e.state.facet(Pc),r=e.docChanged||e.heightChanged||e.viewportChanged||!_r.eq(e.startState.facet(Dc),e.state.facet(Dc),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new qc(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>hl.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==So.LTR?{left:r,right:i}:{right:r,left:i}})});function Vc(e){return Array.isArray(e)?e:[e]}function Fc(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Hc{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=_r.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new jc(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Fc(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(Ic)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class qc{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i,o=r.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=Vc(t.markers(e)),t.initialSpacer&&(this.spacer=new jc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Vc(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!_r.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class jc{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const $c=Vn.define(),Wc=Vn.define(),Uc=Vn.define({combine:e=>Or(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class Kc extends Ec{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gc(e,t){return e.state.facet(Uc).formatNumber(t,e.state)}const Jc=Pc.compute([Uc],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet($c),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new Kc(Gc(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(Wc)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Uc)!=e.state.facet(Uc),initialSpacer:e=>new Kc(Gc(e,Xc(e.state.doc.lines))),updateSpacer(e,t){let n=Gc(t.view,Xc(t.view.state.doc.lines));return n==e.number?e:new Kc(n)},domEventHandlers:e.facet(Uc).domEventHandlers,side:"before"}));function Yc(e={}){return[Uc.of(e),Bc(),Jc]}function Xc(e){let t=9;for(;t<e;)t=10*t+9;return t}const Zc=new class extends Ec{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Qc=Dc.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Zc.range(i)))}return _r.of(t)});let eh=0;class th{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=eh++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof th&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new th(n,[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new rh(e);return e=>e.modified.indexOf(t)>-1?e:rh.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let nh=0;class rh{constructor(e){this.name=e,this.instances=[],this.id=nh++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]));var r,i});if(n)return n;let r=[],i=new th(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(rh.get(t,e));return i}}function ih(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(" "))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw new RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new sh(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return oh.add(t)}const oh=new ut({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new sh(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class sh{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function ah(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function lh(e,t,n,r=0,i=e.length){let o=new ch(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}sh.empty=new sh([],2,null);class ch{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,c=function(e){let t=e.type.prop(oh);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||sh.empty,h=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(ut.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,p=s;;d++){let f=d<u.overlay.length?u.overlay[d]:null,m=f?f.from+s:a,g=Math.max(t,p),v=Math.min(n,m);if(g<v&&h)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!f||m>n)break;p=f.to+s,p>t&&(this.highlightRange(o.cursor(),Math.max(t,f.from+s),Math.min(n,p),"",c),this.startSpan(Math.min(n,p),l))}h&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const hh=th.define,uh=hh(),dh=hh(),ph=hh(dh),fh=hh(dh),mh=hh(),gh=hh(mh),vh=hh(mh),yh=hh(),wh=hh(yh),bh=hh(),xh=hh(),kh=hh(),Sh=hh(kh),Ch=hh(),Mh={comment:uh,lineComment:hh(uh),blockComment:hh(uh),docComment:hh(uh),name:dh,variableName:hh(dh),typeName:ph,tagName:hh(ph),propertyName:fh,attributeName:hh(fh),className:hh(dh),labelName:hh(dh),namespace:hh(dh),macroName:hh(dh),literal:mh,string:gh,docString:hh(gh),character:hh(gh),attributeValue:hh(gh),number:vh,integer:hh(vh),float:hh(vh),bool:hh(mh),regexp:hh(mh),escape:hh(mh),color:hh(mh),url:hh(mh),keyword:bh,self:hh(bh),null:hh(bh),atom:hh(bh),unit:hh(bh),modifier:hh(bh),operatorKeyword:hh(bh),controlKeyword:hh(bh),definitionKeyword:hh(bh),moduleKeyword:hh(bh),operator:xh,derefOperator:hh(xh),arithmeticOperator:hh(xh),logicOperator:hh(xh),bitwiseOperator:hh(xh),compareOperator:hh(xh),updateOperator:hh(xh),definitionOperator:hh(xh),typeOperator:hh(xh),controlOperator:hh(xh),punctuation:kh,separator:hh(kh),bracket:Sh,angleBracket:hh(Sh),squareBracket:hh(Sh),paren:hh(Sh),brace:hh(Sh),content:yh,heading:wh,heading1:hh(wh),heading2:hh(wh),heading3:hh(wh),heading4:hh(wh),heading5:hh(wh),heading6:hh(wh),contentSeparator:hh(yh),list:hh(yh),quote:hh(yh),emphasis:hh(yh),strong:hh(yh),link:hh(yh),monospace:hh(yh),strikethrough:hh(yh),inserted:hh(),deleted:hh(),changed:hh(),invalid:hh(),meta:Ch,documentMeta:hh(Ch),annotation:hh(Ch),processingInstruction:hh(Ch),definition:th.defineModifier("definition"),constant:th.defineModifier("constant"),function:th.defineModifier("function"),standard:th.defineModifier("standard"),local:th.defineModifier("local"),special:th.defineModifier("special")};for(let e in Mh){let t=Mh[e];t instanceof th&&(t.name=e)}var Th;ah([{tag:Mh.link,class:"tok-link"},{tag:Mh.heading,class:"tok-heading"},{tag:Mh.emphasis,class:"tok-emphasis"},{tag:Mh.strong,class:"tok-strong"},{tag:Mh.keyword,class:"tok-keyword"},{tag:Mh.atom,class:"tok-atom"},{tag:Mh.bool,class:"tok-bool"},{tag:Mh.url,class:"tok-url"},{tag:Mh.labelName,class:"tok-labelName"},{tag:Mh.inserted,class:"tok-inserted"},{tag:Mh.deleted,class:"tok-deleted"},{tag:Mh.literal,class:"tok-literal"},{tag:Mh.string,class:"tok-string"},{tag:Mh.number,class:"tok-number"},{tag:[Mh.regexp,Mh.escape,Mh.special(Mh.string)],class:"tok-string2"},{tag:Mh.variableName,class:"tok-variableName"},{tag:Mh.local(Mh.variableName),class:"tok-variableName tok-local"},{tag:Mh.definition(Mh.variableName),class:"tok-variableName tok-definition"},{tag:Mh.special(Mh.variableName),class:"tok-variableName2"},{tag:Mh.definition(Mh.propertyName),class:"tok-propertyName tok-definition"},{tag:Mh.typeName,class:"tok-typeName"},{tag:Mh.namespace,class:"tok-namespace"},{tag:Mh.className,class:"tok-className"},{tag:Mh.macroName,class:"tok-macroName"},{tag:Mh.propertyName,class:"tok-propertyName"},{tag:Mh.operator,class:"tok-operator"},{tag:Mh.comment,class:"tok-comment"},{tag:Mh.meta,class:"tok-meta"},{tag:Mh.invalid,class:"tok-invalid"},{tag:Mh.punctuation,class:"tok-punctuation"}]);const Ah=new ut;function Oh(e){return Vn.define({combine:e?t=>t.concat(e):void 0})}const Nh=new ut;class Eh{constructor(e,t,n=[],r=""){this.data=e,this.name=r,Ar.prototype.hasOwnProperty("tree")||Object.defineProperty(Ar.prototype,"tree",{get(){return _h(this)}}),this.parser=t,this.extension=[qh.of(this),Ar.languageData.of((e,t,n)=>{let r=Dh(e,t,n),i=r.type.prop(Ah);if(!i)return[];let o=e.facet(i),s=r.type.prop(Nh);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return Dh(e,t,n).type.prop(Ah)==this.data}findRegions(e){let t=e.facet(qh);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Ah)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(ut.mounted);if(i){if(i.tree.prop(Ah)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof wt&&r(i,e.positions[n]+t)}};return r(_h(e),0),n}get allowsNesting(){return!0}}function Dh(e,t,n){let r=e.facet(qh),i=_h(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,exports.IterMode.ExcludeBuffers))e.type.isTop&&(i=e);return i}Eh.setState=mr.define();class Ih extends Eh{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Oh(e.languageData);return new Ih(t,e.parser.configure({props:[Ah.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ih(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function _h(e){let t=e.field(Eh.state,!1);return t?t.tree:wt.empty}class Ph{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Rh=null,Lh=class e{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],wt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ph(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=wt.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(Bt.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Bt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Rh;Rh=this;try{return e()}finally{Rh=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Bh(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=Bt.applyChanges(r,e),i=wt.empty,o=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){a=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&a.push({from:n,to:r})}}}return new e(this.parser,n,r,i,o,s,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=Bh(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends zt{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to,s={parsedPos:i,advance(){let t=Rh;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new wt(ft.none,[],[],o-i)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Rh}};function Bh(e,t,n){return Bt.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class zh{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new zh(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Lh.create(e.facet(qh).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new zh(n)}}Eh.state=Un.define({create:zh.init,update(e,t){for(let e of t.effects)if(e.is(Eh.setState))return e.value;return t.startState.facet(qh)!=t.state.facet(qh)?zh.init(t.state):e.apply(t)}});let Vh=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Vh=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const Fh="undefined"!=typeof navigator&&(null===(Th=navigator.scheduling)||void 0===Th?void 0:Th.isInputPending)?()=>navigator.scheduling.isInputPending():null,Hh=ls.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Eh.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Eh.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Vh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(Eh.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Fh?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>Fh&&Fh()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Eh.setState.of(new zh(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>rs(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),qh=Vn.define({combine:e=>e.length?e[0]:null,enables:e=>[Eh.state,Hh,hl.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class jh{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class $h{constructor(e,t,n,r,i,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new $h(e.name,(e.alias||[]).concat(e.name).map(e=>e.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n)for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t;return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}}const Wh=Vn.define(),Uh=Vn.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Kh(e){let t=e.facet(Uh);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Gh(e,t){let n="",r=e.tabSize,i=e.facet(Uh)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function Jh(e,t){e instanceof Ar&&(e=new Yh(e));for(let n of e.state.facet(Wh)){let r=n(e,t);if(void 0!==r)return r}let n=_h(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return Zh(r,e,n)}(e,n,t):null}class Yh{constructor(e,t={}){this.state=e,this.options=t,this.unit=Kh(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return Wr(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Xh=new ut;function Zh(e,t,n){for(let r=e;r;r=r.next){let e=Qh(r.node);if(e)return e(tu.create(t,n,r))}return 0}function Qh(e){let t=e.type.prop(Xh);if(t)return t;let n,r=e.firstChild;if(r&&(n=r.type.prop(ut.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>ru(e,!0,1,void 0,r&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?eu:null}function eu(){return 0}class tu extends Yh{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new tu(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(nu(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Zh(this.context.next,this.base,this.pos)}}function nu(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function ru(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}const iu=Vn.define(),ou=new ut;function su(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function au(e,t,n){for(let r of e.facet(iu)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=_h(e);if(r.length<n)return null;let i=null;for(let o=r.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<t)break;let a=s.type.prop(ou);if(a&&(s.to<r.length-50||r.length==e.doc.length||!su(s))){let r=a(s,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function lu(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const cu=mr.define({map:lu}),hu=mr.define({map:lu});function uu(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const du=Un.define({create:()=>ho.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=pu(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(cu)&&!mu(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(bu),i=r?ho.replace({widget:new Cu(r(t.state,n.value))}):Su;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(hu)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=pu(e,t.selection.main.head)),e},provide:e=>hl.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid JSON for fold state");t.push(Su.range(r,i))}return ho.set(t,!0)}});function pu(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function fu(e,t,n){var r;let i=null;return null===(r=e.field(du,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function mu(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function gu(e,t){return e.field(du,!1)?t:t.concat(mr.appendConfig.of(xu()))}function vu(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return hl.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const yu=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of uu(e)){let n=au(e.state,t.from,t.to);if(n)return e.dispatch({effects:gu(e.state,[cu.of(n),vu(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(du,!1))return!1;let t=[];for(let n of uu(e)){let r=fu(e.state,n.from,n.to);r&&t.push(hu.of(r),vu(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=au(t,i.from,i.to);o&&n.push(cu.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:gu(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(du,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(hu.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],wu={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bu=Vn.define({combine:e=>Or(e,wu)});function xu(e){return[du,Ou]}function ku(e,t){let{state:n}=e,r=n.facet(bu),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=fu(e.state,n.from,n.to);r&&e.dispatch({effects:hu.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const Su=ho.replace({widget:new class extends lo{toDOM(e){return ku(e,null)}}});class Cu extends lo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ku(e,this.value)}}const Mu={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Tu extends Ec{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Au(e={}){let t={...Mu,...e},n=new Tu(t,!0),r=new Tu(t,!1),i=ls.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(qh)!=e.state.facet(qh)||e.startState.field(du,!1)!=e.state.field(du,!1)||_h(e.startState)!=_h(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Pr;for(let i of e.viewportLineBlocks){let o=fu(e.state,i.from,i.to)?r:au(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,Rc({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||_r.empty},initialSpacer:()=>new Tu(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=fu(e.state,t.from,t.to);if(r)return e.dispatch({effects:hu.of(r)}),!0;let i=au(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:cu.of(i)}),!0)}}}),xu()]}const Ou=hl.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Nu{constructor(e,t){let n;function r(e){let t=Yr.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Eh?e=>e.prop(Ah)==o.data:o?e=>e==o:void 0,this.style=ah(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Yr(n):null,this.themeType=t.themeType}static define(e,t){return new Nu(e,t||{})}}const Eu=Vn.define(),Du=Vn.define({combine:e=>e.length?[e[0]]:null});function Iu(e){let t=e.facet(Eu);return t.length?t:e.facet(Du)}function _u(e,t){let n,r=[Ru];return e instanceof Nu&&(e.module&&r.push(hl.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(Du.of(e)):n?r.push(Eu.computeN([hl.darkTheme],t=>t.facet(hl.darkTheme)==("dark"==n)?[e]:[])):r.push(Eu.of(e)),r}class Pu{constructor(e){this.markCache=Object.create(null),this.tree=_h(e.state),this.decorations=this.buildDeco(e,Iu(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=_h(e.state),n=Iu(e.state),r=n!=Iu(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return ho.none;let n=new Pr;for(let{from:r,to:i}of e.visibleRanges)lh(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=ho.mark({class:r})))},r,i);return n.finish()}}const Ru=Zn.high(ls.fromClass(Pu,{decorations:e=>e.decorations})),Lu=Nu.define([{tag:Mh.meta,color:"#404740"},{tag:Mh.link,textDecoration:"underline"},{tag:Mh.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Mh.emphasis,fontStyle:"italic"},{tag:Mh.strong,fontWeight:"bold"},{tag:Mh.strikethrough,textDecoration:"line-through"},{tag:Mh.keyword,color:"#708"},{tag:[Mh.atom,Mh.bool,Mh.url,Mh.contentSeparator,Mh.labelName],color:"#219"},{tag:[Mh.literal,Mh.inserted],color:"#164"},{tag:[Mh.string,Mh.deleted],color:"#a11"},{tag:[Mh.regexp,Mh.escape,Mh.special(Mh.string)],color:"#e40"},{tag:Mh.definition(Mh.variableName),color:"#00f"},{tag:Mh.local(Mh.variableName),color:"#30a"},{tag:[Mh.typeName,Mh.namespace],color:"#085"},{tag:Mh.className,color:"#167"},{tag:[Mh.special(Mh.variableName),Mh.macroName],color:"#256"},{tag:Mh.definition(Mh.propertyName),color:"#00c"},{tag:Mh.comment,color:"#940"},{tag:Mh.invalid,color:"#f00"}]),Bu=hl.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),zu="()[]{}",Vu=Vn.define({combine:e=>Or(e,{afterCursor:!0,brackets:zu,maxScanDistance:1e4,renderMatch:qu})}),Fu=ho.mark({class:"cm-matchingBracket"}),Hu=ho.mark({class:"cm-nonmatchingBracket"});function qu(e){let t=[],n=e.matched?Fu:Hu;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const ju=Un.define({create:()=>ho.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(Vu);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=Ju(t.state,e.head,-1,r)||e.head>0&&Ju(t.state,e.head-1,1,r)||r.afterCursor&&(Ju(t.state,e.head,1,r)||e.head<t.state.doc.length&&Ju(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return ho.set(n,!0)},provide:e=>hl.decorations.from(e)}),$u=[ju,Bu];function Wu(e={}){return[Vu.of(e),$u]}const Uu=new ut;function Ku(e,t,n){let r=e.prop(t<0?ut.openedBy:ut.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Gu(e){let t=e.type.prop(Uu);return t?t(e.node):e}function Ju(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||zu,s=_h(e),a=s.resolveInner(t,n);for(let r=a;r;r=r.parent){let i=Ku(r.type,n,o);if(i&&r.from<r.to){let s=Gu(r);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return Yu(e,t,n,r,s,i,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,i,o)}function Yu(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do{if(n<0?h.to<=r.from:h.from>=r.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from<h.to){let e=Gu(h);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Ku(h.type,n,s))c++;else if(Ku(h.type,-n,s)){if(0==c){let e=Gu(h);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function Xu(e,t,n,r=0,i=0){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);let o=i;for(let i=r;i<t;i++)9==e.charCodeAt(i)?o+=n-o%n:o++;return o}class Zu{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e instanceof RegExp?e.test(n):e(n)),t)return++this.pos,n}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Xu(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return null!==(e=this.overrideIndent)&&void 0!==e?e:Xu(this.string,null,this.tabSize)}match(e,t,n){if("string"==typeof e){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function Qu(e){if("object"!=typeof e)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const ed=new WeakMap;class td extends Eh{constructor(e){let t,n=Oh(e.languageData),r=function(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||Qu,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||sd,mergeTokens:!1!==e.mergeTokens}}(e);super(n,new class extends zt{createParse(e,n,r){return new id(t,e,n,r)}},[],e.name),this.topNode=function(e,t){let n=ft.define({id:ad.length,name:"Document",props:[Ah.add(()=>e),Xh.add(()=>e=>t.getIndent(e))],top:!0});return ad.push(n),n}(n,this),t=this,this.streamParser=r,this.stateAfter=new ut({perNode:!0}),this.tokenTable=e.tokenTable?new dd(r.tokenTable):pd}static define(e){return new td(e)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=ed.get(e.state),null!=t&&t<e.pos-1e4&&(t=void 0));let r,i,o=nd(this,e.node.tree,e.node.from,e.node.from,null!=t?t:e.pos);if(o?(i=o.state,r=o.pos+1):(i=this.streamParser.startState(e.unit),r=e.node.from),e.pos-r>1e4)return null;for(;r<e.pos;){let t=e.state.doc.lineAt(r),o=Math.min(e.pos,t.to);if(t.length){let r=n?n(t.from):-1,s=new Zu(t.text,e.state.tabSize,e.unit,r<0?void 0:r);for(;s.pos<o-t.from;)od(this.streamParser.token,s,i)}else this.streamParser.blankLine(i,e.unit);if(o==e.pos)break;r=t.to+1}let s=e.lineAt(e.pos);return n&&null==t&&ed.set(e.state,s.from),this.streamParser.indent(i,/^\s*(.*)/.exec(s.text)[1],e)}get allowsNesting(){return!1}}function nd(e,t,n,r,i){let o=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(o)return{state:e.streamParser.copyState(o),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let s=t.children[o],a=n+t.positions[o],l=s instanceof wt&&a<i&&nd(e,s,a,r,i);if(l)return l}return null}function rd(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;i||0!=n||t.type!=e.topNode||(i=!0);for(let o=t.children.length-1;o>=0;o--){let s,a=t.positions[o],l=t.children[o];if(a<r&&l instanceof wt){if(!(s=rd(e,l,n-a,r-a,i)))break;return i?new wt(t.type,t.children.slice(0,o).concat(s),t.positions.slice(0,o+1),a+s.length):s}}return null}class id{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=Lh.get(),o=r[0].from,{state:s,tree:a}=function(e,t,n,r,i){for(let i of t){let t,o=i.from+(i.openStart?25:0),s=i.to-(i.openEnd?25:0),a=o<=n&&s>n&&nd(e,i.tree,0-i.offset,n,s);if(a&&a.pos<=r&&(t=rd(e,i.tree,n+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:t}}return{state:e.streamParser.startState(i?Kh(i):4),tree:wt.empty}}(e,n,o,this.to,null==i?void 0:i.state);this.state=s,this.parsedPos=this.chunkStart=o+a.length;for(let e=0;e<a.children.length;e++)this.chunks.push(a.children[e]),this.chunkPos.push(a.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(Kh(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=Lh.get(),t=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n)break;if(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length)break;let i=this.ranges[e].from,o=this.lineAfter(i);t+=o,n=i+o.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;t+=this.ranges[++this.rangeIndex].from-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){t+=r=this.skipGapsTo(t,r,1);let e=this.chunk.length;n+=r=this.skipGapsTo(n,r,-1),i+=this.chunk.length-e}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&4==i&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,o=new Zu(t,e?e.state.tabSize:4,e?Kh(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let e=od(i.token,o,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=wt.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:ld,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new wt(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new wt(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function od(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw new Error("Stream parser failed to advance stream.")}const sd=Object.create(null),ad=[ft.none],ld=new mt(ad),cd=[],hd=Object.create(null),ud=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ud[e]=md(sd,t);class dd{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),ud)}resolve(e){return e?this.table[e]||(this.table[e]=md(this.extra,e)):0}}const pd=new dd(sd);function fd(e,t){cd.indexOf(e)>-1||(cd.push(e),console.warn(t))}function md(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||Mh[n];r?"function"==typeof r?t.length?t=t.map(r):fd(n,`Modifier ${n} used at start of tag`):t.length?fd(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:fd(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=hd[i];if(o)return o.id;let s=hd[i]=ft.define({id:ad.length,name:r,props:[ih({[r]:n})]});return ad.push(s),s.id}function gd(e){return new jh(td.define(e))}function vd(e){return Promise.resolve().then(()=>require("./index-CLgcgbOT.cjs")).then(t=>t.sql({dialect:t[e]}))}So.RTL,So.LTR;const yd=[$h.of({name:"C",extensions:["c","h","ino"],load:()=>Promise.resolve().then(()=>require("./index-CrA_KK1J.cjs")).then(e=>e.cpp())}),$h.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>Promise.resolve().then(()=>require("./index-CrA_KK1J.cjs")).then(e=>e.cpp())}),$h.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>vd("Cassandra")}),$h.of({name:"CSS",extensions:["css"],load:()=>Promise.resolve().then(()=>require("./index-CJfX-kOc.cjs")).then(e=>e.css())}),$h.of({name:"Go",extensions:["go"],load:()=>Promise.resolve().then(()=>require("./index-DD3pDFDN.cjs")).then(e=>e.go())}),$h.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>Promise.resolve().then(()=>require("./index-DhqL6bag.cjs")).then(e=>e.html())}),$h.of({name:"Java",extensions:["java"],load:()=>Promise.resolve().then(()=>require("./index-DvuuGDob.cjs")).then(e=>e.java())}),$h.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>Promise.resolve().then(()=>require("./index-gIqivS4c.cjs")).then(e=>e.javascript())}),$h.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>Promise.resolve().then(()=>require("./index-a2kYnnvX.cjs")).then(e=>e.jinja())}),$h.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>Promise.resolve().then(()=>require("./index-C2hO0yQX.cjs")).then(e=>e.json())}),$h.of({name:"JSX",extensions:["jsx"],load:()=>Promise.resolve().then(()=>require("./index-gIqivS4c.cjs")).then(e=>e.javascript({jsx:!0}))}),$h.of({name:"LESS",extensions:["less"],load:()=>Promise.resolve().then(()=>require("./index-B8g-Emd_.cjs")).then(e=>e.less())}),$h.of({name:"Liquid",extensions:["liquid"],load:()=>Promise.resolve().then(()=>require("./index-DgjCLKdD.cjs")).then(e=>e.liquid())}),$h.of({name:"MariaDB SQL",load:()=>vd("MariaSQL")}),$h.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>Promise.resolve().then(()=>require("./index-Y2ncXqt9.cjs")).then(e=>e.markdown())}),$h.of({name:"MS SQL",load:()=>vd("MSSQL")}),$h.of({name:"MySQL",load:()=>vd("MySQL")}),$h.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>Promise.resolve().then(()=>require("./index-B8qgDwc2.cjs")).then(e=>e.php())}),$h.of({name:"PLSQL",extensions:["pls"],load:()=>vd("PLSQL")}),$h.of({name:"PostgreSQL",load:()=>vd("PostgreSQL")}),$h.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>Promise.resolve().then(()=>require("./index-CdQh0Fyo.cjs")).then(e=>e.python())}),$h.of({name:"Rust",extensions:["rs"],load:()=>Promise.resolve().then(()=>require("./index-CnaX07f3.cjs")).then(e=>e.rust())}),$h.of({name:"Sass",extensions:["sass"],load:()=>Promise.resolve().then(()=>require("./index-MEXcFr58.cjs")).then(e=>e.sass({indented:!0}))}),$h.of({name:"SCSS",extensions:["scss"],load:()=>Promise.resolve().then(()=>require("./index-MEXcFr58.cjs")).then(e=>e.sass())}),$h.of({name:"SQL",extensions:["sql"],load:()=>vd("StandardSQL")}),$h.of({name:"SQLite",load:()=>vd("SQLite")}),$h.of({name:"TSX",extensions:["tsx"],load:()=>Promise.resolve().then(()=>require("./index-gIqivS4c.cjs")).then(e=>e.javascript({jsx:!0,typescript:!0}))}),$h.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>Promise.resolve().then(()=>require("./index-gIqivS4c.cjs")).then(e=>e.javascript({typescript:!0}))}),$h.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>Promise.resolve().then(()=>require("./index-ChoC78fj.cjs")).then(e=>e.wast())}),$h.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>Promise.resolve().then(()=>require("./index-D1-a3lpN.cjs")).then(e=>e.xml())}),$h.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>Promise.resolve().then(()=>require("./index-BjVxfywp.cjs")).then(e=>e.yaml())}),$h.of({name:"APL",extensions:["dyalog","apl"],load:()=>Promise.resolve().then(()=>require("./apl-zQnQXYyi.cjs")).then(e=>gd(e.apl))}),$h.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>Promise.resolve().then(()=>require("./asciiarmor-BjFlPGAR.cjs")).then(e=>gd(e.asciiArmor))}),$h.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>Promise.resolve().then(()=>require("./asn1-Dn9-fgGr.cjs")).then(e=>gd(e.asn1({})))}),$h.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>Promise.resolve().then(()=>require("./asterisk-DIP73UbG.cjs")).then(e=>gd(e.asterisk))}),$h.of({name:"Brainfuck",extensions:["b","bf"],load:()=>Promise.resolve().then(()=>require("./brainfuck-DNcy2VoQ.cjs")).then(e=>gd(e.brainfuck))}),$h.of({name:"Cobol",extensions:["cob","cpy"],load:()=>Promise.resolve().then(()=>require("./cobol-D7gesrhf.cjs")).then(e=>gd(e.cobol))}),$h.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.csharp))}),$h.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>Promise.resolve().then(()=>require("./clojure-C7e7OTgK.cjs")).then(e=>gd(e.clojure))}),$h.of({name:"ClojureScript",extensions:["cljs"],load:()=>Promise.resolve().then(()=>require("./clojure-C7e7OTgK.cjs")).then(e=>gd(e.clojure))}),$h.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>Promise.resolve().then(()=>require("./css-DQQ8GO25.cjs")).then(e=>gd(e.gss))}),$h.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>Promise.resolve().then(()=>require("./cmake-DK3UdjBB.cjs")).then(e=>gd(e.cmake))}),$h.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>Promise.resolve().then(()=>require("./coffeescript-CMaRvZDo.cjs")).then(e=>gd(e.coffeeScript))}),$h.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>Promise.resolve().then(()=>require("./commonlisp-BsK54Tey.cjs")).then(e=>gd(e.commonLisp))}),$h.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>Promise.resolve().then(()=>require("./cypher-CX8oWNVh.cjs")).then(e=>gd(e.cypher))}),$h.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>Promise.resolve().then(()=>require("./python-4hVbH2VM.cjs")).then(e=>gd(e.cython))}),$h.of({name:"Crystal",extensions:["cr"],load:()=>Promise.resolve().then(()=>require("./crystal-BueyCNDj.cjs")).then(e=>gd(e.crystal))}),$h.of({name:"D",extensions:["d"],load:()=>Promise.resolve().then(()=>require("./d-Cer4WZq7.cjs")).then(e=>gd(e.d))}),$h.of({name:"Dart",extensions:["dart"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.dart))}),$h.of({name:"diff",extensions:["diff","patch"],load:()=>Promise.resolve().then(()=>require("./diff-DanWUMqA.cjs")).then(e=>gd(e.diff))}),$h.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>Promise.resolve().then(()=>require("./dockerfile-D72m9Krh.cjs")).then(e=>gd(e.dockerFile))}),$h.of({name:"DTD",extensions:["dtd"],load:()=>Promise.resolve().then(()=>require("./dtd-N9E8mrwW.cjs")).then(e=>gd(e.dtd))}),$h.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>Promise.resolve().then(()=>require("./dylan-BmN4EGo8.cjs")).then(e=>gd(e.dylan))}),$h.of({name:"EBNF",load:()=>Promise.resolve().then(()=>require("./ebnf-CHmKiAoS.cjs")).then(e=>gd(e.ebnf))}),$h.of({name:"ECL",extensions:["ecl"],load:()=>Promise.resolve().then(()=>require("./ecl-DjtL7UT3.cjs")).then(e=>gd(e.ecl))}),$h.of({name:"edn",extensions:["edn"],load:()=>Promise.resolve().then(()=>require("./clojure-C7e7OTgK.cjs")).then(e=>gd(e.clojure))}),$h.of({name:"Eiffel",extensions:["e"],load:()=>Promise.resolve().then(()=>require("./eiffel-u8sFjvpJ.cjs")).then(e=>gd(e.eiffel))}),$h.of({name:"Elm",extensions:["elm"],load:()=>Promise.resolve().then(()=>require("./elm-DJqCmzHQ.cjs")).then(e=>gd(e.elm))}),$h.of({name:"Erlang",extensions:["erl"],load:()=>Promise.resolve().then(()=>require("./erlang-aNM9Wno5.cjs")).then(e=>gd(e.erlang))}),$h.of({name:"Esper",load:()=>Promise.resolve().then(()=>require("./sql-YL702_qL.cjs")).then(e=>gd(e.esper))}),$h.of({name:"Factor",extensions:["factor"],load:()=>Promise.resolve().then(()=>require("./factor-DAjbIl49.cjs")).then(e=>gd(e.factor))}),$h.of({name:"FCL",load:()=>Promise.resolve().then(()=>require("./fcl-CplLEkwW.cjs")).then(e=>gd(e.fcl))}),$h.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>Promise.resolve().then(()=>require("./forth-CqDKyQE2.cjs")).then(e=>gd(e.forth))}),$h.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>Promise.resolve().then(()=>require("./fortran-N3iQ92Ni.cjs")).then(e=>gd(e.fortran))}),$h.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>Promise.resolve().then(()=>require("./mllike-DNBMjfDT.cjs")).then(e=>gd(e.fSharp))}),$h.of({name:"Gas",extensions:["s"],load:()=>Promise.resolve().then(()=>require("./gas-BZkkcdED.cjs")).then(e=>gd(e.gas))}),$h.of({name:"Gherkin",extensions:["feature"],load:()=>Promise.resolve().then(()=>require("./gherkin-CxCA0y5R.cjs")).then(e=>gd(e.gherkin))}),$h.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>Promise.resolve().then(()=>require("./groovy-BQvSfgjf.cjs")).then(e=>gd(e.groovy))}),$h.of({name:"Haskell",extensions:["hs"],load:()=>Promise.resolve().then(()=>require("./haskell-D7NTJ5RY.cjs")).then(e=>gd(e.haskell))}),$h.of({name:"Haxe",extensions:["hx"],load:()=>Promise.resolve().then(()=>require("./haxe-Cd8JQ-kk.cjs")).then(e=>gd(e.haxe))}),$h.of({name:"HXML",extensions:["hxml"],load:()=>Promise.resolve().then(()=>require("./haxe-Cd8JQ-kk.cjs")).then(e=>gd(e.hxml))}),$h.of({name:"HTTP",load:()=>Promise.resolve().then(()=>require("./http-t7fOg_NY.cjs")).then(e=>gd(e.http))}),$h.of({name:"IDL",extensions:["pro"],load:()=>Promise.resolve().then(()=>require("./idl-CMWyLfiW.cjs")).then(e=>gd(e.idl))}),$h.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>Promise.resolve().then(()=>require("./javascript-D6Y0eXWo.cjs")).then(e=>gd(e.jsonld))}),$h.of({name:"Julia",extensions:["jl"],load:()=>Promise.resolve().then(()=>require("./julia-BFjC6Od-.cjs")).then(e=>gd(e.julia))}),$h.of({name:"Kotlin",extensions:["kt","kts"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.kotlin))}),$h.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>Promise.resolve().then(()=>require("./livescript-BEKRTOP4.cjs")).then(e=>gd(e.liveScript))}),$h.of({name:"Lua",extensions:["lua"],load:()=>Promise.resolve().then(()=>require("./lua-B3w2r80v.cjs")).then(e=>gd(e.lua))}),$h.of({name:"mIRC",extensions:["mrc"],load:()=>Promise.resolve().then(()=>require("./mirc-DKj7vbBK.cjs")).then(e=>gd(e.mirc))}),$h.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>Promise.resolve().then(()=>require("./mathematica-BeWz3n7v.cjs")).then(e=>gd(e.mathematica))}),$h.of({name:"Modelica",extensions:["mo"],load:()=>Promise.resolve().then(()=>require("./modelica-D0zQ5M5B.cjs")).then(e=>gd(e.modelica))}),$h.of({name:"MUMPS",extensions:["mps"],load:()=>Promise.resolve().then(()=>require("./mumps-DQ_3S9Ud.cjs")).then(e=>gd(e.mumps))}),$h.of({name:"Mbox",extensions:["mbox"],load:()=>Promise.resolve().then(()=>require("./mbox-B-KNExnr.cjs")).then(e=>gd(e.mbox))}),$h.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>Promise.resolve().then(()=>require("./nginx-BxNxyOuV.cjs")).then(e=>gd(e.nginx))}),$h.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>Promise.resolve().then(()=>require("./nsis-DPoxhFCA.cjs")).then(e=>gd(e.nsis))}),$h.of({name:"NTriples",extensions:["nt","nq"],load:()=>Promise.resolve().then(()=>require("./ntriples-D7LF77EX.cjs")).then(e=>gd(e.ntriples))}),$h.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.objectiveC))}),$h.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.objectiveCpp))}),$h.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>Promise.resolve().then(()=>require("./mllike-DNBMjfDT.cjs")).then(e=>gd(e.oCaml))}),$h.of({name:"Octave",extensions:["m"],load:()=>Promise.resolve().then(()=>require("./octave-C3xiZjFR.cjs")).then(e=>gd(e.octave))}),$h.of({name:"Oz",extensions:["oz"],load:()=>Promise.resolve().then(()=>require("./oz-hv8iHpBf.cjs")).then(e=>gd(e.oz))}),$h.of({name:"Pascal",extensions:["p","pas"],load:()=>Promise.resolve().then(()=>require("./pascal-Dik6Bdx0.cjs")).then(e=>gd(e.pascal))}),$h.of({name:"Perl",extensions:["pl","pm"],load:()=>Promise.resolve().then(()=>require("./perl-Dc23MFYf.cjs")).then(e=>gd(e.perl))}),$h.of({name:"Pig",extensions:["pig"],load:()=>Promise.resolve().then(()=>require("./pig-DnhgnaAt.cjs")).then(e=>gd(e.pig))}),$h.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>Promise.resolve().then(()=>require("./powershell-DIx6LGo6.cjs")).then(e=>gd(e.powerShell))}),$h.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>Promise.resolve().then(()=>require("./properties-C6mOHf2m.cjs")).then(e=>gd(e.properties))}),$h.of({name:"ProtoBuf",extensions:["proto"],load:()=>Promise.resolve().then(()=>require("./protobuf-zKe6cAIt.cjs")).then(e=>gd(e.protobuf))}),$h.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>Promise.resolve().then(()=>require("./pug-fO_wg3KT.cjs")).then(e=>gd(e.pug))}),$h.of({name:"Puppet",extensions:["pp"],load:()=>Promise.resolve().then(()=>require("./puppet-BVD6XdcM.cjs")).then(e=>gd(e.puppet))}),$h.of({name:"Q",extensions:["q"],load:()=>Promise.resolve().then(()=>require("./q-xj0roXkX.cjs")).then(e=>gd(e.q))}),$h.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>Promise.resolve().then(()=>require("./r-D3PcvI1z.cjs")).then(e=>gd(e.r))}),$h.of({name:"RPM Changes",load:()=>Promise.resolve().then(()=>require("./rpm-en7QUikA.cjs")).then(e=>gd(e.rpmChanges))}),$h.of({name:"RPM Spec",extensions:["spec"],load:()=>Promise.resolve().then(()=>require("./rpm-en7QUikA.cjs")).then(e=>gd(e.rpmSpec))}),$h.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>Promise.resolve().then(()=>require("./ruby-B5mrZV-E.cjs")).then(e=>gd(e.ruby))}),$h.of({name:"SAS",extensions:["sas"],load:()=>Promise.resolve().then(()=>require("./sas-DihmCBR4.cjs")).then(e=>gd(e.sas))}),$h.of({name:"Scala",extensions:["scala"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.scala))}),$h.of({name:"Scheme",extensions:["scm","ss"],load:()=>Promise.resolve().then(()=>require("./scheme-D4lhRHzG.cjs")).then(e=>gd(e.scheme))}),$h.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>Promise.resolve().then(()=>require("./shell-5Optxxtq.cjs")).then(e=>gd(e.shell))}),$h.of({name:"Sieve",extensions:["siv","sieve"],load:()=>Promise.resolve().then(()=>require("./sieve-woNLjsDA.cjs")).then(e=>gd(e.sieve))}),$h.of({name:"Smalltalk",extensions:["st"],load:()=>Promise.resolve().then(()=>require("./smalltalk-WUDknFHI.cjs")).then(e=>gd(e.smalltalk))}),$h.of({name:"Solr",load:()=>Promise.resolve().then(()=>require("./solr-Dv5yQw8C.cjs")).then(e=>gd(e.solr))}),$h.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>Promise.resolve().then(()=>require("./mllike-DNBMjfDT.cjs")).then(e=>gd(e.sml))}),$h.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>Promise.resolve().then(()=>require("./sparql-Ne__rGfz.cjs")).then(e=>gd(e.sparql))}),$h.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>Promise.resolve().then(()=>require("./spreadsheet-sA8wKbVn.cjs")).then(e=>gd(e.spreadsheet))}),$h.of({name:"Squirrel",extensions:["nut"],load:()=>Promise.resolve().then(()=>require("./clike-CSjUq15U.cjs")).then(e=>gd(e.squirrel))}),$h.of({name:"Stylus",extensions:["styl"],load:()=>Promise.resolve().then(()=>require("./stylus-CaoJxDo0.cjs")).then(e=>gd(e.stylus))}),$h.of({name:"Swift",extensions:["swift"],load:()=>Promise.resolve().then(()=>require("./swift-D7nDGOwE.cjs")).then(e=>gd(e.swift))}),$h.of({name:"sTeX",load:()=>Promise.resolve().then(()=>require("./stex-0KIfGD5U.cjs")).then(e=>gd(e.stex))}),$h.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>Promise.resolve().then(()=>require("./stex-0KIfGD5U.cjs")).then(e=>gd(e.stex))}),$h.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>Promise.resolve().then(()=>require("./verilog-CcB4aIua.cjs")).then(e=>gd(e.verilog))}),$h.of({name:"Tcl",extensions:["tcl"],load:()=>Promise.resolve().then(()=>require("./tcl-CKXdgq-y.cjs")).then(e=>gd(e.tcl))}),$h.of({name:"Textile",extensions:["textile"],load:()=>Promise.resolve().then(()=>require("./textile-CCW3yDUP.cjs")).then(e=>gd(e.textile))}),$h.of({name:"TiddlyWiki",load:()=>Promise.resolve().then(()=>require("./tiddlywiki-C-W_icqq.cjs")).then(e=>gd(e.tiddlyWiki))}),$h.of({name:"Tiki wiki",load:()=>Promise.resolve().then(()=>require("./tiki-DrQIeHRf.cjs")).then(e=>gd(e.tiki))}),$h.of({name:"TOML",extensions:["toml"],load:()=>Promise.resolve().then(()=>require("./toml-CY1HDY9K.cjs")).then(e=>gd(e.toml))}),$h.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>Promise.resolve().then(()=>require("./troff-Yww0HU2c.cjs")).then(e=>gd(e.troff))}),$h.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>Promise.resolve().then(()=>require("./ttcn-D-KkrC_Y.cjs")).then(e=>gd(e.ttcn))}),$h.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>Promise.resolve().then(()=>require("./ttcn-cfg-DEW0CUak.cjs")).then(e=>gd(e.ttcnCfg))}),$h.of({name:"Turtle",extensions:["ttl"],load:()=>Promise.resolve().then(()=>require("./turtle-CNPaIIfW.cjs")).then(e=>gd(e.turtle))}),$h.of({name:"Web IDL",extensions:["webidl"],load:()=>Promise.resolve().then(()=>require("./webidl-YkXkSuHd.cjs")).then(e=>gd(e.webIDL))}),$h.of({name:"VB.NET",extensions:["vb"],load:()=>Promise.resolve().then(()=>require("./vb-CW7t9lKI.cjs")).then(e=>gd(e.vb))}),$h.of({name:"VBScript",extensions:["vbs"],load:()=>Promise.resolve().then(()=>require("./vbscript-D2Gs3oEd.cjs")).then(e=>gd(e.vbScript))}),$h.of({name:"Velocity",extensions:["vtl"],load:()=>Promise.resolve().then(()=>require("./velocity-BpfD1zFY.cjs")).then(e=>gd(e.velocity))}),$h.of({name:"Verilog",extensions:["v"],load:()=>Promise.resolve().then(()=>require("./verilog-CcB4aIua.cjs")).then(e=>gd(e.verilog))}),$h.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>Promise.resolve().then(()=>require("./vhdl-9LHG0O1e.cjs")).then(e=>gd(e.vhdl))}),$h.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>Promise.resolve().then(()=>require("./xquery-DwwVyz90.cjs")).then(e=>gd(e.xQuery))}),$h.of({name:"Yacas",extensions:["ys"],load:()=>Promise.resolve().then(()=>require("./yacas-cn_NTwBk.cjs")).then(e=>gd(e.yacas))}),$h.of({name:"Z80",extensions:["z80"],load:()=>Promise.resolve().then(()=>require("./z80-B9lBbT6u.cjs")).then(e=>gd(e.z80))}),$h.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>Promise.resolve().then(()=>require("./mscgen-DXB_4N_e.cjs")).then(e=>gd(e.mscgen))}),$h.of({name:"Xù",extensions:["xu"],load:()=>Promise.resolve().then(()=>require("./mscgen-DXB_4N_e.cjs")).then(e=>gd(e.xu))}),$h.of({name:"MsGenny",extensions:["msgenny"],load:()=>Promise.resolve().then(()=>require("./mscgen-DXB_4N_e.cjs")).then(e=>gd(e.msgenny))}),$h.of({name:"Vue",extensions:["vue"],load:()=>Promise.resolve().then(()=>require("./index-BA_fGRsg.cjs")).then(e=>e.vue())}),$h.of({name:"Angular Template",load:()=>Promise.resolve().then(()=>require("./index-BP_HzP4g.cjs")).then(e=>e.angular())})],wd="#e06c75",bd="#abb2bf",xd="#7d8799",kd="#d19a66",Sd="#2c313a",Cd="#282c34",Md="#353a42",Td="#528bff",Ad=[hl.theme({"&":{color:bd,backgroundColor:Cd},".cm-content":{caretColor:Td},".cm-cursor, .cm-dropCursor":{borderLeftColor:Td},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:bd},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Cd,color:xd,border:"none"},".cm-activeLineGutter":{backgroundColor:Sd},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Md},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Md,borderBottomColor:Md},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Sd,color:bd}}},{dark:!0}),_u(Nu.define([{tag:Mh.keyword,color:"#c678dd"},{tag:[Mh.name,Mh.deleted,Mh.character,Mh.propertyName,Mh.macroName],color:wd},{tag:[Mh.function(Mh.variableName),Mh.labelName],color:"#61afef"},{tag:[Mh.color,Mh.constant(Mh.name),Mh.standard(Mh.name)],color:kd},{tag:[Mh.definition(Mh.name),Mh.separator],color:bd},{tag:[Mh.typeName,Mh.className,Mh.number,Mh.changed,Mh.annotation,Mh.modifier,Mh.self,Mh.namespace],color:"#e5c07b"},{tag:[Mh.operator,Mh.operatorKeyword,Mh.url,Mh.escape,Mh.regexp,Mh.link,Mh.special(Mh.string)],color:"#56b6c2"},{tag:[Mh.meta,Mh.comment],color:xd},{tag:Mh.strong,fontWeight:"bold"},{tag:Mh.emphasis,fontStyle:"italic"},{tag:Mh.strikethrough,textDecoration:"line-through"},{tag:Mh.link,color:xd,textDecoration:"underline"},{tag:Mh.heading,fontWeight:"bold",color:wd},{tag:[Mh.atom,Mh.bool,Mh.special(Mh.variableName)],color:kd},{tag:[Mh.processingInstruction,Mh.string,Mh.inserted],color:"#98c379"},{tag:Mh.invalid,color:"#ffffff"}]))];function Od(e){this.content=e}function Nd(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let e=0;i.text[e]==o.text[e];e++)n++;return n}if(i.content.size||o.content.size){let e=Nd(i.content,o.content,n+1);if(null!=e)return e}n+=i.nodeSize}else n+=i.nodeSize}}function Ed(e,t,n,r){for(let i=e.childCount,o=t.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};let s=e.child(--i),a=t.child(--o),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Ed(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}Od.prototype={constructor:Od,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return-1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new Od(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Od(n)},addToStart:function(e,t){return new Od([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Od(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new Od(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Od.from(e)).size?new Od(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Od.from(e)).size?new Od(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Od.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Od.from=function(e){if(e instanceof Od)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Od(t)};let Dd=class e{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,o=0;o<n;e++){let s=this.content[e],a=o+s.nodeSize;a>t&&((o<t||a>n)&&(s=s.isText?s.cut(Math.max(0,t-o),Math.min(s.text.length,n-o)):s.cut(Math.max(0,t-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=a}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,o)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Nd(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ed(this,e,t,n)}findIndex(e){if(0==e)return _d(0,e);if(e==this.size)return _d(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?_d(t+1,r):_d(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||(n=t.slice(0,e)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Dd.empty=new Dd([],0);const Id={index:0,offset:0};function _d(e,t){return Id.index=e,Id.offset=t,Id}function Pd(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Pd(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Pd(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Rd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Pd(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Rd.none;if(e instanceof Rd)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Rd.none=[];class Ld extends Error{}let Bd=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Vd(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(zd(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new e(Dd.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};function zd(e,t,n){let{index:r,offset:i}=e.findIndex(t),o=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(i==t||o.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(zd(o.content,t-i-1,n-i-1)))}function Vd(e,t,n,r){let{index:i,offset:o}=e.findIndex(t),s=e.maybeChild(i);if(o==t||s.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=Vd(s.content,t-o-1,n,s);return a&&e.replaceChild(i,s.copy(a))}function Fd(e,t,n){if(n.openStart>e.depth)throw new Ld("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ld("Inconsistent open depths");return Hd(e,t,n,0)}function Hd(e,t,n,r){let i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let s=Hd(e,t,n,r+1);return o.copy(o.content.replaceChild(i,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:i,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Dd.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Ud(o,Kd(e,i,s,t,r))}{let r=e.parent,i=r.content;return Ud(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}}return Ud(o,Gd(e,t,r))}function qd(e,t){if(!t.type.compatibleContent(e.type))throw new Ld("Cannot join "+t.type.name+" onto "+e.type.name)}function jd(e,t,n){let r=e.node(n);return qd(r,t.node(n)),r}function $d(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Wd(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&($d(e.nodeAfter,r),o++));for(let e=o;e<s;e++)$d(i.child(e),r);t&&t.depth==n&&t.textOffset&&$d(t.nodeBefore,r)}function Ud(e,t){return e.type.checkContent(t),e.copy(t)}function Kd(e,t,n,r,i){let o=e.depth>i&&jd(e,t,i+1),s=r.depth>i&&jd(n,r,i+1),a=[];return Wd(null,e,i,a),o&&s&&t.index(i)==n.index(i)?(qd(o,s),$d(Ud(o,Kd(e,t,n,r,i+1)),a)):(o&&$d(Ud(o,Gd(e,t,i+1)),a),Wd(t,n,i,a),s&&$d(Ud(s,Gd(n,r,i+1)),a)),Wd(r,null,i,a),new Dd(a)}function Gd(e,t,n){let r=[];if(Wd(null,e,n,r),e.depth>n){$d(Ud(jd(e,t,n+1),Gd(e,t,n+1)),r)}return Wd(t,null,n,r),new Dd(r)}Bd.empty=new Bd(Dd.empty,0,0);class Jd{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Rd.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Qd(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s)break;if(t=t.child(e),t.isText)break;i=s-1,r+=o+1}return new Jd(t,n,i)}static resolveCached(e,t){let n=Zd.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else Zd.set(e,n=new Yd);let r=n.elts[n.i]=Jd.resolve(e,t);return n.i=(n.i+1)%Xd,r}}class Yd{constructor(){this.elts=[],this.i=0}}const Xd=12,Zd=new WeakMap;class Qd{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ep=Object.create(null);let tp=class e{constructor(e,t,n,r=Rd.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Dd.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Pd(this.attrs,t||e.defaultAttrs||ep)&&Rd.sameSet(this.marks,n||Rd.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Bd.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o),a=r.node(o).content.cut(r.pos-s,i.pos-s);return new Bd(a,r.depth-o,i.depth-o)}replace(e,t,n){return Fd(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Jd.resolveCached(this,e)}resolveNoCache(e){return Jd.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),rp(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Dd.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Rd.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Rd.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Dd.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};tp.prototype.text=void 0;let np=class e extends tp{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rp(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function rp(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ip{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new op(e,t);if(null==n.next)return ip.empty;let r=sp(n);n.next&&n.err("Unexpected trailing text");let i=function(e){let t=Object.create(null);return n(dp(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);dp(e,n).forEach(e=>{r||i.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let o=t[r.join(",")]=new ip(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(up);o.next.push({type:i[e][0],next:t[r.join(",")]||n(r)})}return o}}(function(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function o(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(o(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),i(o(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return i(o(e.expr,t),s),i(o(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(o(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();i(o(e.expr,s),t),s=t}if(-1==e.max)i(o(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),i(o(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=o(e.exprs[r],t);if(r==e.exprs.length-1)return s;i(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(o,s){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return Dd.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}ip.empty=new ip(!0);class op{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function sp(e){let t=[];do{t.push(ap(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ap(e){let t=[];do{t.push(lp(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function lp(e){let t=function(e){if(e.eat("(")){let t=sp(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=hp(e,t)}return t}function cp(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function hp(e,t){let n=cp(e),r=n;return e.eat(",")&&(r="}"!=e.next?cp(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function up(e,t){return t-e}function dp(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(up)}function pp(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function fp(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=t.default}n[r]=i}return n}function mp(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function gp(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new yp(e,r,t[r]);return n}let vp=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=gp(e,n.attrs),this.defaultAttrs=pp(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ip.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fp(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tp(this,this.computeAttrs(e),Dd.from(t),Rd.setFrom(n))}createChecked(e=null,t,n){return t=Dd.from(t),this.checkContent(t),new tp(this,this.computeAttrs(e),t,Rd.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Dd.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Dd.empty,!0);return i?new tp(this,e,t.append(i),Rd.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){mp(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Rd.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class yp{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class wp{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=gp(e,r.attrs),this.excluded=null;let i=pp(this.attrs);this.instance=i?new Rd(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Rd(this,fp(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new wp(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){mp(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bp{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Od.from(e.nodes),t.marks=Od.from(e.marks||{}),this.nodes=vp.compile(this.spec.nodes,this),this.marks=wp.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ip.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?xp(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:xp(this,n.split(" "))}this.nodeFromJSON=e=>tp.fromJSON(this,e),this.markFromJSON=e=>Rd.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof vp))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new np(n,n.defaultAttrs,e,Rd.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function xp(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class kp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Op(this,t,!1);return n.addAll(e,Rd.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Op(this,t,!0);return n.addAll(e,Rd.none,t.from,t.to),Bd.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Np(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(!(0!=o.indexOf(e)||r.context&&!n.matchesContext(r.context)||o.length>e.length&&(61!=o.charCodeAt(e.length)||o.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ep(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ep(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new kp(e,kp.schemaRules(e)))}}const Sp={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Cp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Mp={ol:!0,ul:!0};function Tp(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Ap{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=Rd.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Dd.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Dd.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Dd.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Sp.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Op{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,i=t.topNode,o=Tp(null,t.preserveWhitespace,0)|(n?4:0);r=i?new Ap(i.type,i.attrs,Rd.none,!0,t.topMatch||i.type.contentMatch,o):new Ap(n?null:e.schema.topNodeType,null,Rd.none,!0,null,o),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o,s=e.nodeName.toLowerCase();Mp.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Mp.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Cp.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Sp.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let o=a&&a.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Rd.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Dp(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=Tp(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=Rd.none;return n=n.filter(t=>!(o.type?o.type.allowsMarkType(t.type):Dp(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new Ap(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Np(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ep(e){let t={};for(let n in e)t[n]=e[n];return t}function Dp(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t)return!0;if(o.indexOf(i)<0&&s(i))return!0}};if(s(i.contentMatch))return!0}}class Ip{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Pp(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(this.marks[t.type.name]){if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}else o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Bp(Pp(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Bp(Pp(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Bp(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ip(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=_p(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return _p(e.marks)}}function _p(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Pp(e){return e.document||window.document}const Rp=new WeakMap;function Lp(e){let t=Rp.get(e);return void 0===t&&Rp.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Bp(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let i,o=t[0];if("string"!=typeof o)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Lp(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=o.indexOf(" ");a>0&&(n=o.slice(0,a),o=o.slice(a+1));let l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],h=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){h=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let i=h;i<t.length;i++){let o=t[i];if(0===o){if(i<t.length-1||i>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:i}=Bp(e,o,n,r);if(l.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}const zp=Math.pow(2,16);function Vp(e,t){return e+t*zp}function Fp(e){return 65535&e}class Hp{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class qp{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&qp.empty)return qp.empty}recover(e){let t=0,n=Fp(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/zp}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],h=a+l;if(e<=h){let i=a+r+((l?e==a?-1:e==h?1:t:t)<0?0:c);if(n)return i;let o=e==(t<0?a:h)?null:Vp(s/3,e-a),u=e==a?2:e==h?1:4;return(t<0?e!=a:e!=h)&&(u|=8),new Hp(i,u,o)}r+=c-l}return n?e+r:new Hp(e+r,0,null)}touches(e,t){let n=0,r=Fp(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new qp(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?qp.empty:new qp(e<0?[0,-e,0]:[0,0,e])}}qp.empty=new qp([]);class jp{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new jp(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new jp;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Hp(e,r,null)}}const $p=Object.create(null);class Wp{getMap(){return qp.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=$p[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in $p)throw new RangeError("Duplicate use of step JSON ID "+e);return $p[e]=t,t.prototype.jsonID=e,t}}class Up{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Up(e,null)}static fail(e){return new Up(null,e)}static fromReplace(e,t,n,r){try{return Up.ok(e.replace(t,n,r))}catch(e){if(e instanceof Ld)return Up.fail(e.message);throw e}}}function Kp(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(Kp(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return Dd.fromArray(r)}class Gp extends Wp{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Bd(Kp(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return Up.fromReplace(e,this.from,this.to,i)}invert(){return new Jp(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Gp(t.pos,n.pos,this.mark)}merge(e){return e instanceof Gp&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gp(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gp(t.from,t.to,e.markFromJSON(t.mark))}}Wp.jsonID("addMark",Gp);class Jp extends Wp{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Bd(Kp(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Up.fromReplace(e,this.from,this.to,n)}invert(){return new Gp(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Jp(t.pos,n.pos,this.mark)}merge(e){return e instanceof Jp&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jp(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Jp(t.from,t.to,e.markFromJSON(t.mark))}}Wp.jsonID("removeMark",Jp);class Yp extends Wp{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Up.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Up.fromReplace(e,this.pos,this.pos+1,new Bd(Dd.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new Yp(this.pos,t.marks[n]);return new Yp(this.pos,this.mark)}}return new Xp(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yp(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Yp(t.pos,e.markFromJSON(t.mark))}}Wp.jsonID("addNodeMark",Yp);class Xp extends Wp{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Up.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Up.fromReplace(e,this.pos,this.pos+1,new Bd(Dd.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Yp(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Xp(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Xp(t.pos,e.markFromJSON(t.mark))}}Wp.jsonID("removeNodeMark",Xp);class Zp extends Wp{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ef(e,this.from,this.to)?Up.fail("Structure replace would overwrite content"):Up.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new qp([this.from,this.to-this.from,this.slice.size])}invert(e){return new Zp(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Zp(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Zp)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Bd.empty:new Bd(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Zp(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Bd.empty:new Bd(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Zp(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Zp(t.from,t.to,Bd.fromJSON(e,t.slice),!!t.structure)}}Wp.jsonID("replace",Zp);class Qp extends Wp{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(ef(e,this.from,this.gapFrom)||ef(e,this.gapTo,this.to)))return Up.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Up.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Up.fromReplace(e,this.from,this.to,n):Up.fail("Content does not fit in gap")}getMap(){return new qp([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Qp(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new Qp(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Qp(t.from,t.to,t.gapFrom,t.gapTo,Bd.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ef(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function tf(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),c=a+l.nodeSize,h=r.matchType(l.type);if(h){r=h;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new Jp(a,c,l.marks[t]));if(i&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Bd(Dd.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new Zp(a+e.index,a+e.index+e[0].length,t))}}else s.push(new Zp(a,c,Bd.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Dd.empty,!0);e.replace(a,a,new Bd(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function nf(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function rf(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!nf(o,s,a))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function of(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=s.length?s[s.length-1]:t,l=a.contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(sf).concat({type:t,attrs:n}).concat(o.map(sf)):null}function sf(e){return{type:e,attrs:null}}function af(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function lf(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function cf(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function hf(e,t){let n=e.resolve(t),r=n.index();return i=n.nodeBefore,o=n.nodeAfter,!(!i||!o||i.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(i,o))&&n.parent.canReplace(r,r+1);var i,o}function uf(e,t,n=t,r=Bd.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return df(i,o,r)?new Zp(t,n,r):new pf(i,o,r).fit()}function df(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Wp.jsonID("replaceAround",Qp);class pf{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Dd.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Dd.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new Bd(i,o,s);return e>-1?new Qp(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Zp(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=gf(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let o,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(i?a.matchType(i.type)||(l=a.fillBefore(Dd.from(i),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&i&&(o=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:o};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=gf(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Bd(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=gf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Bd(ff(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new Bd(ff(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let o=this.unplaced,s=n?n.content:o.content,a=o.openStart-e,l=0,c=[],{match:h,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));h=h.matchFragment(r)}let d=s.size+e-(o.content.size-o.openEnd);for(;l<s.childCount;){let e=s.child(l),t=h.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(h=t,c.push(vf(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?d:-1)))}let p=l==s.childCount;p||(d=-1),this.placed=mf(this.placed,t,Dd.from(c)),this.frontier[t].match=h,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<d;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?Bd.empty:new Bd(ff(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new Bd(ff(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!yf(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=yf(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=yf(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=mf(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=mf(this.placed,this.depth,Dd.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Dd.empty,!0);e.childCount&&(this.placed=mf(this.placed,this.frontier.length,e))}}function ff(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ff(e.firstChild.content,t-1,n)))}function mf(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(mf(e.lastChild.content,t-1,n)))}function gf(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function vf(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,vf(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Dd.empty,!0)))),e.copy(r)}function yf(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function wf(e){return e.spec.defining||e.spec.definingForContent}function bf(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(bf(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Dd.empty,!0))}return e}function xf(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}class kf extends Wp{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Up.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Up.fromReplace(e,this.pos,this.pos+1,new Bd(Dd.from(r),0,t.isLeaf?0:1))}getMap(){return qp.empty}invert(e){return new kf(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kf(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new kf(t.pos,t.attr,t.value)}}Wp.jsonID("attr",kf);class Sf extends Wp{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Up.ok(n)}getMap(){return qp.empty}invert(e){return new Sf(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Sf(t.attr,t.value)}}Wp.jsonID("docAttr",Sf);let Cf=class extends Error{};Cf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Cf.prototype=Object.create(Error.prototype)).constructor=Cf,Cf.prototype.name="TransformError";class Mf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new jp}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Cf(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Bd.empty){let r=uf(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Bd(Dd.from(n),0,0))}delete(e,t){return this.replace(e,t,Bd.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(df(i,o,r))return e.step(new Zp(t,n,r));let s=xf(i,o);0==s[s.length-1]&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:i.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],h=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){let t=c[e],n=wf(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(a)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+h+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],h=!0;c<0&&(h=!1,c=-c);let d=i.node(c-1),p=i.index(c-1);if(d.canReplaceWith(p,p,u.type,u.marks))return e.replace(i.before(c),h?o.after(c):n,new Bd(bf(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new Bd(Dd.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=xf(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),a=i.after(o+1),l=s,c=a,h=Dd.empty,u=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,h=Dd.from(r.node(e).copy(h)),u++):l--;let d=Dd.empty,p=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,d=Dd.from(i.node(e).copy(d)),p++):c++;e.step(new Qp(l,c,s,a,new Bd(h.append(d),u,p),h.size-u,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);lf(e,r.node(),r.before(),a)}s.inlineContent&&tf(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Zp(c,l.map(t+n,-1),Bd.empty,!0)),!0===r){let t=e.doc.resolve(c);af(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Dd.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Dd.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new Qp(i,o,i,o,new Bd(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(o).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&lf(e,t,n,o),tf(e,e.mapping.slice(o).map(n,1),r,void 0,null===i);let a=e.mapping.slice(o),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new Qp(l,c,l+1,c-1,new Bd(Dd.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===i&&af(e,t,n,o),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Qp(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Bd(Dd.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new kf(e,t,n)),this}setDocAttribute(e,t){return this.step(new Sf(e,t)),this}addNodeMark(e,t){return this.step(new Yp(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Rd)t.isInSet(n.marks)&&this.step(new Xp(e,t));else{let r,i=n.marks,o=[];for(;r=t.isInSet(i);)o.push(new Xp(e,r)),i=r.removeFromSet(i);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let i=e.doc.resolve(t),o=Dd.empty,s=Dd.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){o=Dd.from(i.node(e).copy(o));let t=r&&r[a];s=Dd.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new Zp(t,t,new Bd(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let i,o,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let h=e.marks;if(!r.isInSet(h)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),u=Math.min(l+e.nodeSize,n),d=r.addToSet(h);for(let e=0;e<h.length;e++)h[e].isInSet(d)||(i&&i.to==c&&i.mark.eq(h[e])?i.to=u:s.push(i=new Jp(c,u,h[e])));o&&o.to==c?o.to=u:a.push(o=new Gp(c,u,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let i=[],o=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;o++;let a=null;if(r instanceof wp){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&l.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=o):i.push({style:l,from:Math.max(s,t),to:r,step:o})}}}),i.forEach(t=>e.step(new Jp(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return tf(this,e,t,n),this}}const Tf=Object.create(null);class Af{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Of(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Bd.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Bd.empty:t),0==s&&zf(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),zf(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Df(e):Bf(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?Bf(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Bf(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Rf(e.node(0))}static atStart(e){return Bf(e,e,0,0,1)||new Rf(e)}static atEnd(e){return Bf(e,e,e.content.size,e.childCount,-1)||new Rf(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Tf[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Tf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Tf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Df.between(this.$anchor,this.$head).getBookmark()}}Af.prototype.visible=!0;class Of{constructor(e,t){this.$from=e,this.$to=t}}let Nf=!1;function Ef(e){Nf||e.parent.inlineContent||(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Df extends Af{constructor(e,t=e){Ef(e),Ef(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Af.near(n);let r=e.resolve(t.map(this.anchor));return new Df(r.parent.inlineContent?r:n,n)}replace(e,t=Bd.empty){if(super.replace(e,t),t==Bd.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Df&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new If(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Df(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Af.findFrom(t,n,!0)||Af.findFrom(t,-n,!0);if(!e)return Af.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Af.findFrom(e,-n,!0)||Af.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Df(e,t)}}Af.jsonID("text",Df);class If{constructor(e,t){this.anchor=e,this.head=t}map(e){return new If(e.map(this.anchor),e.map(this.head))}resolve(e){return Df.between(e.resolve(this.anchor),e.resolve(this.head))}}class _f extends Af{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?Af.near(i):new _f(i)}content(){return new Bd(Dd.from(this.node),0,0)}eq(e){return e instanceof _f&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Pf(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new _f(e.resolve(t.anchor))}static create(e,t){return new _f(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}_f.prototype.visible=!1,Af.jsonID("node",_f);class Pf{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new If(n,n):new Pf(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&_f.isSelectable(n)?new _f(t):Af.near(t)}}class Rf extends Af{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Bd.empty){if(t==Bd.empty){e.delete(0,e.doc.content.size);let t=Af.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Rf(e)}map(e){return new Rf(e)}eq(e){return e instanceof Rf}getBookmark(){return Lf}}Af.jsonID("all",Rf);const Lf={map(){return this},resolve:e=>new Rf(e)};function Bf(e,t,n,r,i,o=!1){if(t.inlineContent)return Df.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&_f.isSelectable(r))return _f.create(e,n-(i<0?r.nodeSize:0))}else{let t=Bf(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function zf(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,o=e.steps[r];(o instanceof Zp||o instanceof Qp)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==i&&(i=r)}),e.setSelection(Af.near(e.doc.resolve(i),n)))}class Vf extends Mf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Rd.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Rd.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Af.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Ff(e,t){return t&&e?e.bind(t):e}class Hf{constructor(e,t,n){this.name=e,this.init=Ff(t.init,n),this.apply=Ff(t.apply,n)}}const qf=[new Hf("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Hf("selection",{init:(e,t)=>e.selection||Af.atStart(t.doc),apply:e=>e.selection}),new Hf("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Hf("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class jf{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qf.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Hf(e.key,e.spec.state,e))})}}class $f{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new $f(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new Vf(this)}static create(e){let t=new jf(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new $f(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new jf(this.schema,e.plugins),n=t.fields,r=new $f(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new jf(e.schema,e.plugins),i=new $f(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=tp.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=Af.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o))return void(i[r.name]=a.fromJSON.call(s,e,t[o],i))}i[r.name]=r.init(e,i)}}),i}}function Wf(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=Wf(i,t,{})),n[r]=i}return n}class Uf{constructor(e){this.spec=e,this.props={},e.props&&Wf(e.props,this,this.props),this.key=e.key?e.key.key:Gf("plugin")}getState(e){return e[this.key]}}const Kf=Object.create(null);function Gf(e){return e in Kf?e+"$"+ ++Kf[e]:(Kf[e]=0,e+"$")}class Jf{constructor(e="key"){this.key=Gf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}class Yf{constructor(e,t,n={}){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,i){let o=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);o+=n[0].slice(e+n[1].length);let t=(r+=e)-i;t>0&&(o=n[0].slice(e-t,e)+o,r=i)}return t.tr.insertText(o,r,i)}}(t):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}const Xf=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let n=e.tr,r=i.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(i.text){let t=n.doc.resolve(i.from).marks();n.replaceWith(i.from,i.to,e.schema.text(i.text,t))}else n.delete(i.from,i.to);t(n)}return!0}}return!1};function Zf(e,t,n=null,r){return new Yf(e,(e,i,o,s)=>{let a=n instanceof Function?n(i):n,l=e.tr.delete(o,s),c=l.doc.resolve(o).blockRange(),h=c&&of(c,t,a);if(!h)return null;l.wrap(c,h);let u=l.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&hf(l.doc,o-1)&&(!r||r(i,u))&&l.join(o-1),l})}function Qf(e,t,n=null){return new Yf(e,(e,r,i,o)=>{let s=e.doc.resolve(i),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,a):null})}new Yf(/--$/,"—",{inCodeMark:!1}),new Yf(/\.\.\.$/,"…",{inCodeMark:!1}),new Yf(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new Yf(/"$/,"”",{inCodeMark:!1}),new Yf(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new Yf(/'$/,"’",{inCodeMark:!1});var em=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(em||{});class tm extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}const nm=(e,t)=>"function"==typeof t?"[Function]":t,rm=e=>JSON.stringify(e,nm);function im(){return new tm(em.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function om(){return new tm(em.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function sm(e){return new tm(em.expectDomTypeError,`Expect to be a dom, but get: ${rm(e)}.`)}function am(){return new tm(em.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}const lm="undefined"!=typeof navigator?navigator:null,cm="undefined"!=typeof document?document:null,hm=lm&&lm.userAgent||"",um=/Edge\/(\d+)/.exec(hm),dm=/MSIE \d/.exec(hm),pm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hm),fm=!!(dm||pm||um),mm=dm?document.documentMode:pm?+pm[1]:um?+um[1]:0,gm=!fm&&/gecko\/(\d+)/i.test(hm),vm=gm&&+(/Firefox\/(\d+)/.exec(hm)||[0,0])[1],ym=!fm&&/Chrome\/(\d+)/.exec(hm),wm=!!ym,bm=ym?+ym[1]:0,xm=!fm&&!!lm&&/Apple Computer/.test(lm.vendor),km=xm&&(/Mobile\/\w+/.test(hm)||!!lm&&lm.maxTouchPoints>2),Sm=km||!!lm&&/Mac/.test(lm.platform),Cm=/Android \d/.test(hm),Mm=!!cm&&"webkitFontSmoothing"in cm.documentElement.style,Tm=Mm?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var Am=Object.freeze({__proto__:null,android:Cm,chrome:wm,chrome_version:bm,gecko:gm,gecko_version:vm,ie:fm,ie_version:mm,ios:km,mac:Sm,safari:xm,webkit:Mm,webkit_version:Tm});function Om(e,t,n,r,i,o){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){const i=a,c=i.match.exec(l),h=c&&c[0]&&i.handler(s,c,t-(c[0].length-r.length),n);if(h)return!1!==i.undoable&&h.setMeta(o,{transform:h,from:t,to:n,text:r}),e.dispatch(h),!0}return!1}const Nm=new Jf("MILKDOWN_CUSTOM_INPUTRULES");function Em({rules:e}){const t=new Uf({key:Nm,isInputRules:!0,state:{init:()=>null,apply(e,t){const n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>Om(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&Om(n,r.pos,r.pos,"",e,t)}),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:i}=n.state.selection;return!!i&&Om(n,i.pos,i.pos,"\n",e,t)}}});return t}function Dm(e,t,n={}){return new Yf(e,(e,r,i,o)=>{var s,a,l,c;const{tr:h}=e;let u=r[r.length-1],d=r[0],p=[],f=o;const m={group:u,fullMatch:d,start:i,end:o},g=null==(s=n.updateCaptured)?void 0:s.call(n,m);if(Object.assign(m,g),({group:u,fullMatch:d,start:i,end:o}=m),null===d)return null;if(""===(null==u?void 0:u.trim()))return null;if(u){const e=d.search(/\S/),s=i+d.indexOf(u),m=s+u.length;p=null!=(a=h.storedMarks)?a:[],m<o&&h.delete(m,o),s>i&&h.delete(i+e,s),f=i+e+u.length;const g=null==(l=n.getAttr)?void 0:l.call(n,r);h.addMark(i,f,t.create(g)),h.setStoredMarks(p),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:i,end:o,tr:h})}return h})}var Im=Object.defineProperty,_m=Object.defineProperties,Pm=Object.getOwnPropertyDescriptors,Rm=Object.getOwnPropertySymbols,Lm=Object.prototype.hasOwnProperty,Bm=Object.prototype.propertyIsEnumerable,zm=(e,t,n)=>t in e?Im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Vm(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Fm(e,t,n){const r=e.state.doc.content.size,i=Vm(t,0,r),o=Vm(n,0,r),s=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),h=Math.min(s.left,a.left),u=Math.max(s.right,a.right),d={top:l,bottom:c,left:h,right:u,width:u-h,height:c-l,x:h,y:l};return p=((e,t)=>{for(var n in t||(t={}))Lm.call(t,n)&&zm(e,n,t[n]);if(Rm)for(var n of Rm(t))Bm.call(t,n)&&zm(e,n,t[n]);return e})({},d),_m(p,Pm({toJSON:()=>d}));var p}function Hm(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function qm(e){return t=>{for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r)){return{from:t.before(n),to:t.after(n),node:r}}}}}function jm(e,t){const n=t.nodes[e];if(!n)throw function(e,t){return new tm(em.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}("node",e);return n}function $m(e){return t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}}function Wm(e,t){if(!(e instanceof _f))return;const{node:n,$from:r}=e;return function(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}(t,n)?{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}:void 0}const Um=(e,t)=>{const{selection:n,doc:r}=e;if(n instanceof _f)return{hasNode:n.node.type===t,pos:n.from,target:n.node};const{from:i,to:o}=n;let s=!1,a=-1,l=null;return r.nodesBetween(i,o,(e,n)=>!l&&(e.type!==t||(s=!0,a=n,l=e,!1))),{hasNode:s,pos:a,target:l}};class Km{constructor(){this.sliceMap=new Map,this.get=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){throw function(e){return new tm(em.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}("string"==typeof e?e:e.name)}return t},this.remove=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}class Gm{constructor(e,t,n){this.#e=[],this.#t=()=>{this.#e.forEach(e=>e(this.#n))},this.set=e=>{this.#n=e,this.#t()},this.get=()=>this.#n,this.update=e=>{this.#n=e(this.#n),this.#t()},this.type=n,this.#n=t,e.set(n.id,this)}#e;#n;#t;on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){const t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}}class Jm{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw im()}}create(e,t=this._defaultValue){return new Gm(e,t,this)}}const Ym=(e,t)=>new Jm(e,t);class Xm{constructor(e,t,n){this.#r=new Set,this.#i=new Set,this.#o=new Map,this.#s=new Map,this.read=()=>({metadata:this.#a,injectedSlices:[...this.#r].map(e=>({name:"string"==typeof e?e:e.name,value:this.#l(e)})),consumedSlices:[...this.#i].map(e=>({name:"string"==typeof e?e:e.name,value:this.#l(e)})),recordedTimers:[...this.#o].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)})),waitTimers:[...this.#s].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)}))}),this.onRecord=e=>{this.#o.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#o.delete(e)},this.onDone=e=>{const t=this.#o.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{const n=Date.now();t.finally(()=>{this.#s.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#r.add(e)},this.onRemove=e=>{this.#r.delete(e)},this.onUse=e=>{this.#i.add(e)},this.#l=e=>this.#h.get(e).get(),this.#c=e=>this.#u.get(e).status,this.#h=e,this.#u=t,this.#a=n}#a;#h;#u;#r;#i;#o;#s;#l;#c}class Zm{constructor(e,t,n){this.produce=e=>e&&Object.keys(e).length?new Zm(this.#h,this.#u,{...e}):this,this.inject=(e,t)=>{const n=e.create(this.#h.sliceMap);return null!=t&&n.set(t),this.#d?.onInject(e),this},this.remove=e=>(this.#h.remove(e),this.#d?.onRemove(e),this),this.record=e=>(e.create(this.#u.store),this.#d?.onRecord(e),this),this.clearTimer=e=>(this.#u.remove(e),this.#d?.onClear(e),this),this.isInjected=e=>this.#h.has(e),this.isRecorded=e=>this.#u.has(e),this.use=e=>(this.#d?.onUse(e),this.#h.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#u.get(e),this.done=e=>{this.timer(e).done(),this.#d?.onDone(e)},this.wait=e=>{const t=this.timer(e).start();return this.#d?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#h=e,this.#u=t,this.#a=n,n&&(this.#d=new Xm(e,t,n))}#h;#u;#a;#d;get meta(){return this.#a}get inspector(){return this.#d}}class Qm{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw function(e){return new tm(em.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}class eg{constructor(e,t){this.#p=null,this.#f=null,this.#m="pending",this.start=()=>(this.#p??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#g&&(this.#m="resolved",this.#v(),t.stopImmediatePropagation(),e())},this.#y(()=>{"pending"===this.#m&&(this.#m="rejected"),this.#v(),t(new Error(`Timing ${this.type.name} timeout.`))}),this.#m="pending",addEventListener(this.type.name,this.#f)}),this.#p),this.done=()=>{const e=new CustomEvent(this.type.name,{detail:{id:this.#g}});dispatchEvent(e)},this.#v=()=>{this.#f&&removeEventListener(this.type.name,this.#f)},this.#y=e=>{setTimeout(()=>{e()},this.type.timeout)},this.#g=Symbol(t.name),this.type=t,e.set(t.id,this)}#p;#f;#g;#m;get status(){return this.#m}#v;#y}class tg{constructor(e,t=3e3){this.create=e=>new eg(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const ng=(e,t=3e3)=>new tg(e,t),rg={};function ig(e,t){return og(e,"boolean"!=typeof rg.includeImageAlt||rg.includeImageAlt,"boolean"!=typeof rg.includeHtml||rg.includeHtml)}function og(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return sg(e.children,t,n)}return Array.isArray(e)?sg(e,t,n):""}function sg(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=og(e[i],t,n);return r.join("")}const ag=document.createElement("i");function lg(e){const t="&"+e+";";ag.innerHTML=t;const n=ag.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function cg(e,t,n,r){const i=e.length;let o,s=0;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);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function hg(e,t){return e.length>0?(cg(e,e.length,0,t),e):t}const ug={}.hasOwnProperty;function dg(e){const t={};let n=-1;for(;++n<e.length;)pg(t,e[n]);return t}function pg(e,t){let n;for(n in t){const r=(ug.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){ug.call(r,o)||(r[o]=[]);const e=i[o];fg(r[o],Array.isArray(e)?e:e?[e]:[])}}}function fg(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);cg(e,0,0,r)}function mg(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function gg(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vg=Ng(/[A-Za-z]/),yg=Ng(/[\dA-Za-z]/),wg=Ng(/[#-'*+\--9=?A-Z^-~]/);function bg(e){return null!==e&&(e<32||127===e)}const xg=Ng(/\d/),kg=Ng(/[\dA-Fa-f]/),Sg=Ng(/[!-/:-@[-`{-~]/);function Cg(e){return null!==e&&e<-2}function Mg(e){return null!==e&&(e<0||32===e)}function Tg(e){return-2===e||-1===e||32===e}const Ag=Ng(/\p{P}|\p{S}/u),Og=Ng(/\s/);function Ng(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function Eg(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){if(Tg(r))return e.enter(n),s(r);return t(r)};function s(r){return Tg(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}const Dg={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Eg(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,i(t)}function i(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):Cg(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),i)}}};const Ig={tokenize:function(e){const t=this,n=[];let r,i,o,s=0;return a;function a(r){if(s<n.length){const i=n[s];return t.containerState=i[1],e.attempt(i[0].continuation,l,c)(r)}return c(r)}function l(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const n=t.events.length;let i,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){i=t.events[o][1].end;break}v(s);let a=n;for(;a<t.events.length;)t.events[a][1].end={...i},a++;return cg(t.events,o+1,0,t.events.slice(n)),t.events.length=a,c(e)}return a(e)}function c(i){if(s===n.length){if(!r)return d(i);if(r.currentConstruct&&r.currentConstruct.concrete)return f(i);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_g,h,u)(i)}function h(e){return r&&y(),v(s),d(e)}function u(e){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,f(e)}function d(n){return t.containerState={},e.attempt(_g,p,f)(n)}function p(e){return s++,n.push([t.currentConstruct,t.containerState]),d(e)}function f(n){return null===n?(r&&y(),v(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),m(n))}function m(n){return null===n?(g(e.exit("chunkFlow"),!0),v(0),void e.consume(n)):Cg(n)?(e.consume(n),g(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(n),m)}function g(e,n){const a=t.sliceStream(e);if(n&&a.push(null),e.previous=i,i&&(i.next=e),i=e,r.defineSkip(e.start),r.write(a),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let i,a,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(i){a=t.events[l][1].end;break}i=!0}for(v(s),e=n;e<t.events.length;)t.events[e][1].end={...a},e++;cg(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function v(r){let i=n.length;for(;i-- >r;){const r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function y(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}},_g={tokenize:function(e,t,n){return Eg(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Pg(e){return null===e||Mg(e)||Og(e)?1:Ag(e)?2:void 0}function Rg(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Lg={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,a,l,c,h=-1;for(;++h<e.length;)if("enter"===e[h][0]&&"attentionSequence"===e[h][1].type&&e[h][1]._close)for(n=h;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[h][1]).charCodeAt(0)){if((e[n][1]._close||e[h][1]._open)&&(e[h][1].end.offset-e[h][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[h][1].end.offset-e[h][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[h][1].end.offset-e[h][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[h][1].start};Bg(u,-a),Bg(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[h][1].start},end:d},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[h][1].start}},r={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[h][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=hg(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=hg(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=hg(l,Rg(t.parser.constructs.insideSpan.null,e.slice(n+1,h),t)),l=hg(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[h][1].end.offset-e[h][1].start.offset?(c=2,l=hg(l,[["enter",e[h][1],t],["exit",e[h][1],t]])):c=0,cg(e,n-1,h-n+3,l),h=n+l.length-c-2;break}h=-1;for(;++h<e.length;)"attentionSequence"===e[h][1].type&&(e[h][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Pg(r);let o;return function(t){return o=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===o)return e.consume(a),s;const l=e.exit("attentionSequence"),c=Pg(a),h=!c||2===c&&i||n.includes(a),u=!i||2===i&&c||n.includes(r);return l._open=Boolean(42===o?h:h&&(i||!u)),l._close=Boolean(42===o?u:u&&(c||!h)),t(a)}}};function Bg(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const zg={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return vg(t)?(e.consume(t),o):64===t?n(t):l(t)}function o(e){return 43===e||45===e||46===e||yg(e)?(r=1,s(e)):l(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||yg(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||bg(r)?n(r):(e.consume(r),a)}function l(t){return 64===t?(e.consume(t),c):wg(t)?(e.consume(t),l):n(t)}function c(e){return yg(e)?h(e):n(e)}function h(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):u(n)}function u(t){if((45===t||yg(t))&&r++<63){const n=45===t?u:h;return e.consume(t),n}return n(t)}}};const Vg={partial:!0,tokenize:function(e,t,n){return function(t){return Tg(t)?Eg(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||Cg(e)?t(e):n(e)}}};const Fg={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(Tg(t))return Eg(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return i(t)};function i(r){return e.attempt(Fg,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return Tg(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const Hg={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return Sg(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const qg={name:"characterReference",tokenize:function(e,t,n){const r=this;let i,o,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),i=31,o=yg,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=kg,c):(e.enter("characterReferenceValue"),i=7,o=xg,c(t))}function c(a){if(59===a&&s){const i=e.exit("characterReferenceValue");return o!==yg||lg(r.sliceSerialize(i))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return o(a)&&s++<i?(e.consume(a),c):n(a)}}};const jg={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},$g={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,i={partial:!0,tokenize:function(e,t,n){let i=0;return s;function s(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),Tg(t)?Eg(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===o?(e.enter("codeFencedFenceSequence"),h(t)):n(t)}function h(t){return t===o?(i++,e.consume(t),h):i>=a?(e.exit("codeFencedFenceSequence"),Tg(t)?Eg(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||Cg(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===o?(a++,e.consume(t),l):a<3?n(t):(e.exit("codeFencedFenceSequence"),Tg(t)?Eg(e,c,"whitespace")(t):c(t))}function c(n){return null===n||Cg(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(jg,p,y)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return null===t||Cg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):Tg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Eg(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),h)}function u(t){return null===t||Cg(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||Cg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?n(t):(e.consume(t),d)}function p(t){return e.attempt(i,y,f)(t)}function f(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),m}function m(t){return s>0&&Tg(t)?Eg(e,g,"linePrefix",s+1)(t):g(t)}function g(t){return null===t||Cg(t)?e.check(jg,p,y)(t):(e.enter("codeFlowValue"),v(t))}function v(t){return null===t||Cg(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),v)}function y(n){return e.exit("codeFenced"),t(n)}}};const Wg={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),Eg(e,i,"linePrefix",5)(t)};function i(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?a(t):Cg(t)?e.attempt(Ug,o,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||Cg(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},Ug={partial:!0,tokenize:function(e,t,n){const r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Cg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):Eg(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):Cg(e)?i(e):n(e)}}};const Kg={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}t=i-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),o++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(i=e.enter("codeTextSequence"),r=0,c(t)):Cg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||Cg(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(i.type="codeTextData",l(n))}}};class Gg{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new 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){const n=null==t?Number.POSITIVE_INFINITY:t;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){const r=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&Jg(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Jg(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Jg(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);Jg(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Jg(this.left,t.reverse())}}}function Jg(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 Yg(e){const t={};let n,r,i,o,s,a,l,c=-1;const h=new Gg(e);for(;++c<h.length;){for(;c in t;)c=t[c];if(n=h.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===h.get(c-1)[1].type&&(a=n[1]._tokenizer.events,i=0,i<a.length&&"lineEndingBlank"===a[i][1].type&&(i+=2),i<a.length&&"content"===a[i][1].type))for(;++i<a.length&&"content"!==a[i][1].type;)"chunkText"===a[i][1].type&&(a[i][1]._isInFirstContentOfListItem=!0,i++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,Xg(h,c)),c=t[c],l=!0);else if(n[1]._container){for(i=c,r=void 0;i--;)if(o=h.get(i),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(h.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if("linePrefix"!==o[1].type&&"listItemIndent"!==o[1].type)break;r&&(n[1].end={...h.get(r)[1].start},s=h.slice(r,c),s.unshift(n),h.splice(r,c-r+1,s))}}return cg(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!l}function Xg(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let h,u,d=-1,p=n,f=0,m=0;const g=[m];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),u&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(h),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),u=p,p=p.next}for(p=n;++d<a.length;)"exit"===a[d][0]&&"enter"===a[d-1][0]&&a[d][1].type===a[d-1][1].type&&a[d][1].start.line!==a[d][1].end.line&&(m=d+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),d=g.length;d--;){const t=a.slice(g[d],g[d+1]),n=o.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),d=-1;++d<l.length;)c[f+l[d][0]]=f+l[d][1],f+=l[d][1]-l[d][0]-1;return c}const Zg={resolve:function(e){return Yg(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):Cg(t)?e.check(Qg,o,i)(t):(e.consume(t),r)}function i(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,r}}},Qg={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Eg(e,i,"linePrefix")};function i(i){if(null===i||Cg(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}};function ev(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let h=0;return function(t){if(60===t)return e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),u;if(null===t||32===t||41===t||bg(t))return n(t);return e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t)};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(a),u(t)):null===t||60===t||Cg(t)?n(t):(e.consume(t),92===t?p:d)}function p(t){return 60===t||62===t||92===t?(e.consume(t),d):d(t)}function f(i){return h||null!==i&&41!==i&&!Mg(i)?h<c&&40===i?(e.consume(i),h++,f):41===i?(e.consume(i),h--,f):null===i||32===i||40===i||bg(i)?n(i):(e.consume(i),92===i?m:f):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i))}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function tv(e,t,n,r,i,o){const s=this;let a,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(u){return l>999||null===u||91===u||93===u&&!a||94===u&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):93===u?(e.exit(o),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):Cg(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(u))}function h(t){return null===t||91===t||93===t||Cg(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!Tg(t)),92===t?u:h)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,h):h(t)}}function nv(e,t,n,r,i,o){let s;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a;return n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===s?(e.exit(o),a(s)):null===t?n(t):Cg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Eg(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||Cg(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?h:c)}function h(t){return t===s||92===t?(e.consume(t),c):c(t)}}function rv(e,t){let n;return function r(i){if(Cg(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(Tg(i))return Eg(e,r,n?"linePrefix":"lineSuffix")(i);return t(i)}}const iv={name:"definition",tokenize:function(e,t,n){const r=this;let i;return function(t){return e.enter("definition"),function(t){return tv.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return i=gg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return Mg(t)?rv(e,a)(t):a(t)}function a(t){return ev(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(ov,c,c)(t)}function c(t){return Tg(t)?Eg(e,h,"whitespace")(t):h(t)}function h(o){return null===o||Cg(o)?(e.exit("definition"),r.parser.defined.push(i),t(o)):n(o)}}},ov={partial:!0,tokenize:function(e,t,n){return function(t){return Mg(t)?rv(e,r)(t):n(t)};function r(t){return nv(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return Tg(t)?Eg(e,o,"whitespace")(t):o(t)}function o(e){return null===e||Cg(e)?t(e):n(e)}}};const sv={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return Cg(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const av={name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},cg(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),i(t)}(t)};function i(t){return 35===t&&r++<6?(e.consume(t),i):null===t||Mg(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||Cg(n)?(e.exit("atxHeading"),t(n)):Tg(n)?Eg(e,o,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),o(t))}function a(t){return null===t||35===t||Mg(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),a)}}};const lv=["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"],cv=["pre","script","style","textarea"],hv={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let i,o,s,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),h):47===a?(e.consume(a),o=!0,p):63===a?(e.consume(a),i=3,r.interrupt?t:P):vg(a)?(e.consume(a),s=String.fromCharCode(a),f):n(a)}function h(o){return 45===o?(e.consume(o),i=2,u):91===o?(e.consume(o),i=5,a=0,d):vg(o)?(e.consume(o),i=4,r.interrupt?t:P):n(o)}function u(i){return 45===i?(e.consume(i),r.interrupt?t:P):n(i)}function d(i){const o="CDATA[";return i===o.charCodeAt(a++)?(e.consume(i),6===a?r.interrupt?t:T:d):n(i)}function p(t){return vg(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(a){if(null===a||47===a||62===a||Mg(a)){const l=47===a,c=s.toLowerCase();return l||o||!cv.includes(c)?lv.includes(s.toLowerCase())?(i=6,l?(e.consume(a),m):r.interrupt?t(a):T(a)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):o?g(a):v(a)):(i=1,r.interrupt?t(a):T(a))}return 45===a||yg(a)?(e.consume(a),s+=String.fromCharCode(a),f):n(a)}function m(i){return 62===i?(e.consume(i),r.interrupt?t:T):n(i)}function g(t){return Tg(t)?(e.consume(t),g):C(t)}function v(t){return 47===t?(e.consume(t),C):58===t||95===t||vg(t)?(e.consume(t),y):Tg(t)?(e.consume(t),v):C(t)}function y(t){return 45===t||46===t||58===t||95===t||yg(t)?(e.consume(t),y):w(t)}function w(t){return 61===t?(e.consume(t),b):Tg(t)?(e.consume(t),w):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,x):Tg(t)?(e.consume(t),b):k(t)}function x(t){return t===l?(e.consume(t),l=null,S):null===t||Cg(t)?n(t):(e.consume(t),x)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||Mg(t)?w(t):(e.consume(t),k)}function S(e){return 47===e||62===e||Tg(e)?v(e):n(e)}function C(t){return 62===t?(e.consume(t),M):n(t)}function M(t){return null===t||Cg(t)?T(t):Tg(t)?(e.consume(t),M):n(t)}function T(t){return 45===t&&2===i?(e.consume(t),E):60===t&&1===i?(e.consume(t),D):62===t&&4===i?(e.consume(t),R):63===t&&3===i?(e.consume(t),P):93===t&&5===i?(e.consume(t),_):!Cg(t)||6!==i&&7!==i?null===t||Cg(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(uv,L,A)(t))}function A(t){return e.check(dv,O,L)(t)}function O(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return null===t||Cg(t)?A(t):(e.enter("htmlFlowData"),T(t))}function E(t){return 45===t?(e.consume(t),P):T(t)}function D(t){return 47===t?(e.consume(t),s="",I):T(t)}function I(t){if(62===t){const n=s.toLowerCase();return cv.includes(n)?(e.consume(t),R):T(t)}return vg(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),I):T(t)}function _(t){return 93===t?(e.consume(t),P):T(t)}function P(t){return 62===t?(e.consume(t),R):45===t&&2===i?(e.consume(t),P):T(t)}function R(t){return null===t||Cg(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),R)}function L(n){return e.exit("htmlFlow"),t(n)}}},uv={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Vg,t,n)}}},dv={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(Cg(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i;return n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const pv={name:"htmlText",tokenize:function(e,t,n){const r=this;let i,o,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),b):63===t?(e.consume(t),y):vg(t)?(e.consume(t),S):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,p):vg(t)?(e.consume(t),v):n(t)}function c(t){return 45===t?(e.consume(t),d):n(t)}function h(t){return null===t?n(t):45===t?(e.consume(t),u):Cg(t)?(s=h,I(t)):(e.consume(t),h)}function u(t){return 45===t?(e.consume(t),d):h(t)}function d(e){return 62===e?D(e):45===e?u(e):h(e)}function p(t){const r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),6===o?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):Cg(t)?(s=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?D(t):93===t?(e.consume(t),g):f(t)}function v(t){return null===t||62===t?D(t):Cg(t)?(s=v,I(t)):(e.consume(t),v)}function y(t){return null===t?n(t):63===t?(e.consume(t),w):Cg(t)?(s=y,I(t)):(e.consume(t),y)}function w(e){return 62===e?D(e):y(e)}function b(t){return vg(t)?(e.consume(t),x):n(t)}function x(t){return 45===t||yg(t)?(e.consume(t),x):k(t)}function k(t){return Cg(t)?(s=k,I(t)):Tg(t)?(e.consume(t),k):D(t)}function S(t){return 45===t||yg(t)?(e.consume(t),S):47===t||62===t||Mg(t)?C(t):n(t)}function C(t){return 47===t?(e.consume(t),D):58===t||95===t||vg(t)?(e.consume(t),M):Cg(t)?(s=C,I(t)):Tg(t)?(e.consume(t),C):D(t)}function M(t){return 45===t||46===t||58===t||95===t||yg(t)?(e.consume(t),M):T(t)}function T(t){return 61===t?(e.consume(t),A):Cg(t)?(s=T,I(t)):Tg(t)?(e.consume(t),T):C(t)}function A(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),i=t,O):Cg(t)?(s=A,I(t)):Tg(t)?(e.consume(t),A):(e.consume(t),N)}function O(t){return t===i?(e.consume(t),i=void 0,E):null===t?n(t):Cg(t)?(s=O,I(t)):(e.consume(t),O)}function N(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||Mg(t)?C(t):(e.consume(t),N)}function E(e){return 47===e||62===e||Mg(e)?C(e):n(e)}function D(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),_}function _(t){return Tg(t)?Eg(e,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):P(t)}function P(t){return e.enter("htmlTextData"),s(t)}}};const fv={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&cg(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,i,o,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},h={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=hg(o,e.slice(r+1,r+a+3)),o=hg(o,[["enter",h,t]]),o=hg(o,Rg(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),o=hg(o,[["exit",h,t],e[i-2],e[i-1],["exit",c,t]]),o=hg(o,e.slice(i+1)),o=hg(o,[["exit",l,t]]),cg(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let i,o,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){i=r.events[s][1];break}return function(t){if(!i)return n(t);if(i._inactive)return h(t);return o=r.parser.defined.includes(gg(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a};function a(t){return 40===t?e.attempt(mv,c,o?c:h)(t):91===t?e.attempt(gv,c,o?l:h)(t):o?c(t):h(t)}function l(t){return e.attempt(vv,c,h)(t)}function c(e){return t(e)}function h(e){return i._balanced=!0,n(e)}}},mv={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return Mg(t)?rv(e,i)(t):i(t)}function i(t){return 41===t?c(t):ev(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return Mg(t)?rv(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?nv(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return Mg(t)?rv(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},gv={tokenize:function(e,t,n){const r=this;return function(t){return tv.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(gg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},vv={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const yv={name:"labelStartImage",resolveAll:fv.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const wv={name:"labelStartLink",resolveAll:fv.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const bv={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Eg(e,t,"linePrefix")}}};const xv={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),s(o)):i>=3&&(null===o||Cg(o))?(e.exit("thematicBreak"),t(o)):n(o)}function s(t){return t===r?(e.consume(t),i++,s):(e.exit("thematicBreakSequence"),Tg(t)?Eg(e,o,"whitespace")(t):o(t))}}};const kv={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vg,i,o);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Eg(e,t,"listItemIndent",r.containerState.size+1)(n)}function o(n){return r.containerState.furtherBlankLines||!Tg(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Cv,t,s)(n))}function s(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Eg(e,e.attempt(kv,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){const i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:xg(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(xv,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return xg(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(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(Vg,r.interrupt?n:c,e.attempt(Sv,u,h))}function c(e){return r.containerState.initialBlankLine=!0,o++,u(e)}function h(t){return Tg(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Sv={partial:!0,tokenize:function(e,t,n){const r=this;return Eg(e,function(e){const i=r.events[r.events.length-1];return!Tg(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Cv={partial:!0,tokenize:function(e,t,n){const r=this;return Eg(e,function(e){const i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Mv={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);const s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s;return e.push(["exit",s,t]),e},tokenize:function(e,t,n){const r=this;let i;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||s))return e.enter("setextHeadingLine"),i=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t);return n(t)};function o(t){return t===i?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),Tg(t)?Eg(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||Cg(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const Tv={tokenize:function(e){const t=this,n=e.attempt(Vg,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,Eg(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Zg,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const Av={resolveAll:Dv()},Ov=Ev("string"),Nv=Ev("text");function Ev(e){return{resolveAll:Dv("text"===e?Iv:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return l(e)?i(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=r[e];let i=-1;if(t)for(;++i<t.length;){const e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function Dv(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function Iv(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],i=t.sliceStream(r);let o,s=i.length,a=-1,l=0;for(;s--;){const e=i[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)o=!0,l++;else if(-1!==e){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const i={type:n===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},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}const _v={42:kv,43:kv,45:kv,48:kv,49:kv,50:kv,51:kv,52:kv,53:kv,54:kv,55:kv,56:kv,57:kv,62:Fg},Pv={91:iv},Rv={[-2]:Wg,[-1]:Wg,32:Wg},Lv={35:av,42:xv,45:[Mv,xv],60:hv,61:Mv,95:xv,96:$g,126:$g},Bv={38:qg,92:Hg},zv={[-5]:bv,[-4]:bv,[-3]:bv,33:yv,38:qg,42:Lg,60:[zg,pv],91:wv,92:[sv,Hg],93:fv,95:Lg,96:Kg},Vv={null:[Lg,Av]},Fv=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Pv,disable:{null:[]},document:_v,flow:Lv,flowInitial:Rv,insideSpan:Vv,string:Bv,text:zv},Symbol.toStringTag,{value:"Module"}));function Hv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:g(function(e,t){v(e,t.from)}),check:g(m),consume:function(e){Cg(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,y()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){const t=a.pop();return t.end=d(),c.events.push(["exit",t,c]),t},interrupt:g(m,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,y()},events:[],now:d,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if("string"==typeof o)s=o;else switch(o){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&i)continue;s=" ";break;default:s=String.fromCharCode(o)}i=-2===o,r.push(s)}return r.join("")}(u(e),t)},sliceStream:u,write:function(e){if(s=hg(s,e),p(),null!==s[s.length-1])return[];return v(t,0),c.events=Rg(o,c.events,c),c.events}};let h=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function u(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const e=s[0];"string"==typeof e?s[0]=e.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}(s,e)}function d(){const{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}function f(e){h=h(e)}function m(e,t){t.restore()}function g(e,t){return function(n,i,o){let s,h,u,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return s=e,h=0,0===e.length?o:m(e[h])}function m(e){return function(n){p=function(){const e=d(),t=c.previous,n=c.currentConstruct,i=c.events.length,o=Array.from(a);return{from:i,restore:s};function s(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=i,a=o,y()}}(),u=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return v();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,v)(n)}}function g(t){return e(u,p),i}function v(e){return p.restore(),++h<s.length?m(s[h]):o}}}function v(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&cg(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}const qv=/[\0\t\n\r]/g;const jv=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $v(e){return e.replace(jv,Wv)}function Wv(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return mg(n.slice(t?2:1),t?16:10)}return lg(n)||e}function Uv(e){return e&&"object"==typeof e?"position"in e||"type"in e?Gv(e.position):"start"in e||"end"in e?Gv(e):"line"in e||"column"in e?Kv(e):"":""}function Kv(e){return Jv(e&&e.line)+":"+Jv(e&&e.column)}function Gv(e){return Kv(e&&e.start)+"-"+Kv(e&&e.end)}function Jv(e){return e&&"number"==typeof e?e:1}const Yv={}.hasOwnProperty;function Xv(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:M,autolinkEmail:M,atxHeading:o(X),blockQuote:o(U),characterEscape:M,characterReference:M,codeFenced:o(K),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(K,s),codeText:o(G,s),codeTextData:M,data:M,codeFlowValue:M,definition:o(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Y),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o(Q,s),htmlFlowData:M,htmlText:o(Q,s),htmlTextData:M,image:o(ee),label:s,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(ie),reference:V,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(X),strong:o(oe),thematicBreak:o(ae)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:W,autolinkProtocol:$,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:q,characterReference:j,codeFenced:l(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:T,codeIndented:l(v),codeText:l(D),codeTextData:T,data:T,definition:l(),definitionDestinationString:b,definitionLabelString:y,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(N),htmlFlowData:T,htmlText:l(E),htmlTextData:T,image:l(_),label:R,labelText:P,lineEnding:A,link:l(I),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:L,resourceTitleString:B,resource:z,setextHeading:l(C),setextHeadingLineSequence:S,setextHeadingText:k,strong:l(),thematicBreak:l()}};Qv(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:h,data:n},l=[];let u=-1;for(;++u<e.length;)if("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)if("enter"===e[u][0])l.push(u);else{u=i(e,l.pop(),u)}for(u=-1;++u<e.length;){const n=t[e[u][0]];Yv.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||ty).call(o,void 0,e[0])}for(r.position={start:Zv(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Zv(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r}function i(e,t,n){let r,i,o,s,a=t-1,l=-1,c=!1;for(;++a<=n;){const t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||o||(o=a),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){const i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}function o(e,t){return n;function n(n){a.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(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:Zv(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Uv({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||ty).call(this,e,r[0])}n.position.end=Zv(e.end)}function h(){return ig(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function f(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function y(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gg(this.sliceSerialize(e)).toLowerCase()}function w(){const e=this.resume();this.stack[this.stack.length-1].title=e}function b(){const e=this.resume();this.stack[this.stack.length-1].url=e}function x(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function S(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function M(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=se(),n.position={start:Zv(e.start),end:void 0},t.push(n)),this.stack.push(n)}function T(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Zv(e.end)}function A(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Zv(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(M.call(this,e),T.call(this,e))}function O(){this.data.atHardBreak=!0}function N(){const e=this.resume();this.stack[this.stack.length-1].value=e}function E(){const e=this.resume();this.stack[this.stack.length-1].value=e}function D(){const e=this.resume();this.stack[this.stack.length-1].value=e}function I(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const 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 _(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=$v(t),n.identifier=gg(t).toLowerCase()}function R(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function L(){const e=this.resume();this.stack[this.stack.length-1].url=e}function B(){const e=this.resume();this.stack[this.stack.length-1].title=e}function z(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function F(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gg(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function H(e){this.data.characterReferenceType=e.type}function q(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=mg(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=lg(t)}this.stack[this.stack.length-1].value+=r}function j(e){this.stack.pop().position.end=Zv(e.end)}function $(e){T.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function W(e){T.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function U(){return{type:"blockquote",children:[]}}function K(){return{type:"code",lang:null,meta:null,value:""}}function G(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Y(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function Z(){return{type:"break"}}function Q(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ie(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function se(){return{type:"text",value:""}}function ae(){return{type:"thematicBreak"}}}(n)(function(e){for(;!Yg(e););return e}(function(e){const t={constructs:dg([Fv,...(e||{}).extensions||[]]),content:n(Dg),defined:[],document:n(Ig),flow:n(Tv),lazy:{},string:n(Ov),text:n(Nv)};return t;function n(e){return function(n){return Hv(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(i,o,s){const a=[];let l,c,h,u,d;for(i=n+("string"==typeof i?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,n="",r&&(65279===i.charCodeAt(0)&&h++,r=void 0);h<i.length;){if(qv.lastIndex=h,l=qv.exec(i),u=l&&void 0!==l.index?l.index:i.length,d=i.charCodeAt(u),!l){n=i.slice(h);break}if(10===d&&h===u&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),h<u&&(a.push(i.slice(h,u)),t+=u-h),d){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}h=u+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))}function Zv(e){return{line:e.line,column:e.column,offset:e.offset}}function Qv(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Qv(e,r):ey(e,r)}}function ey(e,t){let n;for(n in t)if(Yv.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ty(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Uv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Uv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Uv({start:t.start,end:t.end})+") is still open")}function ny(e){const t=this;t.parser=function(n){return Xv(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}const ry={}.hasOwnProperty;const iy={}.hasOwnProperty;function oy(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)oy(e,t.extensions[r]);for(n in t)if(iy.call(t,n))switch(n){case"extensions":break;case"unsafe":case"join":sy(e[n],t[n]);break;case"handlers":ay(e[n],t[n]);break;default:e.options[n]=t[n]}return e}function sy(e,t){t&&e.push(...t)}function ay(e,t){t&&Object.assign(e,t)}function ly(e,t,n){return">"+(n?"":" ")+e}function cy(e,t){return hy(e,t.inConstruct,!0)&&!hy(e,t.notInConstruct,!1)}function hy(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function uy(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&cy(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function dy(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}function py(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function fy(e,t,n){return(n?"":" ")+e}function my(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gy(e){return"&#x"+e.toString(16).toUpperCase()+";"}function vy(e,t,n){const r=Pg(e),i=Pg(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function yy(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),h=vy(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=gy(c)+l.slice(1));const u=l.charCodeAt(l.length-1),d=vy(r.after.charCodeAt(0),u,i);d.inside&&(l=l.slice(0,-1)+gy(u));const p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},a+l+p}yy.peek=function(e,t,n){return n.options.emphasis||"*"};const wy=function(e){if(null==e)return xy;if("function"==typeof e)return by(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=wy(e[n]);return by(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return by(n);function n(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}(e);if("string"==typeof e)return function(e){return by(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function by(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function xy(){return!0}const ky=[],Sy=!0,Cy=!1,My="skip";function Ty(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;const o=wy(i),s=r?-1:1;!function e(i,a,l){const c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return h;function h(){let c,h,u,d=ky;if((!t||o(i,a,l[l.length-1]||void 0))&&(d=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Sy,e];return null==e?ky:[e]}(n(i,l)),d[0]===Cy))return d;if("children"in i&&i.children){const t=i;if(t.children&&d[0]!==My)for(h=(r?t.children.length:-1)+s,u=l.concat(t);h>-1&&h<t.children.length;){const n=t.children[h];if(c=e(n,h,u)(),c[0]===Cy)return c;h="number"==typeof c[1]?c[1]:h+s}}return d}}(e,void 0,[])()}function Ay(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),Ty(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}function Oy(e,t){let n=!1;return Ay(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Cy}),Boolean((!e.depth||e.depth<3)&&ig(e)&&(t.options.setext||n))}function Ny(e){return e.value||""}function Ey(e,t,n,r){const i=my(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),s(),c}function Dy(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const h=n.stack;n.stack=[],s=n.enter("reference");const u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=h,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function Iy(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function _y(e,t){const n=ig(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function Py(e,t,n,r){const i=my(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(_y(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),a(),n.stack=t,r}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=s.move(" "+i),c+=s.move(n.safe(e.title,{before:c,after:i,...s.current()})),c+=s.move(i),l()),c+=s.move(")"),a(),c}function Ry(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const h=n.stack;n.stack=[],s=n.enter("reference");const u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=h,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function Ly(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function By(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Ny.peek=function(){return"<"},Ey.peek=function(){return"!"},Dy.peek=function(){return"!"},Iy.peek=function(){return"`"},Py.peek=function(e,t,n){return _y(e,n)?"<":"["},Ry.peek=function(){return"["};const zy=wy(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Vy(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),h=vy(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=gy(c)+l.slice(1));const u=l.charCodeAt(l.length-1),d=vy(r.after.charCodeAt(0),u,i);d.inside&&(l=l.slice(0,-1)+gy(u));const p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},a+l+p}Vy.peek=function(e,t,n){return n.options.strong||"*"};const Fy={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),ly);return i(),s},break:uy,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(py(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,fy);return e(),t}const a=n.createTracker(r),l=i.repeat(Math.max(dy(o,i)+1,3)),c=n.enter("codeFenced");let h=a.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:"\n",encode:["`"],...a.current()})),t()}return h+=a.move("\n"),o&&(h+=a.move(o+"\n")),h+=a.move(l),c(),h},definition:function(e,t,n,r){const i=my(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),s(),c},emphasis:yy,hardBreak:uy,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Oy(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(c)&&(c=gy(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:Ny,image:Ey,imageReference:Dy,inlineCode:Iy,link:Py,linkReference:Ry,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):Ly(n);const a=e.ordered?"."===s?")":".":function(e){const t=Ly(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&s===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),By(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const c=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),c},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||Ly(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){if(t)return(n?"":" ".repeat(s))+e;return(n?o:o+" ".repeat(s-o.length))+e});return l(),c},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some(function(e){return zy(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Vy,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(By(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},Hy=[function(e,t,n,r){if("code"===t.type&&py(t,r)&&("list"===e.type||e.type===t.type&&py(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&Oy(t,r)))return;return n.spread?1:0}}];const qy=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],jy=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:qy},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:qy},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:qy},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:qy},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:qy},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:qy},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:qy},{atBreak:!0,character:"~"}];function $y(e){return e.label||!e.identifier?e.label||"":$v(e.identifier)}function Wy(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function Uy(e,t,n,r){let i=r.join.length;for(;i--;){const o=r.join[i](e,t,n,r);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const Ky=/\r?\n|\r/g;function Gy(e,t){const n=[];let r,i=0,o=0;for(;r=Ky.exec(e);)s(e.slice(i,r.index)),n.push(r[0]),i=r.index+r[0].length,o++;return s(e.slice(i)),n.join("");function s(e){n.push(t(e,o,!e))}}function Jy(e,t){return e-t}function Yy(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],o=e+t;let s,a=-1,l=0;for(;s=n.exec(o);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&i.push(e.slice(l,r[a])),i.push("\\"),l=r[a];return i.push(e.slice(l)),i.join("")}function Xy(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,i=n.line||1,o=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return i+=n.length-1,o=1===n.length?o+s.length:1+s.length+r,t},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function Zy(e,t){const n=t||{},r={associationId:$y,containerPhrasing:nw,containerFlow:rw,createTracker:Xy,compilePattern:Wy,enter:function(e){return r.stack.push(e),function(){r.stack.pop()}},handlers:{...Fy},handle:void 0,indentLines:Gy,indexStack:[],join:[...Hy],options:{},safe:iw,stack:[],unsafe:[...jy]};oy(r,n),r.options.tightDefinitions&&r.join.push(tw),r.handle=function(e,t){const n=t||{};function r(t,...n){let i=r.invalid;const o=r.handlers;if(t&&ry.call(t,e)){const n=String(t[e]);i=ry.call(o,n)?o[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}("type",{invalid:Qy,unknown:ew,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return i&&10!==i.charCodeAt(i.length-1)&&13!==i.charCodeAt(i.length-1)&&(i+="\n"),i}function Qy(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function ew(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function tw(e,t){if("definition"===e.type&&e.type===t.type)return 0}function nw(e,t){return function(e,t,n){const r=t.indexStack,i=e.children||[],o=[];let s,a=-1,l=n.before;r.push(-1);let c=t.createTracker(n);for(;++a<i.length;){const h=i[a];let u;if(r[r.length-1]=a,a+1<i.length){let n=t.handle.handlers[i[a+1].type];n&&n.peek&&(n=n.peek),u=n?n(i[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else u=n.after;o.length>0&&("\r"===l||"\n"===l)&&"html"===h.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(n),c.move(o.join("")));let d=t.handle(h,e,t,{...c.current(),after:u,before:l});s&&s===d.slice(0,1)&&(d=gy(s.charCodeAt(0))+d.slice(1));const p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,s=void 0,p&&(o.length>0&&p.before&&l===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+gy(l.charCodeAt(0))),p.after&&(s=u)),c.move(d),o.push(d),l=d.slice(-1)}return r.pop(),o.join("")}(e,this,t)}function rw(e,t){return function(e,t,n){const r=t.indexStack,i=e.children||[],o=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<i.length;){const n=i[a];r[r.length-1]=a,s.push(o.move(t.handle(n,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&s.push(o.move(Uy(n,i[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function iw(e,t){return function(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),i=[],o=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!cy(e.stack,t))continue;const n=e.compilePattern(t);let o;for(;o=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=o.index+(e?o[1].length:0);i.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(i.push(r),s[r]={before:e,after:n})}}i.sort(Jy);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const e=i[a];e<l||e>=c||e+1<c&&i[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||i[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&o.push(Yy(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(o.push(gy(r.charCodeAt(e))),l++):o.push("\\"))}return o.push(Yy(r.slice(l,c),n.after)),o.join("")}(this,e,t)}function ow(e){const t=this;t.compiler=function(n){return Zy(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function sw(e){if(e)throw e}function aw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lw,cw;var hw=function(){if(cw)return lw;cw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!o)return!1;for(r in n);return void 0===r||e.call(n,r)},s=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},a=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return lw=function e(){var t,n,r,l,c,h,u=arguments[0],d=1,p=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},d=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});d<p;++d)if(null!=(t=arguments[d]))for(n in t)r=a(u,n),u!==(l=a(t,n))&&(f&&l&&(o(l)||(c=i(l)))?(c?(c=!1,h=r&&i(r)?r:[]):h=r&&o(r)?r:{},s(u,{name:n,newValue:e(f,h,l)})):void 0!==l&&s(u,{name:n,newValue:l}));return u},lw}();const uw=aw(hw);function dw(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function pw(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function i(o,...s){const a=e[++n];let l=-1;if(o)r(o);else{for(;++l<t.length;)null!==s[l]&&void 0!==s[l]||(s[l]=t[l]);t=s,a?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let s;r&&t.push(i);try{s=e.apply(this,t)}catch(e){if(r&&n)throw e;return i(e)}r||(s&&s.then&&"function"==typeof s.then?s.then(o,i):s instanceof Error?i(s):o(s))}function i(e,...r){n||(n=!0,t(e,...r))}function o(e){i(null,e)}}(a,i)(...s):r(null,...s)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}class fw extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!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}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=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=s?s.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=s?s.line:void 0,this.name=Uv(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=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}fw.prototype.file="",fw.prototype.name="",fw.prototype.reason="",fw.prototype.message="",fw.prototype.stack="",fw.prototype.column=void 0,fw.prototype.line=void 0,fw.prototype.ancestors=void 0,fw.prototype.cause=void 0,fw.prototype.fatal=void 0,fw.prototype.place=void 0,fw.prototype.ruleId=void 0,fw.prototype.source=void 0;const mw={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');gw(e);let n,r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(i=o):(a=-1,i=s));r===i?i=s:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(gw(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){gw(e);let t,n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){const a=e.codePointAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1);else if(t){i=n+1;break}}if(o<0||r<0||0===s||1===s&&o===r-1&&o===i+1)return"";return e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)gw(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){gw(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,i="",o=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2))if(i.length>2){if(r=i.lastIndexOf("/"),r!==i.length-1){r<0?(i="",o=0):(i=i.slice(0,r),o=i.length-1-i.lastIndexOf("/")),s=l,a=0;continue}}else if(i.length>0){i="",o=0,s=l,a=0;continue}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function gw(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const vw={cwd:function(){return"/"}};function yw(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function ww(e){if("string"==typeof e)e=new URL(e);else if(!yw(e)){const t=new 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("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const bw=["history","path","basename","stem","extname","dirname"];class xw{constructor(e){let t;t=e?yw(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":vw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<bw.length;){const e=bw[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)bw.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?mw.basename(this.path):void 0}set basename(e){Sw(e,"basename"),kw(e,"basename"),this.path=mw.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?mw.dirname(this.path):void 0}set dirname(e){Cw(this.basename,"dirname"),this.path=mw.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?mw.extname(this.path):void 0}set extname(e){if(kw(e,"extname"),Cw(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=mw.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yw(e)&&(e=ww(e)),Sw(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?mw.basename(this.path,this.extname):void 0}set stem(e){Sw(e,"stem"),kw(e,"stem"),this.path=mw.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new fw(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){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function kw(e,t){if(e&&e.includes(mw.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+mw.sep+"`")}function Sw(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Cw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Mw=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Tw={}.hasOwnProperty;class Aw extends Mw{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=pw()}copy(){const e=new Aw;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(uw(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(Dw("data",this.frozen),this.namespace[e]=t,this):Tw.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Dw("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=Pw(e),n=this.parser||this.Parser;return Nw("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),Nw("process",this.parser||this.Parser),Ew("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){const o=Pw(e),s=n.parse(o);function a(e,n){e||!n?i(e):r?r(n):t(void 0,n)}n.run(s,o,function(e,t,r){if(e||!t||!r)return a(e);const i=t,o=n.stringify(i,r);var s;"string"==typeof(s=o)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(s)?r.value=o:r.result=o,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),Nw("processSync",this.parser||this.Parser),Ew("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,sw(e),t=r}),_w("processSync","process",n),t}run(e,t,n){Iw(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){const s=Pw(t);r.run(e,s,function(t,r,s){const a=r||e;t?o(t):i?i(a):n(void 0,a,s)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){sw(e),n=t,r=!0}),_w("runSync","run",r),n}stringify(e,t){this.freeze();const n=Pw(t),r=this.compiler||this.Compiler;return Ew("stringify",r),Iw(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(Dw("use",this.frozen),null==e);else if("function"==typeof e)a(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?s(e):o(e)}return this;function i(e){if("function"==typeof e)a(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;a(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))throw new 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");s(e.plugins),e.settings&&(r.settings=uw(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){i(e[t])}}}function a(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const s=n[i][1];dw(s)&&dw(r)&&(r=uw(!0,s,r)),n[i]=[e,r,...o]}}}}const Ow=(new Aw).freeze();function Nw(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function Ew(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function Dw(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Iw(e){if(!dw(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function _w(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pw(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new xw(e)}var Rw,Lw,Bw,zw,Vw,Fw,Hw,qw,jw,$w,Ww,Uw,Kw,Gw,Jw,Yw,Xw,Zw,Qw,eb,tb=e=>{throw TypeError(e)},nb=(e,t,n)=>t.has(e)||tb("Cannot "+n),rb=(e,t,n)=>(nb(e,t,"read from private field"),n?n.call(e):t.get(e)),ib=(e,t,n)=>t.has(e)?tb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ob=(e,t,n,r)=>(nb(e,t,"write to private field"),t.set(e,n),n);class sb{}class ab{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw om();return e}}}class lb extends sb{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new lb(e,t,n)}}const cb=class extends ab{constructor(e){super(),ib(this,Rw),ib(this,Lw),ib(this,Bw),ib(this,zw),ib(this,Vw),ib(this,Fw),ib(this,Hw),ob(this,Rw,Rd.none),ob(this,Lw,e=>e.isText),ob(this,Bw,(e,t)=>{if(rb(this,Lw).call(this,e)&&rb(this,Lw).call(this,t)&&Rd.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)}),ob(this,zw,e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw function(e){return new tm(em.parserMatchError,`Cannot match target parser for node: ${rm(e)}.`)}(e);return t}),ob(this,Vw,e=>{const t=rb(this,zw).call(this,e);t.spec.parseMarkdown.runner(this,e,t)}),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(lb.create(e,[],t)),this),ob(this,Fw,()=>{ob(this,Rw,Rd.none);const e=this.close();return rb(this,Hw).call(this,e.type,e.attrs,e.content)}),this.closeNode=()=>{try{rb(this,Fw).call(this)}catch(e){console.error(e)}return this},ob(this,Hw,(e,t,n)=>{const r=e.createAndFill(t,n,rb(this,Rw));if(!r)throw function(e,t,n){const r="name"in e?e.name:e,i=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(i).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},o=["[Description]",`Cannot create node for ${r}`],s=["[Attributes]",t],a=["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:i(e):"null")],l=[o,s,a].reduce((e,[t,n])=>{const r=`${t}: ${i(n)}.`;return e.concat(r)},[]);return new tm(em.createNodeInParserFail,l.join("\n"))}(e,t,n);return this.push(r),r}),this.addNode=(e,t,n)=>{try{rb(this,Hw).call(this,e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{const n=e.create(t);return ob(this,Rw,n.addToSet(rb(this,Rw))),this},this.closeMark=e=>(ob(this,Rw,e.removeFromSet(rb(this,Rw))),this),this.addText=e=>{try{const t=this.top();if(!t)throw om();const n=t.pop(),r=this.schema.text(e,rb(this,Rw));if(!n)return t.push(r),this;const i=rb(this,Bw).call(this,n,r);return i?(t.push(i),this):(t.push(n,r),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do{e=rb(this,Fw).call(this)}while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>rb(this,Vw).call(this,e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}};Rw=new WeakMap,Lw=new WeakMap,Bw=new WeakMap,zw=new WeakMap,Vw=new WeakMap,Fw=new WeakMap,Hw=new WeakMap,cb.create=(e,t)=>{const n=new cb(e);return e=>(n.run(t,e),n.toDoc())};let hb=cb;const ub=class extends sb{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}};ub.create=(e,t,n,r={})=>new ub(e,t,n,r);let db=ub;const pb=class extends ab{constructor(e){super(),ib(this,qw),ib(this,jw),ib(this,$w),ib(this,Ww),ib(this,Uw),ib(this,Kw),ib(this,Gw),ib(this,Jw),ib(this,Yw),ib(this,Xw),ib(this,Zw),ib(this,Qw),ib(this,eb),ob(this,qw,Rd.none),ob(this,jw,e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw function(e){return new tm(em.serializerMatchError,`Cannot match target serializer for node: ${rm(e)}.`)}(e.type);return t}),ob(this,$w,e=>rb(this,jw).call(this,e).spec.toMarkdown.runner(this,e)),ob(this,Ww,(e,t)=>rb(this,jw).call(this,e).spec.toMarkdown.runner(this,e,t)),ob(this,Uw,e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!rb(this,Ww).call(this,t,e))&&rb(this,$w).call(this,e),t.forEach(e=>rb(this,eb).call(this,e))}),ob(this,Kw,(e,t)=>{if(e.type===t)return e;if(1!==e.children?.length)return e;const n=e=>{if(e.type===t)return e;if(1!==e.children?.length)return null;const[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;const i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r}),ob(this,Gw,e=>{const{children:t}=e;return t?(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){t=rb(this,Kw).call(this,t,r.type);const{children:n,...i}=t,{children:o,...s}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(s)){const t={...s,children:[...o,...n]};return e.slice(0,-1).concat(rb(this,Gw).call(this,t))}}return e.concat(t)},[]),e):e}),ob(this,Jw,e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t}),this.openNode=(e,t,n)=>(this.open(db.create(e,void 0,t,n)),this),ob(this,Yw,(e,t)=>{let n="",r="";const i=e.children;let o=-1,s=-1;if(i){(e=>{e&&e.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),s=t)})})(i);const e=i?.[s],t=i?.[o];if(e&&e.value.endsWith(" ")){const t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){const e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&rb(this,Zw).call(this,"text",void 0,n);const a=t();return r.length&&rb(this,Zw).call(this,"text",void 0,r),a}),ob(this,Xw,(e=!1)=>{const t=this.close(),n=()=>rb(this,Zw).call(this,t.type,t.children,t.value,t.props);return e?rb(this,Yw).call(this,t,n):n()}),this.closeNode=()=>(rb(this,Xw).call(this),this),ob(this,Zw,(e,t,n,r)=>{const i=db.create(e,t,n,r),o=rb(this,Gw).call(this,rb(this,Jw).call(this,i));return this.push(o),o}),this.addNode=(e,t,n,r)=>(rb(this,Zw).call(this,e,t,n,r),this),ob(this,Qw,(e,t,n,r)=>e.isInSet(rb(this,qw))?this:(ob(this,qw,e.addToSet(rb(this,qw))),this.openNode(t,n,{...r,isMark:!0}))),ob(this,eb,e=>{e.isInSet(rb(this,qw))&&(ob(this,qw,e.type.removeFromSet(rb(this,qw))),rb(this,Xw).call(this,!0))}),this.withMark=(e,t,n,r)=>(rb(this,Qw).call(this,e,t,n,r),this),this.closeMark=e=>(rb(this,eb).call(this,e),this),this.build=()=>{let e=null;do{e=rb(this,Xw).call(this)}while(this.size());return e},this.next=e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach(e=>{rb(this,Uw).call(this,e)}),this):(rb(this,Uw).call(this,e),this);var t},this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}};qw=new WeakMap,jw=new WeakMap,$w=new WeakMap,Ww=new WeakMap,Uw=new WeakMap,Kw=new WeakMap,Gw=new WeakMap,Jw=new WeakMap,Yw=new WeakMap,Xw=new WeakMap,Zw=new WeakMap,Qw=new WeakMap,eb=new WeakMap,pb.create=(e,t)=>{const n=new pb(e);return e=>(n.run(e),n.toString(t))};let fb=pb;const mb=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function gb(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const vb=(e,t,n)=>{let r=gb(e,n);if(!r)return!1;let i=xb(r);if(!i){let n=r.blockRange(),i=n&&rf(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(Tb(e,i,t,-1))return!0;if(0==r.parent.content.size&&(wb(o,"end")||_f.isSelectable(o)))for(let n=r.depth;;n--){let s=uf(e.doc,r.before(n),r.after(n),Bd.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(wb(o,"end")?Af.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):_f.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},yb=(e,t,n)=>{let r=gb(e,n);if(!r)return!1;let i=xb(r);return!!i&&function(e,t,n){let r=t.nodeBefore,i=r,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let e=i.lastChild;if(!e)return!1;i=e}let s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let c=uf(e.doc,o,l,Bd.empty);if(!c||c.from!=o||c instanceof Zp&&c.slice.size>=l-o)return!1;if(n){let t=e.tr.step(c);t.setSelection(Df.create(t.doc,o)),n(t.scrollIntoView())}return!0}(e,i,t)};function wb(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const bb=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=xb(r)}let s=o&&o.nodeBefore;return!(!s||!_f.isSelectable(s))&&(t&&t(e.tr.setSelection(_f.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function xb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function kb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function Sb(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Cb=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Sb(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(Af.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0};const Mb=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof _f&&e.selection.node.isBlock)return!(!n.parentOffset||!cf(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let i,o,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),o=Sb(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&o?{type:o}:null),i=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Df||e.selection instanceof Rf)&&c.deleteSelection();let h=c.mapping.map(n.pos),u=cf(c.doc,h,s.length,s);if(u||(s[0]=o?{type:o}:null,u=cf(c.doc,h,s.length,s)),!u)return!1;if(c.split(h,s.length,s),!a&&l&&n.node(i).type!=o){let e=c.mapping.map(n.before(i)),t=c.doc.resolve(e);o&&n.node(i-1).canReplaceWith(t.index(),t.index()+1,o)&&c.setNodeMarkup(c.mapping.map(n.before(i)),o)}return t&&t(c.scrollIntoView()),!0};function Tb(e,t,n,r){let i,o,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(o,o+1)||!i.isTextblock&&!hf(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(i=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(i[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,o=Dd.empty;for(let e=i.length-1;e>=0;e--)o=Dd.from(i[e].create(null,o));o=Dd.from(s.copy(o));let l=e.tr.step(new Qp(t.pos-1,r,t.pos,r,new Bd(o,1,0),i.length,!0)),c=l.doc.resolve(r+2*i.length);c.nodeAfter&&c.nodeAfter.type==s.type&&hf(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let h=a.type.spec.isolating||r>0&&l?null:Af.findFrom(t,1),u=h&&h.$from.blockRange(h.$to),d=u&&rf(u);if(null!=d&&d>=t.depth)return n&&n(e.tr.lift(u,d).scrollIntoView()),!0;if(c&&wb(a,"start",!0)&&wb(s,"end")){let r=s,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=a,l=1;for(;!o.isTextblock;o=o.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=Dd.empty;for(let e=i.length-1;e>=0;e--)r=Dd.from(i[e].copy(r));n(e.tr.step(new Qp(t.pos-i.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Bd(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Ab(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(Df.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}const Ob=Ab(-1),Nb=Ab(1);function Eb(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&of(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}function Db(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function Ib(e,t=null,n){return function(n,r){let{empty:i,$cursor:o,ranges:s}=n.selection;if(i&&!o||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:i,$to:o}=t[r],s=0==i.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,o.pos,(e,t)=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(o)e.isInSet(n.storedMarks||o.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let i,o=n.tr;i=!s.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e));for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(i){let n=r.pos,i=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,h=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<i&&(n+=c,i-=h),o.addMark(n,i,e.create(t))}else o.removeMark(r.pos,a.pos,e)}r(o.scrollIntoView())}return!0}}function _b(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let Pb=_b(mb,vb,bb),Rb=_b(mb,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let i=kb(r);if(!i)return!1;let o=i.nodeAfter;if(Tb(e,i,t,1))return!0;if(0==r.parent.content.size&&(wb(o,"start")||_f.isSelectable(o))){let n=uf(e.doc,r.before(),r.after(),Bd.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(wb(o,"start")?Af.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):_f.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=kb(r)}let s=o&&o.nodeAfter;return!(!s||!_f.isSelectable(s))&&(t&&t(e.tr.setSelection(_f.create(e.doc,o.pos)).scrollIntoView()),!0)});const Lb={Enter:_b((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Rf||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Sb(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(Df.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(cf(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&rf(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},Mb),"Mod-Enter":Cb,Backspace:Pb,"Mod-Backspace":Pb,"Shift-Backspace":Pb,Delete:Rb,"Mod-Delete":Rb,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Rf(e.doc))),!0)},Bb={"Ctrl-h":Lb.Backspace,"Alt-Backspace":Lb["Mod-Backspace"],"Ctrl-d":Lb.Delete,"Ctrl-Alt-Backspace":Lb["Mod-Delete"],"Alt-Delete":Lb["Mod-Delete"],"Alt-d":Lb["Mod-Delete"],"Ctrl-a":Ob,"Ctrl-e":Nb};for(let e in Lb)Bb[e]=Lb[e];const zb=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?Bb:Lb,Vb="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Fb="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function Hb(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Vb?i=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function qb(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function jb(e){return new Uf({props:{handleKeyDown:$b(e)}})}function $b(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Hb(n)]=e[n];return t}(e);return function(e,n){let r,i=oi(n),o=t[qb(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[qb(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Fb&&n.ctrlKey&&n.altKey)&&(r=Qr[n.keyCode])&&r!=i){let i=t[qb(r,n)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}const Wb=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Ub=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Kb=null;const Gb=function(e,t,n){let r=Kb||(Kb=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Jb=function(e,t,n,r){return n&&(Xb(e,t,n,r,-1)||Xb(e,t,n,r,1))},Yb=/^(img|br|input|textarea|hr)$/i;function Xb(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Zb(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Qb(e)||Yb.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Wb(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(o=n.pmViewDesc)||void 0===o?void 0:o.ignoreForSelection))return!1;t+=i}else e=n,t=i<0?Zb(e):0}}}}function Zb(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Qb(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const ex=function(e){return e.focusNode&&Jb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tx(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const nx="undefined"!=typeof navigator?navigator:null,rx="undefined"!=typeof document?document:null,ix=nx&&nx.userAgent||"",ox=/Edge\/(\d+)/.exec(ix),sx=/MSIE \d/.exec(ix),ax=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ix),lx=!!(sx||ax||ox),cx=sx?document.documentMode:ax?+ax[1]:ox?+ox[1]:0,hx=!lx&&/gecko\/(\d+)/i.test(ix);hx&&(/Firefox\/(\d+)/.exec(ix)||[0,0])[1];const ux=!lx&&/Chrome\/(\d+)/.exec(ix),dx=!!ux,px=ux?+ux[1]:0,fx=!lx&&!!nx&&/Apple Computer/.test(nx.vendor),mx=fx&&(/Mobile\/\w+/.test(ix)||!!nx&&nx.maxTouchPoints>2),gx=mx||!!nx&&/Mac/.test(nx.platform),vx=!!nx&&/Win/.test(nx.platform),yx=/Android \d/.test(ix),wx=!!rx&&"webkitFontSmoothing"in rx.documentElement.style,bx=wx?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xx(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function kx(e,t){return"number"==typeof e?e:e[t]}function Sx(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Cx(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Ub(s);continue}let e=s,n=e==o.body,a=n?xx(o):Sx(e),l=0,c=0;if(t.top<a.top+kx(r,"top")?c=-(a.top-t.top+kx(i,"top")):t.bottom>a.bottom-kx(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+kx(i,"top")-a.top:t.bottom-a.bottom+kx(i,"bottom")),t.left<a.left+kx(r,"left")?l=-(a.left-t.left+kx(i,"left")):t.right>a.right-kx(r,"right")&&(l=t.right-a.right+kx(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let h=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s="absolute"==h?s.offsetParent:Ub(s)}}function Mx(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ub(r));return t}function Tx(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Ax=null;function Ox(e,t){let n,r,i,o,s=2e8,a=0,l=t.top,c=t.top;for(let h=e.firstChild,u=0;h;h=h.nextSibling,u++){let e;if(1==h.nodeType)e=h.getClientRects();else{if(3!=h.nodeType)continue;e=Gb(h).getClientRects()}for(let d=0;d<e.length;d++){let p=e[d];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=h,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==h.nodeType&&e&&(a=u+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=h,o={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=u+1)}}return!n&&i&&(n=i,r=o,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,i=document.createRange();for(let o=0;o<r;o++){i.setEnd(e,o+1),i.setStart(e,o);let r=_x(i,1);if(r.top!=r.bottom&&Nx(t,r)){n={node:e,offset:o+(t.left>=(r.left+r.right)/2?1:0)};break}}return i.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Ox(n,r)}function Nx(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ex(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let n=e.childNodes[o];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Nx(t,i))return Ex(n,t,i)}}if((o=(o+1)%r)==i)break}return e}function Dx(e,t){let n,r=e.dom.ownerDocument,i=0,o=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Zb(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Zb(r.startContainer),r.startOffset)}}}(r,t.left,t.top);o&&({node:n,offset:i}=o);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Nx(t,n))return null;if(a=Ex(e.dom,t,n),!a)return null}if(fx)for(let e=a;n&&e;e=Ub(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(hx&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let e,r=n.childNodes[i];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&i++}let r;wx&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(s=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!o&&t.left>r.left||t.top>r.top?i=s.posBefore:(!o&&t.right<r.left||t.bottom<r.top)&&(i=s.posAfter),o=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==s&&(s=function(e,t,n){let{node:r,offset:i}=Ox(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Ix(e){return e.top<e.bottom||e.left<e.right}function _x(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Ix(e))return e}return Array.prototype.find.call(n,Ix)||e.getBoundingClientRect()}const Px=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Rx(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=wx||hx;if(3==r.nodeType){if(!s||!Px.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,Lx(_x(Gb(r,e,t),o),o<0)}{let e=_x(Gb(r,i,i),n);if(hx&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=_x(Gb(r,i-1,i-1),-1);if(t.top==e.top){let n=_x(Gb(r,i,i+1),-1);if(n.top!=e.top)return Lx(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==Zb(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return Bx(e.getBoundingClientRect(),!1)}if(null==o&&i<Zb(r)){let e=r.childNodes[i];if(1==e.nodeType)return Bx(e.getBoundingClientRect(),!0)}return Bx(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==Zb(r))){let e=r.childNodes[i-1],t=3==e.nodeType?Gb(e,Zb(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Lx(_x(t,1),!1)}if(null==o&&i<Zb(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Gb(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Lx(_x(t,-1),!0)}return Lx(_x(3==r.nodeType?Gb(r):r,-n),n>=0)}function Lx(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Bx(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function zx(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}const Vx=/[\u0590-\u08ac]/;let Fx=null,Hx=null,qx=!1;function jx(e,t,n){return Fx==t&&Hx==n?qx:(Fx=t,Hx=n,qx="up"==n||"down"==n?function(e,t,n){let r=t.selection,i="up"==n?r.$from:r.$to;return zx(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Rx(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Gb(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=e.domSelection();return a?Vx.test(r.parent.textContent)&&a.modify?zx(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:u}=e.domSelectionRange(),d=h&&!c.contains(1==h.nodeType?h:h.parentNode)||t==h&&i==u;try{a.collapse(o,s),t&&(t!=o||i!=s)&&a.extend&&a.extend(t,i)}catch(e){}return null!=l&&(a.caretBidiLevel=l),d}):"left"==n||"backward"==n?o:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class $x{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Wb(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i,o=this.getDesc(r);if(o&&(!t||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return o;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof Xx){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Wx&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Wb(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Wb(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Wb(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Wb(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),h=!1;if((hx||fx)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(h=!(!t||"\n"!=e.nodeValue[t-1]),h&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:Wb(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];h=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(hx&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||h&&fx)&&Jb(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Jb(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&(!h||!hx)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=r||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-r,t-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Wx extends $x{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ux extends $x{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Kx extends $x{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=Ip.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Kx(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Kx.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=hk(i,t,o,n)),e>0&&(i=hk(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Gx extends $x{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s,a=i.nodeViews[t.type.name],l=a&&a(t,i,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:o,n,r),c=l&&l.dom,h=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Ip.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:h}=e)}h||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=ok(c,n,t),l?s=new Zx(e,t,n,r,c,h||null,u,l,i,o+1):t.isText?new Yx(e,t,n,r,c,u,i):new Gx(e,t,n,r,c,h||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Dd.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&sk(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new lk(this,o&&o.node,e);!function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let h,u,d,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(h?(u||(u=[h])).push(e):h=e)}if(h)if(u){u.sort(ck);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(h,c,!!l);if(l)p=-1,d=l,l=null;else{if(!(c<e.childCount))break;p=c,d=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+d.nodeSize;if(d.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=d.cut(e-o),d=d.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;r(d,d.isInline&&!d.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(o,d),p),o=f}}(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?Rd.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)},(t,o,l,c)=>{let h;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,h,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),Qx(this.contentDOM,this.children,e),mx&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Df)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new Ux(this,i,t,r);e.input.compositionNodes.push(o),this.children=hk(this.children,n,n+r.length,e,o)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(sk(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=rk(this.dom,this.nodeDOM,nk(this.outerDeco,this.node,t),nk(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Jx(e,t,n,r,i){ok(r,t,e);let o=new Gx(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Yx extends Gx{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new Yx(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Xx extends $x{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Zx extends Gx{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Qx(e,t,n){let r=e.firstChild,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=ak(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(a,r);if(s instanceof Kx){let t=r?r.previousSibling:e.lastChild;Qx(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=ak(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const ek=function(e){e&&(this.nodeName=e)};ek.prototype=Object.create(null);const tk=[new ek];function nk(e,t,n){if(0==e.length)return tk;let r=n?tk[0]:new ek,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s){s.nodeName&&i.push(r=new ek(s.nodeName));for(let e in s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new ek(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}}return i}function rk(e,t,n,r){if(n==tk&&r==tk)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||(t=document.createElement(o.nodeName),t.pmIsDeco=!0,t.appendChild(i),s=tk[0]),i=t}ik(i,s||tk[0],o)}return i}function ik(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function ok(e,t,n){return rk(e,e,tk,nk(t,n,1!=e.nodeType))}function sk(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ak(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class lk{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Kx)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Kx.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let i,o=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))o=this.top.children.indexOf(i,this.index);else for(let r=this.index,i=Math.min(this.top.children.length,r+5);r<i;r++){let i=this.top.children[r];if(i.matchesNode(e,t,n)&&!this.preMatch.matched.has(i)){o=r;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Gx){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c,h=a.dom,u=this.isLocked(h)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&sk(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=h&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,o+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!sk(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Gx.create(this.top,t,n,r,i,o);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,i){let o=Gx.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Wx(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kx;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Yx)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((fx||dx)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Xx(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function ck(e,t){return e.type.side-t.type.side}function hk(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,h=a+=l.size;c>=n||h<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),h>n&&o.push(l.slice(n-c,l.size,r)))}return o}function uk(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(ex(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&_f.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,i=t==Zb(e);r||i;){if(e==n)return!0;let t=Wb(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==Zb(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new _f(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let h=r.resolve(a);if(!l){l=bk(e,h,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1)}return l}function dk(e){return e.editable?e.hasFocus():kk(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function pk(e,t=!1){let n=e.state.selection;if(yk(e,n),dk(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&dx){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Jb(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Wb(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&lx&&cx<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,i,{anchor:o,head:s}=n;!fk||n instanceof Df||(n.$from.parent.inlineContent||(r=mk(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=mk(e,n.to))),e.docView.setSelection(o,s,e,t),fk&&(r&&vk(r),i&&vk(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{dk(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const fk=fx||dx&&px<63;function mk(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(fx&&i&&"false"==i.contentEditable)return gk(i);if(!(i&&"false"!=i.contentEditable||o&&"false"!=o.contentEditable)){if(i)return gk(i);if(o)return gk(o)}}function gk(e){return e.contentEditable="true",fx&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function vk(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function yk(e,t){if(t instanceof _f){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(wk(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else wk(e)}function wk(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function bk(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Df.between(t,n,r)}function xk(e){return!(e.editable&&!e.hasFocus())&&kk(e)}function kk(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Sk(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&Af.findFrom(o,t)}function Ck(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Mk(e,t,n){let r=e.state.selection;if(!(r instanceof Df)){if(r instanceof _f&&r.node.isInline)return Ck(e,new Df(t>0?r.$to:r.$from));{let n=Sk(e.state,t);return!!n&&Ck(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Ck(e,new Df(r.$anchor,o))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Sk(e.state,t);return!!(n&&n instanceof _f)&&Ck(e,n)}if(!(gx&&n.indexOf("m")>-1)){let n,i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText)return!1;let s=t<0?i.pos-o.nodeSize:i.pos;return!!(o.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(_f.isSelectable(o)?Ck(e,new _f(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):!!wx&&Ck(e,new Df(e.state.doc.resolve(t<0?s:s+o.nodeSize))))}}function Tk(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ak(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Ok(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;hx&&1==n.nodeType&&r<Tk(n)&&Ak(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Ak(e,-1))i=n,o=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Nk(n))break;{let t=n.previousSibling;for(;t&&Ak(t,-1);)i=n.parentNode,o=Wb(t),t=t.previousSibling;if(t)n=t,r=Tk(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ek(e,n,r):i&&Ek(e,i,o)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=Tk(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Ak(n.childNodes[r],1))break;i=n,o=++r}else{if(Nk(n))break;{let t=n.nextSibling;for(;t&&Ak(t,1);)i=t.parentNode,o=Wb(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Tk(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}i&&Ek(e,i,o)}(e)}function Nk(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ek(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Qb(e);)t=Wb(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Qb(e);)t=Wb(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ex(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&pk(e)},50)}function Dk(e,t){let n=e.state.doc.resolve(t);if(!dx&&!vx&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Ik(e,t,n){let r=e.state.selection;if(r instanceof Df&&!r.empty||n.indexOf("s")>-1)return!1;if(gx&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Sk(e.state,t);if(n&&n instanceof _f)return Ck(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof Rf?Af.near(n,t):Af.findFrom(n,t);return!!s&&Ck(e,s)}return!1}function _k(e,t){if(!(e.state.selection instanceof Df))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function Pk(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Rk(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||gx&&72==n&&"c"==r)return _k(e,-1)||Ok(e,-1);if(46==n&&!t.shiftKey||gx&&68==n&&"c"==r)return _k(e,1)||Ok(e,1);if(13==n||27==n)return!0;if(37==n||gx&&66==n&&"c"==r){let t=37==n?"ltr"==Dk(e,e.state.selection.from)?-1:1:-1;return Mk(e,t,r)||Ok(e,t)}if(39==n||gx&&70==n&&"c"==r){let t=39==n?"ltr"==Dk(e,e.state.selection.from)?1:-1:1;return Mk(e,t,r)||Ok(e,t)}return 38==n||gx&&80==n&&"c"==r?Ik(e,-1,r)||Ok(e,-1):40==n||gx&&78==n&&"c"==r?function(e){if(!fx||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Pk(e,n,"true"),setTimeout(()=>Pk(e,n,"false"),20)}return!1}(e)||Ik(e,1,r)||Ok(e,1):r==(gx?"m":"c")&&(66==n||73==n||89==n||90==n)}function Lk(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Ip.fromSchema(e.state.schema),a=Uk(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,h=l.firstChild,u=0;for(;h&&1==h.nodeType&&(c=$k[h.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}h=l.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Bk(e,t,n,r,i){let o,s,a=i.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Bd(Dd.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=Ip.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Uk().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&$k[i[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Kk||(Kk=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Kk.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),wx&&function(e){let t=e.querySelectorAll(dx?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||kp.fromSchema(e.state.schema);s=t.parseSlice(o,{preserveWhitespace:!(!l&&!h),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||zk.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(h)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=Dd.from(t.create(n[e+1],i)),o++,s++}return new Bd(i,o,s)}(jk(s,+h[1],+h[2]),h[4]);else if(s=Bd.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),o=[];if(e.forEach(e=>{if(!o)return;let t,n=i.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&r.length&&Fk(n,r,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=Hk(o[o.length-1],r.length));let t=Vk(e,n);o.push(t),i=i.matchType(t.type),r=n}}),o)return Dd.from(o)}return e}(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=jk(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const zk=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Vk(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Dd.from(e));return e}function Fk(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=Fk(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Dd.from(Vk(n,e,i+1))))}}function Hk(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Hk(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Dd.empty,!0);return e.copy(n.append(r))}function qk(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(o=0),i<r-1&&(a=qk(a,t,n,r,i+1,o)),i>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Dd.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function jk(e,t,n){return t<e.openStart&&(e=new Bd(qk(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Bd(qk(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const $k={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Wk=null;function Uk(){return Wk||(Wk=document.implementation.createHTMLDocument("title"))}let Kk=null;const Gk={},Jk={},Yk={touchstart:!0,touchmove:!0};class Xk{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Zk(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Qk(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>eS(e,t))})}function eS(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function tS(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function nS(e){return{left:e.clientX,top:e.clientY}}function rS(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function iS(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function oS(e,t,n,r,i){return rS(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(i?function(e,t){if(-1==t)return!1;let n,r,i=e.state.selection;i instanceof _f&&(n=i.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(_f.isSelectable(t)){r=n&&i.$from.depth>0&&e>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(e);break}}return null!=r&&(iS(e,_f.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&_f.isSelectable(r))&&(iS(e,new _f(n)),!0)}(e,n))}function sS(e,t,n,r){return rS(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function aS(e,t,n,r){return rS(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(iS(e,Df.create(r,0,r.content.size)),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)iS(e,Df.create(r,o+1,o+1+n.content.size));else{if(!_f.isSelectable(n))continue;iS(e,_f.create(r,o))}return!0}}(e,n,r)}function lS(e){return gS(e)}Jk.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!uS(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!yx||!dx||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!mx||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Rk(e,n)?n.preventDefault():Zk(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,tx(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Jk.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Jk.keypress=(e,t)=>{let n=t;if(uS(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||gx&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Df&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,i))||e.dispatch(i()),n.preventDefault()}};const cS=gx?"metaKey":"ctrlKey";Gk.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=lS(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[cS]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?o="doubleClick":"doubleClick"==e.input.lastClick.type&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=e.posAtCoords(nS(n));s&&("singleClick"==o?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new hS(e,s,n,!!r)):("doubleClick"==o?sS:aS)(e,s.pos,s.inside,n)?n.preventDefault():Zk(e,"pointer"))};class hS{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[cS],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof _f&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!hx||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Zk(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pk(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nS(e))),this.updateAllowDefault(e),this.allowDefault||!t?Zk(this.view,"pointer"):oS(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||fx&&this.mightDrag&&!this.mightDrag.node.isAtom||dx&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(iS(this.view,Af.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Zk(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zk(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function uS(e,t){return!!e.composing||!!(fx&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Gk.touchstart=e=>{e.input.lastTouch=Date.now(),lS(e),Zk(e,"pointer")},Gk.touchmove=e=>{e.input.lastTouch=Date.now(),Zk(e,"pointer")},Gk.contextmenu=e=>lS(e);const dS=yx?5e3:-1;function pS(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>gS(e),t))}function fS(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function mS(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Zb(e=e.childNodes[t-1])}else{if(!e.parentNode||Qb(e))return null;t=Wb(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Qb(e))return null;t=Wb(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function gS(e,t=!1){if(!(yx&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),fS(e),t||e.docView&&e.docView.dirty){let n=uk(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Jk.compositionstart=Jk.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Df&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||dx&&vx&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),gS(e,!0),e.markCursor=null;else if(gS(e,!t.selection.empty),hx&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}pS(e,dS)},Jk.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,pS(e,20))};const vS=lx&&cx<15||mx&&bx<604;function yS(e,t,n,r,i){let o=Bk(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||Bd.empty)))return!0;if(!o)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(o),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function wS(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gk.copy=Jk.cut=(e,t)=>{let n=t,r=e.state.selection,i="cut"==n.type;if(r.empty)return;let o=vS?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Lk(e,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Jk.paste=(e,t)=>{let n=t;if(e.composing&&!yx)return;let r=vS?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&yS(e,wS(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?yS(e,r.value,null,i,t):yS(e,r.textContent,r.innerHTML,i,t)},50)}(e,n)};class bS{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const xS=gx?"altKey":"ctrlKey";function kS(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[xS]}Gk.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,o=e.state.selection,s=o.empty?null:e.posAtCoords(nS(n));if(s&&s.pos>=o.from&&s.pos<=(o instanceof _f?o.to-1:o.to));else if(r&&r.mightDrag)i=_f.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(i=_f.create(e.state.doc,t.posBefore))}let a=(i||e.state.selection).content(),{dom:l,text:c,slice:h}=Lk(e,a);(!n.dataTransfer.files.length||!dx||px>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(vS?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",vS||n.dataTransfer.setData("text/plain",c),e.dragging=new bS(h,kS(e,n),i)},Gk.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Jk.dragover=Jk.dragenter=(e,t)=>t.preventDefault(),Jk.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(nS(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=Bk(e,wS(t.dataTransfer),vS?null:t.dataTransfer.getData("text/html"),!1,i);let s=!(!n||!kS(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||Bd.empty,s)))return void t.preventDefault();if(!o)return;t.preventDefault();let a=o?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),h=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;h?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o);if(l.doc.eq(u))return;let d=l.doc.resolve(c);if(h&&_f.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new _f(d));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(bk(e,d,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Gk.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&pk(e)},20))},Gk.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Gk.beforeinput=(e,t)=>{if(dx&&yx&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,tx(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Jk)Gk[e]=Jk[e];function SS(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class CS{constructor(e,t){this.toDOM=e,this.spec=t||NS,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new AS(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof CS&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&SS(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class MS{constructor(e,t){this.attrs=e,this.spec=t||NS}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new AS(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof MS&&SS(this.attrs,e.attrs)&&SS(this.spec,e.spec)}static is(e){return e.type instanceof MS}destroy(){}}class TS{constructor(e,t){this.attrs=e,this.spec=t||NS}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new AS(i.pos-n,o.pos-n,this)}valid(e,t){let n,{index:r,offset:i}=e.content.findIndex(t.from);return i==t.from&&!(n=e.child(r)).isText&&i+n.nodeSize==t.to}eq(e){return this==e||e instanceof TS&&SS(this.attrs,e.attrs)&&SS(this.spec,e.spec)}destroy(){}}class AS{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new AS(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new AS(e,e,new CS(t,n))}static inline(e,t,n,r){return new AS(e,t,new MS(n,r))}static node(e,t,n,r){return new AS(e,t,new TS(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof MS}get widget(){return this.type instanceof CS}}const OS=[],NS={};class ES{constructor(e,t){this.local=e.length?e:OS,this.children=t.length?t:OS}static create(e,t){return t.length?LS(t,e,0,NS):DS}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==DS||0==e.maps.length?this:this.mapInner(e,t,0,0,n||NS)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),h=c-i;if(h<0||h>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:d,offset:p}=r.content.findIndex(h),f=r.maybeChild(d);if(f&&p==h&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=DS?(a[t]=h,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,i,o,s){function a(e,t){for(let o=0;o<e.local.length;o++){let a=e.local[o].map(r,i,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[o].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+o+1);return n}(a,e,t,n,i,o,s),c=LS(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new ES(t.sort(BS),a)}(this.children,o||[],e,t,n,r,i):o?new ES(o.sort(BS),OS):DS}add(e,t){return t.length?this==DS?ES.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s,a=o+n;if(s=PS(t,e,a)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,s,a+1):r.splice(i,0,o,o+e.nodeSize,LS(s,e,a+1,NS)),i+=3}});let o=_S(i?RS(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new ES(o.length?this.local.concat(o).sort(BS):this.local,r||this.children)}remove(e){return 0==e.length||this==DS?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>o&&t.to<s&&(e[n]=null,(i||(i=[])).push(t));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=DS?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,i=0;i<e.length;i++)if(n=e[i])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ES(r,n):DS}forChild(e,t){if(this==DS)return this;if(t.isLeaf)return ES.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof MS){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new ES(r.sort(BS),OS);return n?new IS([e,n]):e}return n||DS}eq(e){if(this==e)return!0;if(!(e instanceof ES)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return zS(this.localsInner(e))}localsInner(e){if(this==DS)return OS;if(e.inlineContent||!this.local.some(MS.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof MS||t.push(this.local[e]);return t}forEachSet(e){e(this)}}ES.empty=new ES([],[]),ES.removeOverlap=zS;const DS=ES.empty;class IS{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,NS));return IS.from(n)}forChild(e,t){if(t.isLeaf)return ES.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=DS&&(i instanceof IS?n=n.concat(i.members):n.push(i))}return IS.from(n)}eq(e){if(!(e instanceof IS)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?zS(n?t:t.sort(BS)):OS}static from(e){switch(e.length){case 0:return DS;case 1:return e[0];default:return new IS(e.every(e=>e instanceof ES)?e:e.reduce((e,t)=>e.concat(t instanceof ES?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function _S(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new AS(i.from+t,i.to+t,i.type))}return n}function PS(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t,o=0;o<e.length;o++)(t=e[o])&&t.from>n&&t.to<r&&((i||(i=[])).push(t),e[o]=null);return i}function RS(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function LS(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=PS(e,t,s+n);if(a){o=!0;let e=LS(a,t,n+s+1,r);e!=DS&&i.push(s,s+t.nodeSize,e)}});let s=_S(o?RS(e):e,-n).sort(BS);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new ES(s,i):DS}function BS(e,t){return e.from-t.from||e.to-t.to}function zS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),VS(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),VS(t,i+1,o.copy(r.to,o.to)))}}return t}function VS(e,t,n){for(;t<e.length&&BS(n,e[t])>0;)t++;e.splice(t,0,n)}function FS(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=DS&&t.push(r)}),e.cursorWrapper&&t.push(ES.create(e.state.doc,[e.cursorWrapper.deco])),IS.from(t)}const HS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qS=lx&&cx<=11;class jS{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class $S{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);lx&&cx<=11&&e.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),qS&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,HS)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(xk(this.view)){if(this.suppressingSelectionUpdates)return pk(this.view);if(lx&&cx<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Jb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=Ub(t))n.add(t);for(let r=e.anchorNode;r;r=Ub(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&xk(e)&&!this.ignoreSelectionChange(n),i=-1,o=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(i=i<0?n.from:Math.min(n.from,i),o=o<0?n.to:Math.max(n.to,o),n.typeOver&&(s=!0))}if(hx&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&GS(e,n)==t||r.remove()}}}else if((dx||fx)&&a.some(e=>"BR"==e.nodeName)&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode))for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}let l=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ex(n)&&(l=uk(e))&&l.eq(Af.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,pk(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,o),function(e){if(WS.has(e))return;if(WS.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=hx,US)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),US=!0}}(e)),this.handleDOMChange(i,o,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||pk(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(lx&&cx<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!o||Array.prototype.indexOf.call(e.addedNodes,o)<0)&&(i=o)}let o=r&&r.parentNode==e.target?Wb(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?Wb(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let WS=new WeakMap,US=!1;function KS(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Jb(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function GS(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function JS(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(fx&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||fx&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const YS=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function XS(e,t,n,r,i){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=uk(e,t);if(n&&!e.state.selection.eq(n)){if(dx&&yx&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,tx(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),o&&r.setMeta("composition",o),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,h=e.state.selection,u=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),h=c.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:c.anchorOffset}],ex(c)||r.push({node:c.focusNode,offset:c.focusOffset})),dx&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,d=e.someProp("domParser")||kp.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=d.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:JS,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),d=e.state.doc,p=d.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){r-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;o-=e,o&&o<t.size&&eC(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;o-=t,o&&o<e.size&&eC(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(p.content,u.doc.content,u.from,l,c);if(f&&e.input.domChangeCount++,(mx&&e.input.lastIOSEnter>Date.now()-225||yx)&&i.some(e=>1==e.nodeType&&!YS.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,tx(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&h instanceof Df&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=ZS(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);o&&n.setMeta("composition",o),e.dispatch(n)}}return}f={start:h.from,endA:h.to,endB:h.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Df&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),lx&&cx<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&"  "==u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),v=d.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=f.endA;if((mx&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,tx(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||QS(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(QS(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||QS(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(d,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,tx(8,"Backspace"))))return void(yx&&dx&&e.domObserver.suppressSelectionUpdates());dx&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),yx&&!y&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,tx(13,"Enter"))})},20));let w,b=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(b,x,u.doc.slice(f.start-u.from,f.endB-u.from));if(u.sel){let t=ZS(e,n.doc,u.sel);t&&!(dx&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==b||t.head==n.mapping.map(x)-1)||lx&&t.empty&&t.head==b)&&n.setSelection(t)}return o&&n.setMeta("composition",o),n.scrollIntoView()};if(y)if(m.pos==g.pos){lx&&cx<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>pk(e),20));let t=k(e.state.tr.delete(b,x)),n=d.resolve(f.start).marksAcross(d.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(w=function(e,t){let n,r,i,o=e.firstChild.marks,s=t.firstChild.marks,a=o,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<o.length;e++)l=o[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(i(t.child(e)));if(Dd.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=k(e.state.tr);"add"==w.type?t.addMark(b,x,w.mark):t.removeMark(b,x,w.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,b,x));e.someProp("handleTextInput",r=>r(e,b,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function ZS(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:bk(e,t.resolve(n.anchor),t.resolve(n.head))}function QS(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function eC(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class tC{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Xk,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(sC),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=iC(this),rC(this),this.nodeViews=oC(this),this.docView=Jx(this.state.doc,nC(this),FS(this),this.dom,this),this.domObserver=new $S(this,(e,t,n,r)=>XS(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Gk){let n=Gk[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!tS(e,t)||eS(e,t)||!e.editable&&t.type in Jk||n(e,t)},Yk[t]?{passive:!0}:void 0)}fx&&e.dom.addEventListener("input",()=>null),Qk(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Qk(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(sC),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(fS(this),o=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=oC(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Qk(this),this.editable=iC(this),rC(this);let a=FS(this),l=nC(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",h=i||!this.docView.matchesNode(e.doc,l,a);!h&&e.selection.eq(r.selection)||(o=!0);let u="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:Mx(e.dom)}}(this);if(o){this.domObserver.stop();let t=h&&(lx||dx)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(h){let n=dx?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=mS(this)),!i&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Jx(e.doc,l,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Jb(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?pk(this,t):(yk(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Tx(n,0==r?0:r-t)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof _f){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Cx(this,t.getBoundingClientRect(),e)}else Cx(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new bS(e.slice,e.move,r<0?void 0:_f.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[e];if(null!=i&&(n=t?t(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let o=i[r].props[e];if(null!=o&&(n=t?t(o):o))return n}}hasFocus(){if(lx){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Ax)return e.focus(Ax);let t=Mx(e);e.focus(null==Ax?{get preventScroll(){return Ax={preventScroll:!0},!0}}:void 0),Ax||(Ax=!1,Tx(t,0))}(this.dom),pk(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dx(this,e)}coordsAtPos(e,t=1){return Rx(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return jx(this,t||this.state,e)}pasteHTML(e,t){return yS(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return yS(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Lk(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],FS(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Kb=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){eS(e,t)||!Gk[t.type]||!e.editable&&t.type in Jk||Gk[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?fx&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return KS(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?KS(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function nC(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[AS.node(0,e.state.doc.content.size,t)]}function rC(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:AS.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function iC(e){return!e.someProp("editable",t=>!1===t(e.state))}function oC(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function sC(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function aC(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}tC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};const lC={text:(e,t,n,r)=>{const i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{const i=e.marker||n.options.strong||"*",o=n.enter("strong"),s=n.createTracker(r);let a=s.move(i+i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i+i),o(),a},emphasis:(e,t,n,r)=>{const i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),s=n.createTracker(r);let a=s.move(i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i),o(),a}},cC=Ym({},"editorView"),hC=Ym({},"editorState"),uC=Ym([],"initTimer"),dC=Ym({},"editor"),pC=Ym([],"inputRules"),fC=Ym([],"prosePlugins"),mC=Ym([],"remarkPlugins"),gC=Ym([],"nodeView"),vC=Ym([],"markView"),yC=Ym(Ow().use(ny).use(ow),"remark"),wC=Ym({handlers:lC,encode:[]},"remarkStringifyOptions"),bC=ng("ConfigReady");const xC=ng("InitReady");function kC(e){const t=t=>(t.inject(dC,e).inject(fC,[]).inject(mC,[]).inject(pC,[]).inject(gC,[]).inject(vC,[]).inject(wC,{handlers:lC,encode:[]}).inject(yC,Ow().use(ny).use(ow)).inject(uC,[bC]).record(xC),async()=>{await t.waitTimers(uC);const e=t.get(wC);return t.set(yC,Ow().use(ny).use(ow,e)),t.done(xC),()=>{t.remove(dC).remove(fC).remove(mC).remove(pC).remove(gC).remove(vC).remove(wC).remove(yC).remove(uC).clearTimer(xC)}});return aC(t,{displayName:"Init"}),t}const SC=ng("SchemaReady"),CC=Ym([],"schemaTimer"),MC=Ym({},"schema"),TC=Ym([],"nodes"),AC=Ym([],"marks");function OC(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}const NC=e=>(e.inject(MC,{}).inject(TC,[]).inject(AC,[]).inject(CC,[xC]).record(SC),async()=>{await e.waitTimers(CC);const t=e.get(yC),n=e.get(mC).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(yC,n);const r=Object.fromEntries(e.get(TC).map(([e,t])=>[e,OC(t)])),i=Object.fromEntries(e.get(AC).map(([e,t])=>[e,OC(t)])),o=new bp({nodes:r,marks:i});return e.set(MC,o),e.done(SC),()=>{e.remove(MC).remove(TC).remove(AC).remove(CC).clearTimer(SC)}});aC(NC,{displayName:"Schema"});class EC{constructor(){this.#h=new Km,this.#w=null,this.setCtx=e=>{this.#w=e},this.chain=()=>{if(null==this.#w)throw am();const e=this.#w,t=[],n=this.get.bind(this),r={run:()=>{const n=_b(...t),r=e.get(cC);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:function(e,i){const o=n(e);return t.push(o(i)),r}.bind(this)};return r}}#h;#w;get ctx(){return this.#w}create(e,t){const n=e.create(this.#h.sliceMap);return n.set(t),n}get(e){return this.#h.get(e).get()}remove(e){return this.#h.remove(e)}call(e,t){if(null==this.#w)throw am();const n=this.get(e)(t),r=this.#w.get(cC);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#w)throw am();const t=this.#w.get(cC);return e(t.state,t.dispatch,t)}}const DC=Ym(new EC,"commands"),IC=Ym([SC],"commandsTimer"),_C=ng("CommandsReady"),PC=e=>{const t=new EC;return t.setCtx(e),e.inject(DC,t).inject(IC,[SC]).record(_C),async()=>(await e.waitTimers(IC),e.done(_C),()=>{e.remove(DC).remove(IC).clearTimer(_C)})};aC(PC,{displayName:"Commands"});class RC{constructor(){this.#w=null,this.#b=[],this.setCtx=e=>{this.#w=e},this.add=e=>(this.#b.push(e),()=>{this.#b=this.#b.filter(t=>t!==e)}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){const r={key:e,onRun:()=>n};this.#b.push(r),t.push(()=>{this.#b=this.#b.filter(e=>e!==r)})}else this.#b.push(n),t.push(()=>{this.#b=this.#b.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{const e=function(e){const t=_b(Xf,mb,yb,bb);return e.Backspace=t,e}(zb);return this.addObjectKeymap(e)},this.build=()=>{const e={};this.#b.forEach(t=>{e[t.key]=[...e[t.key]||[],t]});return Object.fromEntries(Object.entries(e).map(([e,t])=>{const n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{const i=this.#w;if(null==i)throw im();return _b(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#w;#b;get ctx(){return this.#w}}const LC=Ym(new RC,"keymap"),BC=Ym([SC],"keymapTimer"),zC=ng("KeymapReady"),VC=e=>{const t=new RC;return t.setCtx(e),e.inject(LC,t).inject(BC,[SC]).record(zC),async()=>(await e.waitTimers(BC),e.done(zC),()=>{e.remove(LC).remove(BC).clearTimer(zC)})},FC=ng("ParserReady"),HC=()=>{throw im()},qC=Ym(HC,"parser"),jC=Ym([],"parserTimer"),$C=e=>(e.inject(qC,HC).inject(jC,[SC]).record(FC),async()=>{await e.waitTimers(jC);const t=e.get(yC),n=e.get(MC);return e.set(qC,hb.create(n,t)),e.done(FC),()=>{e.remove(qC).remove(jC).clearTimer(FC)}});aC($C,{displayName:"Parser"});const WC=ng("SerializerReady"),UC=Ym([],"serializerTimer"),KC=()=>{throw im()},GC=Ym(KC,"serializer"),JC=e=>(e.inject(GC,KC).inject(UC,[SC]).record(WC),async()=>{await e.waitTimers(UC);const t=e.get(yC),n=e.get(MC);return e.set(GC,fb.create(n,t)),e.done(WC),()=>{e.remove(GC).remove(UC).clearTimer(WC)}});aC(JC,{displayName:"Serializer"});const YC=Ym("","defaultValue"),XC=Ym(e=>e,"stateOptions"),ZC=Ym([],"editorStateTimer"),QC=ng("EditorStateReady");function eM(e,t,n){if("string"==typeof e)return t(e);if("html"===e.type)return kp.fromSchema(n).parse(e.dom);if("json"===e.type)return tp.fromJSON(n,e.value);throw r=e,new tm(em.docTypeError,`Doc type error, unsupported type: ${rm(r)}`);var r}const tM=new Jf("MILKDOWN_STATE_TRACKER"),nM=e=>(e.inject(YC,"").inject(hC,{}).inject(XC,e=>e).inject(ZC,[FC,WC,_C,zC]).record(QC),async()=>{await e.waitTimers(ZC);const t=e.get(MC),n=e.get(qC),r=e.get(pC),i=e.get(XC),o=e.get(fC),s=eM(e.get(YC),n,t),a=e.get(LC),l=a.addBaseKeymap(),c=[...o,new Uf({key:tM,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(hC,i)}}}),Em({rules:r}),jb(a.build())];e.set(fC,c);const h=i({schema:t,doc:s,plugins:c}),u=$f.create(h);return e.set(hC,u),e.done(QC),()=>{l(),e.remove(YC).remove(hC).remove(XC).remove(ZC).clearTimer(QC)}});aC(nM,{displayName:"EditorState"});const rM=Ym([],"pasteRule"),iM=Ym([SC],"pasteRuleTimer"),oM=ng("PasteRuleReady"),sM=e=>(e.inject(rM,[]).inject(iM,[SC]).record(oM),async()=>(await e.waitTimers(iM),e.done(oM),()=>{e.remove(rM).remove(iM).clearTimer(oM)}));aC(sM,{displayName:"PasteRule"});const aM=ng("EditorViewReady"),lM=Ym([],"editorViewTimer"),cM=Ym({},"editorViewOptions"),hM=Ym(null,"root"),uM=Ym(null,"rootDOM"),dM=Ym({},"rootAttrs");const pM=new Jf("MILKDOWN_VIEW_CLEAR"),fM=e=>(e.inject(hM,document.body).inject(cC,{}).inject(cM,{}).inject(uM,null).inject(dM,{}).inject(lM,[QC,oM]).record(aM),async()=>{await e.wait(xC);const t=e.get(hM)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(fC,t=>[new Uf({key:pM,view:t=>{const r=n?function(e,t){const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(uM,n);const r=t.get(dM);return Object.entries(r).forEach(([e,t])=>n.setAttribute(e,t)),n}(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{r?.parentNode&&r?.parentNode.replaceChild(t.dom,r),r?.remove()}}}}),...t]),await e.waitTimers(lM);const r=e.get(hC),i=e.get(cM),o=Object.fromEntries(e.get(gC)),s=Object.fromEntries(e.get(vC)),a=new tC(n,{state:r,nodeViews:o,markViews:s,transformPasted:(t,n,r)=>(e.get(rM).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...i});var l;return(l=a.dom).classList.add("editor"),l.setAttribute("role","textbox"),e.set(cC,a),e.done(aM),()=>{a?.destroy(),e.remove(hM).remove(cC).remove(cM).remove(uM).remove(dM).remove(lM).clearTimer(aM)}});aC(fM,{displayName:"EditorView"});var mM=(e=>(e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e))(mM||{});class gM{constructor(){this.#x=!1,this.#m="Idle",this.#k=[],this.#S=()=>{},this.#h=new Km,this.#u=new Qm,this.#C=new Map,this.#M=new Map,this.#w=new Zm(this.#h,this.#u),this.#T=()=>{const e=function(e){const t=t=>(t.record(bC),async()=>(await e(t),t.done(bC),()=>{t.clearTimer(bC)}));return aC(t,{displayName:"Config"}),t}(async e=>{await Promise.all(this.#k.map(t=>Promise.resolve(t(e))))}),t=[NC,$C,JC,PC,VC,sM,nM,fM,kC(this),e];this.#A(t,this.#M)},this.#A=(e,t)=>{e.forEach(e=>{const n=this.#w.produce(this.#x?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})},this.#O=(e,t=!1)=>Promise.all([e].flat().map(async e=>{const n=this.#C.get(e),r=n?.cleanup;return t?this.#C.delete(e):this.#C.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r?r():r})),this.#N=async()=>{await Promise.all([...this.#M.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#M.clear()},this.#E=e=>{this.#m=e,this.#S(e)},this.#D=e=>[...e.entries()].map(async([t,n])=>{const{ctx:r,handler:i}=n;if(!i)return;const o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})}),this.enableInspector=(e=!0)=>(this.#x=e,this),this.onStatusChange=e=>(this.#S=e,this),this.config=e=>(this.#k.push(e),this),this.removeConfig=e=>(this.#k=this.#k.filter(t=>t!==e),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(e=>{this.#C.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),"Created"===this.#m&&this.#A(t,this.#C),this},this.remove=async e=>"OnCreate"===this.#m?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#O([e].flat(),!0),this),this.create=async()=>("OnCreate"===this.#m||("Created"===this.#m&&await this.destroy(),this.#E("OnCreate"),this.#T(),this.#A([...this.#C.keys()],this.#C),await Promise.all([this.#D(this.#M),this.#D(this.#C)].flat()),this.#E("Created")),this),this.destroy=async(e=!1)=>"Destroyed"===this.#m||"OnDestroy"===this.#m?this:"OnCreate"===this.#m?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#k=[]),this.#E("OnDestroy"),await this.#O([...this.#C.keys()],e),await this.#N(),this.#E("Destroyed"),this),this.action=e=>e(this.#w),this.inspect=()=>this.#x?[...this.#M.values(),...this.#C.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>Boolean(e)):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new gM}#x;#m;#k;#S;#h;#u;#C;#M;#w;#T;#A;#O;#N;#E;#D;get ctx(){return this.#w}get status(){return this.#m}}function vM(e,t){const n=function(e="cmdKey"){return Ym(()=>()=>!1,e)}(e),r=i=>async()=>{r.key=n,await i.wait(_C);const o=t(i);return i.get(DC).create(n,o),r.run=t=>i.get(DC).call(e,t),()=>{i.get(DC).remove(n)}};return r}function yM(e){const t=n=>async()=>{await n.wait(SC);const r=e(n);return n.update(pC,e=>[...e,r]),t.inputRule=r,()=>{n.update(pC,e=>e.filter(e=>e!==r))}};return t}function wM(e,t){const n=r=>async()=>{const i=t(r);return r.update(AC,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(AC,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(MC).marks[e];if(!n)throw function(e){return new tm(em.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}(e);return n},n}function bM(e,t){const n=r=>async()=>{const i=t(r);return r.update(TC,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(TC,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(MC).nodes[e];if(!n)throw function(e){return new tm(em.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}(e);return n},n}function xM(e){let t;const n=n=>async()=>(await n.wait(SC),t=e(n),n.update(fC,e=>[...e,t]),()=>{n.update(fC,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function kM(e){const t=n=>async()=>{await n.wait(zC);const r=n.get(LC),i=e(n),o=r.addObjectKeymap(i);return t.keymap=i,()=>{o()}};return t}function SM(e,t){const n=r=>async()=>{await r.wait(SC);const i=t(r);return e.type(r)instanceof vp?r.update(gC,t=>[...t,[e.id,i]]):r.update(vC,t=>[...t,[e.id,i]]),n.view=i,n.type=e,()=>{e.type(r)instanceof vp?r.update(gC,t=>t.filter(t=>t[0]!==e.id)):r.update(vC,t=>t.filter(t=>t[0]!==e.id))}};return n}function CM(e,t){const n=Ym(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function MM(e,t){const n=CM(t,e),r=bM(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>{const r=n(t);return MM(e,r)},i}function TM(e,t){const n=CM(t,e),r=wM(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.mark=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>{const r=n(t);return TM(e,r)},i}function AM(e,t){const n=CM(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=kM(e=>{const r=e.get(n.key),i=Object.entries(t).flatMap(([e,{command:t}])=>{const n=r[e],i=[n.shortcuts].flat(),o=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:o}])});return Object.fromEntries(i)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}const OM=(e,t=()=>({}))=>CM(t,`${e}Attr`),NM=(e,t=()=>({}))=>CM(t,`${e}Attr`);function EM(e,t,n){const r=CM({},e),i=e=>async()=>{await e.wait(xC);const n={plugin:t(e),options:e.get(r.key)};return e.update(mC,e=>[...e,n]),()=>{e.update(mC,e=>e.filter(e=>e!==n))}},o=[r,i];return o.id=e,o.plugin=i,o.options=r,o}const DM=Math.min,IM=Math.max,_M=Math.round,PM=e=>({x:e,y:e}),RM={left:"right",right:"left",bottom:"top",top:"bottom"},LM={start:"end",end:"start"};function BM(e,t,n){return IM(e,DM(t,n))}function zM(e,t){return"function"==typeof e?e(t):e}function VM(e){return e.split("-")[0]}function FM(e){return e.split("-")[1]}function HM(e){return"x"===e?"y":"x"}function qM(e){return"y"===e?"height":"width"}const jM=new Set(["top","bottom"]);function $M(e){return jM.has(VM(e))?"y":"x"}function WM(e){return HM($M(e))}function UM(e){return e.replace(/start|end/g,e=>LM[e])}const KM=["left","right"],GM=["right","left"],JM=["top","bottom"],YM=["bottom","top"];function XM(e,t,n,r){const i=FM(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?GM:KM:t?KM:GM;case"left":case"right":return t?JM:YM;default:return[]}}(VM(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(UM)))),o}function ZM(e){return e.replace(/left|right|bottom|top/g,e=>RM[e])}function QM(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function eT(e,t,n){let{reference:r,floating:i}=e;const o=$M(t),s=WM(t),a=qM(s),l=VM(t),c="y"===o,h=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:h,y:r.y-i.height};break;case"bottom":p={x:h,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-i.width,y:u};break;default:p={x:r.x,y:r.y}}switch(FM(t)){case"start":p[s]-=d*(n&&c?-1:1);break;case"end":p[s]+=d*(n&&c?-1:1)}return p}async function tT(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=zM(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(p),m=a[d?"floating"===u?"reference":"floating":u],g=QM(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),v="floating"===u?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),w=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},b=QM(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-b.top+f.top)/w.y,bottom:(b.bottom-g.bottom+f.bottom)/w.y,left:(g.left-b.left+f.left)/w.x,right:(b.right-g.right+f.right)/w.x}}const nT=new Set(["left","top"]);function rT(){return"undefined"!=typeof window}function iT(e){return aT(e)?(e.nodeName||"").toLowerCase():"#document"}function oT(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function sT(e){var t;return null==(t=(aT(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function aT(e){return!!rT()&&(e instanceof Node||e instanceof oT(e).Node)}function lT(e){return!!rT()&&(e instanceof Element||e instanceof oT(e).Element)}function cT(e){return!!rT()&&(e instanceof HTMLElement||e instanceof oT(e).HTMLElement)}function hT(e){return!(!rT()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof oT(e).ShadowRoot)}const uT=new Set(["inline","contents"]);function dT(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=CT(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!uT.has(i)}const pT=new Set(["table","td","th"]);function fT(e){return pT.has(iT(e))}const mT=[":popover-open",":modal"];function gT(e){return mT.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const vT=["transform","translate","scale","rotate","perspective"],yT=["transform","translate","scale","rotate","perspective","filter"],wT=["paint","layout","strict","content"];function bT(e){const t=xT(),n=lT(e)?CT(e):e;return vT.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||yT.some(e=>(n.willChange||"").includes(e))||wT.some(e=>(n.contain||"").includes(e))}function xT(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const kT=new Set(["html","body","#document"]);function ST(e){return kT.has(iT(e))}function CT(e){return oT(e).getComputedStyle(e)}function MT(e){return lT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function TT(e){if("html"===iT(e))return e;const t=e.assignedSlot||e.parentNode||hT(e)&&e.host||sT(e);return hT(t)?t.host:t}function AT(e){const t=TT(e);return ST(t)?e.ownerDocument?e.ownerDocument.body:e.body:cT(t)&&dT(t)?t:AT(t)}function OT(e,t,n){var r;void 0===t&&(t=[]);const i=AT(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=oT(i);return o?(NT(s),t.concat(s,s.visualViewport||[],dT(i)?i:[],[])):t.concat(i,OT(i,[]))}function NT(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ET(e){const t=CT(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=cT(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=_M(n)!==o||_M(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function DT(e){return lT(e)?e:e.contextElement}function IT(e){const t=DT(e);if(!cT(t))return PM(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=ET(t);let s=(o?_M(n.width):n.width)/r,a=(o?_M(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const _T=PM(0);function PT(e){const t=oT(e);return xT()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:_T}function RT(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=DT(e);let s=PM(1);t&&(r?lT(r)&&(s=IT(r)):s=IT(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==oT(e))&&t}(o,n,r)?PT(o):PM(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,h=i.width/s.x,u=i.height/s.y;if(o){const e=oT(o),t=r&&lT(r)?oT(r):r;let n=e,i=NT(n);for(;i&&r&&t!==n;){const e=IT(i),t=i.getBoundingClientRect(),r=CT(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,h*=e.x,u*=e.y,l+=o,c+=s,n=oT(i),i=NT(n)}}return QM({width:h,height:u,x:l,y:c})}function LT(e,t){const n=MT(e).scrollLeft;return t?t.left+n:RT(sT(e)).left+n}function BT(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-LT(e,n),y:n.top+t.scrollTop}}const zT=new Set(["absolute","fixed"]);function VT(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=oT(e),r=sT(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=xT();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=LT(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=sT(e),n=MT(e),r=e.ownerDocument.body,i=IM(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=IM(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+LT(e);const a=-n.scrollTop;return"rtl"===CT(r).direction&&(s+=IM(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(sT(e));else if(lT(t))r=function(e,t){const n=RT(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=cT(e)?IT(e):PM(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=PT(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return QM(r)}function FT(e,t){const n=TT(e);return!(n===t||!lT(n)||ST(n))&&("fixed"===CT(n).position||FT(n,t))}function HT(e,t,n){const r=cT(t),i=sT(t),o="fixed"===n,s=RT(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=PM(0);function c(){l.x=LT(i)}if(r||!r&&!o)if(("body"!==iT(t)||dT(i))&&(a=MT(t)),r){const e=RT(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const h=!i||r||o?PM(0):BT(i,a);return{x:s.left+a.scrollLeft-l.x-h.x,y:s.top+a.scrollTop-l.y-h.y,width:s.width,height:s.height}}function qT(e){return"static"===CT(e).position}function jT(e,t){if(!cT(e)||"fixed"===CT(e).position)return null;if(t)return t(e);let n=e.offsetParent;return sT(e)===n&&(n=n.ownerDocument.body),n}function $T(e,t){const n=oT(e);if(gT(e))return n;if(!cT(e)){let t=TT(e);for(;t&&!ST(t);){if(lT(t)&&!qT(t))return t;t=TT(t)}return n}let r=jT(e,t);for(;r&&fT(r)&&qT(r);)r=jT(r,t);return r&&ST(r)&&qT(r)&&!bT(r)?n:r||function(e){let t=TT(e);for(;cT(t)&&!ST(t);){if(bT(t))return t;if(gT(t))return null;t=TT(t)}return null}(e)||n}const WT={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=sT(r),a=!!t&&gT(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=PM(1);const h=PM(0),u=cT(r);if((u||!u&&!o)&&(("body"!==iT(r)||dT(s))&&(l=MT(r)),cT(r))){const e=RT(r);c=IT(r),h.x=e.x+r.clientLeft,h.y=e.y+r.clientTop}const d=!s||u||o?PM(0):BT(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+d.x,y:n.y*c.y-l.scrollTop*c.y+h.y+d.y}},getDocumentElement:sT,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o="clippingAncestors"===n?gT(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=OT(e,[]).filter(e=>lT(e)&&"body"!==iT(e)),i=null;const o="fixed"===CT(e).position;let s=o?TT(e):e;for(;lT(s)&&!ST(s);){const t=CT(s),n=bT(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&zT.has(i.position)||dT(s)&&!n&&FT(e,s))?r=r.filter(e=>e!==s):i=t,s=TT(s)}return t.set(e,r),r}(t,this._c):[].concat(n),s=[...o,r],a=s[0],l=s.reduce((e,n)=>{const r=VT(t,n,i);return e.top=IM(r.top,e.top),e.right=DM(r.right,e.right),e.bottom=DM(r.bottom,e.bottom),e.left=IM(r.left,e.left),e},VT(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:$T,getElementRects:async function(e){const t=this.getOffsetParent||$T,n=this.getDimensions,r=await n(e.floating);return{reference:HT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ET(e);return{width:t,height:n}},getScale:IT,isElement:lT,isRTL:function(e){return"rtl"===CT(e).direction}},UT=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=VM(n),a=FM(n),l="y"===$M(n),c=nT.has(s)?-1:1,h=o&&l?-1:1,u=zM(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:f}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof f&&(p="end"===a?-1*f:f),l?{x:p*h,y:d*c}:{x:d*c,y:p*h}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},KT=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=zM(e,t),c={x:n,y:r},h=await tT(t,l),u=$M(VM(i)),d=HM(u);let p=c[d],f=c[u];if(o){const e="y"===d?"bottom":"right";p=BM(p+h["y"===d?"top":"left"],p,p-h[e])}if(s){const e="y"===u?"bottom":"right";f=BM(f+h["y"===u?"top":"left"],f,f-h[e])}const m=a.fn({...t,[d]:p,[u]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:o,[u]:s}}}}}},GT=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=zM(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const v=VM(i),y=$M(a),w=VM(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(w||!m?[ZM(a)]:function(e){const t=ZM(e);return[UM(e),t,UM(t)]}(a)),k="none"!==f;!d&&k&&x.push(...XM(a,m,f,b));const S=[a,...x],C=await tT(t,g),M=[];let T=(null==(r=o.flip)?void 0:r.overflows)||[];if(h&&M.push(C[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=FM(e),i=WM(e),o=qM(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ZM(s)),[s,ZM(s)]}(i,s,b);M.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every(e=>e<=0)){var A,O;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=S[e];if(t){if(!("alignment"===u&&y!==$M(t))||T.every(e=>$M(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(O=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:O.placement;if(!n)switch(p){case"bestFit":{var N;const e=null==(N=T.filter(e=>{if(k){const t=$M(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},JT=(e,t,n)=>{const r=new Map,i={platform:WT,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:u}=eT(c,r,l),d=r,p={},f=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:g,y:v,data:y,reset:w}=await m({x:h,y:u,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});h=null!=g?g:h,u=null!=v?v:u,p={...p,[o]:{...p[o],...y}},w&&f<=50&&(f++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(c=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):w.rects),({x:h,y:u}=eT(c,d,l))),n=-1)}return{x:h,y:u,placement:d,strategy:i,middlewareData:p}})(e,t,{...i,platform:o})};function YT(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}const XT=CM({filterNodes:e=>{const t=qm(e=>"table"===e.type.name)(e);return!t}},"blockConfig");YT(XT,{displayName:"Ctx<blockConfig>"});const ZT=Am.ie&&Am.ie_version<15||Am.ios&&Am.webkit_version<604;class QT{constructor(){this.#I=()=>{if(!this.#_)return null;const e=this.#_,t=this.#P;if(t&&_f.isSelectable(e.node)){const n=_f.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#R=n,n}return null},this.#R=null,this.#_=null,this.#L=void 0,this.#B=!1,this.#z=()=>{this.#V?.({type:"hide"}),this.#_=null},this.#F=e=>{this.#_=e,this.#V?.({type:"show",active:e})},this.bind=(e,t)=>{this.#w=e,this.#V=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#H),e.addEventListener("mouseup",this.#q),e.addEventListener("dragstart",this.#j)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#H),e.removeEventListener("mouseup",this.#q),e.removeEventListener("dragstart",this.#j)},this.unBind=()=>{this.#V=void 0},this.#H=()=>{this.#L=this.#_?.el.getBoundingClientRect(),this.#I()},this.#q=()=>{this.#B?(this.#B=!1,this.#R=null):requestAnimationFrame(()=>{this.#L&&this.#P?.focus()})},this.#j=e=>{this.#B=!0;const t=this.#P;if(!t)return;t.dom.dataset.dragging="true";const n=this.#R;if(e.dataTransfer&&n){const r=n.content();e.dataTransfer.effectAllowed="copyMove";const{dom:i,text:o}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(ZT?"Text":"text/html",i.innerHTML),ZT||e.dataTransfer.setData("text/plain",o);const s=this.#_?.el;s&&e.dataTransfer.setDragImage(s,0,0),t.dragging={slice:r,move:!0}}},this.keydownCallback=e=>(this.#z(),this.#B=!1,e.dom.dataset.dragging="false",!1),this.#$=at((e,t)=>{if(!e.editable)return;const n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element))return void this.#z();const i=this.#W;if(!i)return;const o=function(e,t,n){if(!e.dom.parentElement)return null;try{const r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==r||r<0)return null;let i=e.state.doc.resolve(r),o=e.state.doc.nodeAt(r),s=e.nodeDOM(r);const a=t=>{const r=i.depth>=1&&0===i.index(i.depth);if(!t&&!r)return;const l=i.before(i.depth);o=e.state.doc.nodeAt(l),s=e.nodeDOM(l),i=e.state.doc.resolve(l),n(i,o)||a(!0)},l=n(i,o);return a(!l),s&&o?{node:o,$pos:i,el:s}:null}catch{return null}}(e,{x:r,y:t.clientY},i);o?this.#F(o):this.#z()},200),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#$(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#B){const n=this.#P?.dom.parentElement;if(!n)return!1;const r=n.scrollHeight>n.clientHeight,i=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&Math.abs(t.y-i.y)<20){const e=n.scrollTop>10?n.scrollTop-10:0;return n.scrollTop=e,!1}const r=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(n.scrollTop+i.height)<r&&Math.abs(t.y-(i.height+i.y))<20){const e=n.scrollTop+10;return n.scrollTop=e,!1}}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#B=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#_=null,this.#U(e))},this.dropCallback=e=>(this.#U(e),!1),this.dragendCallback=e=>{this.#U(e)},this.#U=e=>{this.#B=!1,e.dom.dataset.dragging="false"}}#w;#I;#R;#_;#L;#B;get#W(){try{return this.#w?.get(XT.key).filterNodes}catch{return}}get#P(){return this.#w?.get(cC)}#V;#z;#F;#H;#q;#j;#$;#U}const eA=CM(()=>new QT,"blockService"),tA=CM({},"blockServiceInstance");YT(eA,{displayName:"Ctx<blockService>"}),YT(tA,{displayName:"Ctx<blockServiceInstance>"});const nA=CM({},"blockSpec");YT(nA,{displayName:"Ctx<blockSpec>"});const rA=xM(e=>{const t=new Jf("MILKDOWN_BLOCK"),n=e.get(eA.key)();e.set(tA.key,n);const r=e.get(nA.key);return new Uf({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});YT(rA,{displayName:"Prose<block>"});class iA{constructor(e){this.#K=null,this.#G=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#G)try{this.#J(),this.#G=!0}catch{}})},this.destroy=()=>{this.#Y?.unBind(),this.#Y?.removeEvent(this.#X),this.#X.remove()},this.show=e=>{const t=e.el,n=this.#w.get(cC).dom,r={ctx:this.#w,active:e,editorDom:n,blockDom:this.#X},i={contextElement:t,getBoundingClientRect:()=>this.#Z?this.#Z(r):t.getBoundingClientRect()},o=[GT()];if(this.#Q){const e=this.#Q(r),t=UT(e);o.push(t)}JT(i,this.#X,{placement:this.#ee?this.#ee(r):"left",middleware:[...o,...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.#X.style,{left:`${e}px`,top:`${t}px`}),this.#X.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#X.dataset.show="false"},this.#w=e.ctx,this.#X=e.content,this.#Q=e.getOffset,this.#Z=e.getPosition,this.#ee=e.getPlacement,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.hide()}#X;#w;#Y;#K;#re;#G;#te;#ne;#Q;#Z;#ee;get active(){return this.#K}#J(){const e=this.#w.get(cC);(this.#re??e.dom.parentElement??document.body).appendChild(this.#X);const t=this.#w.get(tA.key);t.bind(this.#w,e=>{"hide"===e.type?(this.hide(),this.#K=null):"show"===e.type&&(this.show(e.active),this.#K=e.active)}),this.#Y=t,this.#Y.addEvent(this.#X),this.#X.draggable=!0}}const oA=[nA,XT,eA,tA,rA];function sA(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return!!o&&(!n||(r.node(o.depth-1).type==e?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Qp(o-1,s,o,s,new Bd(Dd.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Qd(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=rf(r);if(null==a)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);hf(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos);return t(i.scrollIntoView()),!0}(t,n,e,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==i.childCount,c=o.node(-1),h=o.index(-1);if(!c.canReplace(h+(a?0:1),h+1,s.content.append(l?Dd.empty:Dd.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new Qp(u-(a?1:0),d+(l?1:0),u+1,d-1,new Bd((a?Dd.empty:Dd.from(i.copy(Dd.empty))).append(l?Dd.empty:Dd.from(i.copy(Dd.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,o)))}}function aA(e){return String(e||"").toUpperCase()}function lA(){return function(e){const t=function(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Ay(e,"definition",function(e){const n=aA(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){const n=aA(e);return t.get(n)}}(e);Ay(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[My,n];if("imageReference"===e.type||"linkReference"===e.type){const i=t(e.identifier);if(i&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children},[My,n]}})}}function cA(e,t){if(!(t.childCount>=1&&"hardbreak"===t.lastChild?.type.name))return void e.next(t.content);const n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(Dd.fromArray(n))}function hA(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}oA.key=nA.key,oA.pluginKey=rA.key;const uA=NM("emphasis");hA(uA,{displayName:"Attr<emphasis>",group:"Emphasis"});const dA=TM("emphasis",e=>({attrs:{marker:{default:e.get(wC).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(uA.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));hA(dA.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),hA(dA.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const pA=vM("ToggleEmphasis",e=>()=>Ib(dA.type(e)));hA(pA,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const fA=yM(e=>Dm(/(?:^|[^*])\*([^*]+)\*$/,dA.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));hA(fA,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const mA=yM(e=>Dm(/\b_(?![_\s])(.*?[^_\s])_\b/,dA.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));hA(mA,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const gA=AM("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(DC);return()=>t.call(pA.key)}}});hA(gA.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),hA(gA.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const vA=NM("strong");hA(vA,{displayName:"Attr<strong>",group:"Strong"});const yA=TM("strong",e=>({attrs:{marker:{default:e.get(wC).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(vA.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));hA(yA.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),hA(yA.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const wA=vM("ToggleStrong",e=>()=>Ib(yA.type(e)));hA(wA,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const bA=yM(e=>Dm(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),yA.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));hA(bA,{displayName:"InputRule<strong>",group:"Strong"});const xA=AM("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(DC);return()=>t.call(wA.key)}}});hA(xA.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),hA(xA.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const kA=NM("inlineCode");hA(kA,{displayName:"Attr<inlineCode>",group:"InlineCode"});const SA=TM("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(kA.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}}));hA(SA.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),hA(SA.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const CA=vM("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(r.empty)return!1;const{from:o,to:s}=r;if(t.doc.rangeHasMark(o,s,SA.type(e)))return n?.(i.removeMark(o,s,SA.type(e))),!0;return Object.keys(t.schema.marks).filter(e=>e!==SA.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(o,s,e)}),n?.(i.addMark(o,s,SA.type(e).create())),!0});hA(CA,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const MA=yM(e=>Dm(/(?:`)([^`]+)(?:`)$/,SA.type(e)));hA(MA,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const TA=AM("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(DC);return()=>t.call(CA.key)}}});hA(TA.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),hA(TA.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const AA=NM("link");hA(AA,{displayName:"Attr<link>",group:"Link"});const OA=TM("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(AA.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));hA(OA.mark,{displayName:"MarkSchema<link>",group:"Link"});const NA=vM("ToggleLink",e=>(t={})=>Ib(OA.type(e),t));hA(NA,{displayName:"Command<toggleLinkCommand>",group:"Link"});const EA=vM("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let i,o=-1;const{selection:s}=n,{from:a,to:l}=s;if(n.doc.nodesBetween(a,a===l?l+1:l,(t,n)=>{if(OA.type(e).isInSet(t.marks))return i=t,o=n,!1}),!i)return!1;const c=i.marks.find(({type:t})=>t===OA.type(e));if(!c)return!1;const h=o,u=o+i.nodeSize,{tr:d}=n,p=OA.type(e).create({...c.attrs,...t});return!!p&&(r(d.removeMark(h,u,c).addMark(h,u,p).setSelection(new Df(d.selection.$anchor)).scrollIntoView()),!0)});hA(EA,{displayName:"Command<updateLinkCommand>",group:"Link"});const DA=bM("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function IA(e){return Ty(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;const n=t[t.length-1];if(!n)return;const r=n.children.indexOf(e);-1!==r&&n.children.splice(r,1)},!0)}hA(DA,{displayName:"NodeSchema<doc>",group:"Doc"});const _A=EM("remark-preserve-empty-line",()=>()=>IA);hA(_A.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),hA(_A.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const PA=OM("paragraph");hA(PA,{displayName:"Attr<paragraph>",group:"Paragraph"});const RA=MM("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(PA.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{const r=e.get(cC),i=r.state?.doc.lastChild;t.openNode("paragraph"),n.content&&0!==n.content.size||n===i||!function(e){let t=!1;try{e.get(_A.id),t=!0}catch{t=!1}return t}(e)?cA(t,n):t.addNode("html",void 0,"<br />"),t.closeNode()}}}));hA(RA.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),hA(RA.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const LA=vM("TurnIntoText",e=>()=>Db(RA.type(e)));hA(LA,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const BA=AM("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(DC);return()=>t.call(LA.key)}}});hA(BA.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),hA(BA.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const zA=Array(6).fill(0).map((e,t)=>t+1);const VA=CM(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");hA(VA,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const FA=OM("heading");hA(FA,{displayName:"Attr<heading>",group:"Heading"});const HA=MM("heading",e=>{const t=e.get(VA.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:zA.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw sm(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(FA.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),cA(e,t),e.closeNode()}}}});hA(HA.node,{displayName:"NodeSchema<heading>",group:"Heading"}),hA(HA.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const qA=yM(e=>Qf(/^(?<hashes>#+)\s$/,HA.type(e),t=>{const n=t.groups?.hashes?.length||0,r=e.get(cC),{$from:i}=r.state.selection,o=i.node();if("heading"===o.type.name){let e=Number(o.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));hA(qA,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const jA=vM("WrapInHeading",e=>t=>(t??=1,t<1?Db(RA.type(e)):Db(HA.type(e),{level:t})));hA(jA,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const $A=vM("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:i}=t.selection,o=i.node();if(o.type!==HA.type(e)||!t.selection.empty||0!==i.parentOffset)return!1;const s=o.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):Db(RA.type(e))(t,n,r)});hA($A,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const WA=AM("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(DC);return()=>t.call(jA.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(DC);return()=>t.call($A.key)}}});hA(WA.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),hA(WA.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const UA=OM("blockquote");hA(UA,{displayName:"Attr<blockquote>",group:"Blockquote"});const KA=MM("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(UA.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));hA(KA.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),hA(KA.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const GA=yM(e=>Zf(/^\s*>\s$/,KA.type(e)));hA(GA,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const JA=vM("WrapInBlockquote",e=>()=>Eb(KA.type(e)));hA(JA,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const YA=AM("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(DC);return()=>t.call(JA.key)}}});hA(YA.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),hA(YA.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const XA=OM("codeBlock",()=>({pre:{},code:{}}));hA(XA,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const ZA=MM("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(XA.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang??"",i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));hA(ZA.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),hA(ZA.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const QA=yM(e=>Qf(/^```(?<language>[a-z]*)?[\s\n]$/,ZA.type(e),e=>({language:e.groups?.language??""})));hA(QA,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const eO=vM("CreateCodeBlock",e=>(t="")=>Db(ZA.type(e),{language:t}));hA(eO,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const tO=vM("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0));hA(tO,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const nO=AM("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(DC);return()=>t.call(eO.key)}}});hA(nO.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),hA(nO.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const rO=OM("image");hA(rO,{displayName:"Attr<image>",group:"Image"});const iO=MM("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(rO.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));hA(iO.node,{displayName:"NodeSchema<image>",group:"Image"}),hA(iO.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const oO=vM("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:o="",title:s=""}=t,a=iO.type(e).create({src:i,alt:o,title:s});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});hA(oO,{displayName:"Command<insertImageCommand>",group:"Image"});const sO=vM("UpdateImage",e=>(t={})=>(n,r)=>{const i=Wm(n.selection,iO.type(e));if(!i)return!1;const{node:o,pos:s}=i,a={...o.attrs},{src:l,alt:c,title:h}=t;return void 0!==l&&(a.src=l),void 0!==c&&(a.alt=c),void 0!==h&&(a.title=h),r?.(n.tr.setNodeMarkup(s,void 0,a).scrollIntoView()),!0});hA(sO,{displayName:"Command<updateImageCommand>",group:"Image"});hA(yM(e=>new Yf(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{const[o,s,a="",l]=n;return o?t.tr.replaceWith(r,i,iO.type(e).create({src:a,alt:s,title:l})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});const aO=OM("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));hA(aO,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const lO=MM("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(aO.key)(t)," "]:["br",e.get(aO.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:Boolean(t.data?.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));hA(lO.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),hA(lO.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const cO=vM("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(!(r instanceof Df))return!1;if(r.empty){const e=r.$from.node();if(e.childCount>0&&"hardbreak"===e.lastChild?.type.name)return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(Af.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(lO.type(e).create()).scrollIntoView()),!0});hA(cO,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const hO=AM("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(DC);return()=>t.call(cO.key)}}});hA(hO.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),hA(hO.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const uO=OM("hr");hA(uO,{displayName:"Attr<hr>",group:"Hr"});const dO=MM("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(uO.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));hA(dO.node,{displayName:"NodeSchema<hr>",group:"Hr"}),hA(dO.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const pO=yM(e=>new Yf(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{const{tr:o}=t;return n[0]&&o.replaceWith(r-1,i,dO.type(e).create()),o}));hA(pO,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const fO=vM("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=RA.node.type(e).create(),{tr:i,selection:o}=t,{from:s}=o,a=dO.type(e).create();if(!a)return!0;const l=i.replaceSelectionWith(a).insert(s,r),c=Af.findFrom(l.doc.resolve(s),1,!0);return!c||(n(l.setSelection(c).scrollIntoView()),!0)});hA(fO,{displayName:"Command<insertHrCommand>",group:"Hr"});const mO=OM("bulletList");hA(mO,{displayName:"Attr<bulletList>",group:"BulletList"});const gO=MM("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(mO.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));hA(gO.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),hA(gO.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const vO=yM(e=>Zf(/^\s*([-+*])\s$/,gO.type(e)));hA(vO,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const yO=vM("WrapInBulletList",e=>()=>Eb(gO.type(e)));hA(yO,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const wO=AM("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(DC);return()=>t.call(yO.key)}}});hA(wO.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),hA(wO.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const bO=OM("orderedList");hA(bO,{displayName:"Attr<orderedList>",group:"OrderedList"});const xO=MM("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(bO.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));hA(xO.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),hA(xO.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const kO=yM(e=>Zf(/^\s*(\d+)\.\s$/,xO.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));hA(kO,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const SO=vM("WrapInOrderedList",e=>()=>Eb(xO.type(e)));hA(SO,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const CO=AM("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(DC);return()=>t.call(SO.key)}}});hA(CO.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),hA(CO.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const MO=OM("listItem");hA(MO,{displayName:"Attr<listItem>",group:"ListItem"});const TO=MM("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(MO.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",i=null!=t.label?"ordered":"bullet",o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:i,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));hA(TO.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),hA(TO.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const AO=vM("SinkListItem",e=>()=>{return t=TO.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let r=l.lastChild&&l.lastChild.type==a.type,i=Dd.from(r?t.create():null),s=new Bd(Dd.from(t.create(null,Dd.from(a.type.create(null,i)))),r?3:1,0),c=o.start,h=o.end;n(e.tr.step(new Qp(c-(r?3:1),h,c,h,s,1,!0)).scrollIntoView())}return!0};var t});hA(AO,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const OO=vM("LiftListItem",e=>()=>sA(TO.type(e)));hA(OO,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const NO=vM("SplitListItem",e=>()=>{return t=TO.type(e),function(e,n){let{$from:r,$to:i,node:o}=e.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(i))return!1;let s=r.node(-1);if(s.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let i=Dd.empty,o=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-o;e>=r.depth-3;e--)i=Dd.from(r.node(e).copy(i));let s=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;i=i.append(Dd.from(t.createAndFill()));let a=r.before(r.depth-(o-1)),l=e.tr.replace(a,r.after(-s),new Bd(i,4-o,0)),c=-1;l.doc.nodesBetween(a,l.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&l.setSelection(Af.near(l.doc.resolve(c))),n(l.scrollIntoView())}return!0}let a=i.pos==r.end()?s.contentMatchAt(0).defaultType:null,l=e.tr.delete(r.pos,i.pos),c=a?[null,{type:a}]:void 0;return!!cf(l.doc,r.pos,2,c)&&(n&&n(l.split(r.pos,2,c).scrollIntoView()),!0)};var t});hA(NO,{displayName:"Command<splitListItemCommand>",group:"ListItem"});const EO=vM("LiftFirstListItem",e=>()=>function(e){return(t,n,r)=>{const{selection:i}=t;if(!(i instanceof Df))return!1;const{empty:o,$from:s}=i;return!(!o||0!==s.parentOffset)&&(s.node(-1).type===TO.type(e)&&vb(t,n,r))}}(e));hA(EO,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const DO=AM("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(DC);return()=>t.call(NO.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(DC);return()=>t.call(AO.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(DC);return()=>t.call(OO.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(DC);return()=>t.call(EO.key)}}});hA(DO.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),hA(DO.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const IO=bM("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));hA(IO,{displayName:"NodeSchema<text>",group:"Text"});const _O=OM("html");hA(_O,{displayName:"Attr<html>",group:"Html"});const PO=MM("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(_O.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));hA(PO.node,{displayName:"NodeSchema<html>",group:"Html"}),hA(PO.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const RO=[DA,PA,RA,VA,FA,HA,aO,lO,UA,KA,XA,ZA,uO,dO,rO,iO,mO,gO,bO,xO,MO,TO,uA,dA,vA,yA,kA,SA,AA,OA,_O,PO,IO].flat(),LO=[GA,vO,kO,QA,pO,qA].flat(),BO=[fA,mA,MA,bA],zO=vM("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),VO=vM("IsNoteSelected",()=>e=>t=>{if(!e)return!1;return Um(t,e).hasNode}),FO=vM("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:i}=n.selection,{pos:o}=r,{pos:s}=i,a=o-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,s),t?.(n),!0)}),HO=vM("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const o=t.tr,{from:s,to:a}=o.selection;try{o.setBlockType(s,a,r,i)}catch{return!1}return n?.(o),!0}),qO=vM("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{const{$from:e,$to:t}=o.selection,n=e.blockRange(t),s=n&&of(n,r,i);if(!s)return!1;o=o.wrap(n,s)}catch{return!1}return n?.(o),!0}),jO=vM("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const o=t.tr;try{const e=r instanceof tp?r:r.createAndFill(i);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return n?.(o),!0}),$O=vM("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(null==r)return!1;const i=t.tr;try{const e=t.doc.resolve(((e,t,n)=>Math.min(Math.max(e,t),n))(r,0,t.doc.content.size));i.setSelection(Df.near(e))}catch{return!1}return n?.(i.scrollIntoView()),!0}),WO=[LA,JA,jA,$A,eO,cO,fO,oO,sO,SO,yO,AO,NO,OO,EO,pA,CA,wA,NA,EA,zO,VO,FO,HO,qO,jO,$O],UO=[YA,nO,hO,WA,DO,CO,wO,BA,gA,TA,xA].flat(),KO=EM("remarkAddOrderInList",()=>()=>e=>{Ay(e,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});hA(KO.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),hA(KO.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const GO=EM("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;Ay(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const i=[];let o=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;o!==n&&i.push({type:"text",value:e.value.slice(o,n)}),i.push({type:"break",data:{isInline:!0}}),o=n+s[0].length,s=t.exec(e.value)}return i.length>0&&r&&"number"==typeof n?(o<e.value.length&&i.push({type:"text",value:e.value.slice(o)}),r.children.splice(n,1,...i),n+i.length):void 0})});hA(GO.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),hA(GO.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const JO=EM("remarkInlineLink",()=>lA);hA(JO.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),hA(JO.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const YO=["root","blockquote","listItem"],XO=EM("remarkHTMLTransformer",()=>()=>e=>{var t;t=(e,t,n)=>(e=>"html"===e.type)(e)?(n&&YO.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e],function e(n,r,i){if((e=>!!e.children)(n)){const t=[];for(let r=0,i=n.children.length;r<i;r++){const i=n.children[r];if(i){const o=e(i,r,n);if(o)for(let e=0,n=o.length;e<n;e++){const n=o[e];n&&t.push(n)}}}n.children=t}return t(n,r,i)}(e,0,null)[0]});hA(XO.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),hA(XO.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const ZO=EM("remarkMarker",()=>()=>(e,t)=>{Ay(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=(e=>t.value.charAt(e.position.start.offset))(e)})});hA(ZO.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),hA(ZO.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const QO=xM(()=>{let e=!1;const t=new Jf("MILKDOWN_INLINE_NODES_CURSOR"),n=new Uf({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=AS.widget(t,n,{side:-1}),i=document.createElement("span"),o=AS.widget(t,i);return setTimeout(()=>{n.contentEditable="true",i.contentEditable="true"}),ES.create(e.doc,[r,o])}return ES.empty}}});return n});hA(QO,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const eN=xM(e=>new Uf({key:new Jf("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const[i]=t;if(!i)return;const[o]=i.steps;if(i.getMeta("hardbreak")){if(!(o instanceof Zp))return;const{from:t}=o;return r.tr.setNodeMarkup(t,lO.type(e),void 0,[])}if(o instanceof Gp){let t=r.tr;const{from:n,to:i}=o;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===lO.type(e)&&(t=t.setNodeMarkup(r,lO.type(e),void 0,[]))}),t}}}));hA(eN,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const tN=CM(["table","code_block"],"hardbreakFilterNodes");hA(tN,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const nN=xM(e=>{const t=e.get(tN.key);return new Uf({key:new Jf("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[i]=e.steps;if(r&&i){const{from:e}=i,r=n.doc.resolve(e);let o=r.depth,s=!0;for(;o>0;)t.includes(r.node(o).type.name)&&(s=!1),o--;return s}return!0}})});hA(nN,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const rN=xM(e=>{const t=new Jf("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;const r=e.get(VA.key),i=n.state.tr.setMeta("addToHistory",!1);let o=!1;const s={};n.state.doc.descendants((n,a)=>{if(n.type===HA.type(e)){if(0===n.textContent.trim().length)return;const e=n.attrs;let l=r(n);s[l]?(s[l]+=1,l+=`-#${s[l]}`):s[l]=1,e.id!==l&&(o=!0,i.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:l}))}}),o&&n.dispatch(i)};return new Uf({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});hA(rN,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const iN=xM(e=>new Uf({key:new Jf("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;const i=xO.type(e),o=gO.type(e),s=TO.type(e),a=(e,t)=>{let n=!1;const r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n};let l=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===o){const n=e.maybeChild(0);n?.type===s&&"ordered"===n.attrs.listType&&(c=!0,l.setNodeMarkup(t,i,{spread:"true"}),e.descendants((e,t,n,r)=>{if(e.type===s){const n={...e.attrs};a(n,r)&&(l=l.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===s&&n?.type===i){const i={...e.attrs};let o=!1;"ordered"!==i.listType&&(i.listType="ordered",o=!0);const s=n?.maybeChild(0);s&&(o=a(i,r)),o&&(l=l.setNodeMarkup(t,void 0,i),c=!0)}}),c?l.setMeta("addToHistory",!1):null}}));hA(iN,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const oN=[RO,LO,BO,WO,UO,[eN,tN,nN,QO,KO,JO,GO,XO,ZO,_A,rN,iN].flat()].flat();
2
+ /**
3
+ * @vue/shared v3.5.25
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/
7
+ function sN(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const aN="production"!==process.env.NODE_ENV?Object.freeze({}):{},lN="production"!==process.env.NODE_ENV?Object.freeze([]):[],cN=()=>{},hN=()=>!1,uN=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),dN=e=>e.startsWith("onUpdate:"),pN=Object.assign,fN=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},mN=Object.prototype.hasOwnProperty,gN=(e,t)=>mN.call(e,t),vN=Array.isArray,yN=e=>"[object Map]"===MN(e),wN=e=>"function"==typeof e,bN=e=>"string"==typeof e,xN=e=>"symbol"==typeof e,kN=e=>null!==e&&"object"==typeof e,SN=e=>(kN(e)||wN(e))&&wN(e.then)&&wN(e.catch),CN=Object.prototype.toString,MN=e=>CN.call(e),TN=e=>MN(e).slice(8,-1),AN=e=>bN(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,ON=sN(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),NN=sN("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),EN=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},DN=/-\w/g,IN=EN(e=>e.replace(DN,e=>e.slice(1).toUpperCase())),_N=/\B([A-Z])/g,PN=EN(e=>e.replace(_N,"-$1").toLowerCase()),RN=EN(e=>e.charAt(0).toUpperCase()+e.slice(1)),LN=EN(e=>e?`on${RN(e)}`:""),BN=(e,t)=>!Object.is(e,t),zN=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},VN=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},FN=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let HN;const qN=()=>HN||(HN="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function jN(e){if(vN(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],i=bN(r)?KN(r):jN(r);if(i)for(const e in i)t[e]=i[e]}return t}if(bN(e)||kN(e))return e}const $N=/;(?![^(]*\))/g,WN=/:([^]+)/,UN=/\/\*[^]*?\*\//g;function KN(e){const t={};return e.replace(UN,"").split($N).forEach(e=>{if(e){const n=e.split(WN);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function GN(e){let t="";if(bN(e))t=e;else if(vN(e))for(let n=0;n<e.length;n++){const r=GN(e[n]);r&&(t+=r+" ")}else if(kN(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const JN=sN("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"),YN=sN("svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,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,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"),XN=sN("annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"),ZN=sN("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function QN(e){return!!e||""===e}
8
+ /**
9
+ * @vue/reactivity v3.5.25
10
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
11
+ * @license MIT
12
+ **/function eE(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let tE,nE;class rE{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=tE,!e&&tE&&(this.index=(tE.scopes||(tE.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=tE;try{return tE=this,e()}finally{tE=t}}else"production"!==process.env.NODE_ENV&&eE("cannot run an inactive effect scope.")}on(){1===++this._on&&(this.prevScope=tE,tE=this)}off(){this._on>0&&0===--this._on&&(tE=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const iE=new WeakSet;class oE{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,tE&&tE.active&&tE.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,iE.has(this)&&(iE.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||cE(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,kE(this),dE(this);const e=nE,t=yE;nE=this,yE=!0;try{return this.fn()}finally{"production"!==process.env.NODE_ENV&&nE!==this&&eE("Active effect was not restored correctly - this is likely a Vue internal bug."),pE(this),nE=e,yE=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)gE(e);this.deps=this.depsTail=void 0,kE(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?iE.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){fE(this)&&this.run()}get dirty(){return fE(this)}}let sE,aE,lE=0;function cE(e,t=!1){if(e.flags|=8,t)return e.next=aE,void(aE=e);e.next=sE,sE=e}function hE(){lE++}function uE(){if(--lE>0)return;if(aE){let e=aE;for(aE=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;sE;){let t=sE;for(sE=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function dE(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function pE(e){let t,n=e.depsTail,r=n;for(;r;){const e=r.prevDep;-1===r.version?(r===n&&(n=e),gE(r),vE(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function fE(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(mE(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function mE(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===SE)return;if(e.globalVersion=SE,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!fE(e)))return;e.flags|=2;const t=e.dep,n=nE,r=yE;nE=e,yE=!0;try{dE(e);const n=e.fn(e._value);(0===t.version||BN(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{nE=n,yE=r,pE(e),e.flags&=-3}}function gE(e,t=!1){const{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),"production"!==process.env.NODE_ENV&&n.subsHead===e&&(n.subsHead=i),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)gE(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function vE(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let yE=!0;const wE=[];function bE(){wE.push(yE),yE=!1}function xE(){const e=wE.pop();yE=void 0===e||e}function kE(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=nE;nE=void 0;try{t()}finally{nE=e}}}let SE=0;class CE{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ME{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,"production"!==process.env.NODE_ENV&&(this.subsHead=void 0)}track(e){if(!nE||!yE||nE===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==nE)t=this.activeLink=new CE(nE,this),nE.deps?(t.prevDep=nE.depsTail,nE.depsTail.nextDep=t,nE.depsTail=t):nE.deps=nE.depsTail=t,TE(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=nE.depsTail,t.nextDep=void 0,nE.depsTail.nextDep=t,nE.depsTail=t,nE.deps===t&&(nE.deps=e)}return"production"!==process.env.NODE_ENV&&nE.onTrack&&nE.onTrack(pN({effect:nE},e)),t}trigger(e){this.version++,SE++,this.notify(e)}notify(e){hE();try{if("production"!==process.env.NODE_ENV)for(let t=this.subsHead;t;t=t.nextSub)!t.sub.onTrigger||8&t.sub.flags||t.sub.onTrigger(pN({effect:t.sub},e));for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{uE()}}}function TE(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)TE(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),"production"!==process.env.NODE_ENV&&void 0===e.dep.subsHead&&(e.dep.subsHead=e),e.dep.subs=e}}const AE=new WeakMap,OE=Symbol("production"!==process.env.NODE_ENV?"Object iterate":""),NE=Symbol("production"!==process.env.NODE_ENV?"Map keys iterate":""),EE=Symbol("production"!==process.env.NODE_ENV?"Array iterate":"");function DE(e,t,n){if(yE&&nE){let r=AE.get(e);r||AE.set(e,r=new Map);let i=r.get(n);i||(r.set(n,i=new ME),i.map=r,i.key=n),"production"!==process.env.NODE_ENV?i.track({target:e,type:t,key:n}):i.track()}}function IE(e,t,n,r,i,o){const s=AE.get(e);if(!s)return void SE++;const a=s=>{s&&("production"!==process.env.NODE_ENV?s.trigger({target:e,type:t,key:n,newValue:r,oldValue:i,oldTarget:o}):s.trigger())};if(hE(),"clear"===t)s.forEach(a);else{const i=vN(e),o=i&&AN(n);if(i&&"length"===n){const e=Number(r);s.forEach((t,n)=>{("length"===n||n===EE||!xN(n)&&n>=e)&&a(t)})}else switch((void 0!==n||s.has(void 0))&&a(s.get(n)),o&&a(s.get(EE)),t){case"add":i?o&&a(s.get("length")):(a(s.get(OE)),yN(e)&&a(s.get(NE)));break;case"delete":i||(a(s.get(OE)),yN(e)&&a(s.get(NE)));break;case"set":yN(e)&&a(s.get(OE))}}uE()}function _E(e){const t=xD(e);return t===e?t:(DE(t,"iterate",EE),wD(e)?t:t.map(kD))}function PE(e){return DE(e=xD(e),"iterate",EE),e}function RE(e,t){return yD(e)?vD(e)?SD(kD(t)):SD(t):kD(t)}const LE={__proto__:null,[Symbol.iterator](){return BE(this,Symbol.iterator,e=>RE(this,e))},concat(...e){return _E(this).concat(...e.map(e=>vN(e)?_E(e):e))},entries(){return BE(this,"entries",e=>(e[1]=RE(this,e[1]),e))},every(e,t){return VE(this,"every",e,t,void 0,arguments)},filter(e,t){return VE(this,"filter",e,t,e=>e.map(e=>RE(this,e)),arguments)},find(e,t){return VE(this,"find",e,t,e=>RE(this,e),arguments)},findIndex(e,t){return VE(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return VE(this,"findLast",e,t,e=>RE(this,e),arguments)},findLastIndex(e,t){return VE(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return VE(this,"forEach",e,t,void 0,arguments)},includes(...e){return HE(this,"includes",e)},indexOf(...e){return HE(this,"indexOf",e)},join(e){return _E(this).join(e)},lastIndexOf(...e){return HE(this,"lastIndexOf",e)},map(e,t){return VE(this,"map",e,t,void 0,arguments)},pop(){return qE(this,"pop")},push(...e){return qE(this,"push",e)},reduce(e,...t){return FE(this,"reduce",e,t)},reduceRight(e,...t){return FE(this,"reduceRight",e,t)},shift(){return qE(this,"shift")},some(e,t){return VE(this,"some",e,t,void 0,arguments)},splice(...e){return qE(this,"splice",e)},toReversed(){return _E(this).toReversed()},toSorted(e){return _E(this).toSorted(e)},toSpliced(...e){return _E(this).toSpliced(...e)},unshift(...e){return qE(this,"unshift",e)},values(){return BE(this,"values",e=>RE(this,e))}};function BE(e,t,n){const r=PE(e),i=r[t]();return r===e||wD(e)||(i._next=i.next,i.next=()=>{const e=i._next();return e.done||(e.value=n(e.value)),e}),i}const zE=Array.prototype;function VE(e,t,n,r,i,o){const s=PE(e),a=s!==e&&!wD(e),l=s[t];if(l!==zE[t]){const t=l.apply(e,o);return a?kD(t):t}let c=n;s!==e&&(a?c=function(t,r){return n.call(this,RE(e,t),r,e)}:n.length>2&&(c=function(t,r){return n.call(this,t,r,e)}));const h=l.call(s,c,r);return a&&i?i(h):h}function FE(e,t,n,r){const i=PE(e);let o=n;return i!==e&&(wD(e)?n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}):o=function(t,r,i){return n.call(this,t,RE(e,r),i,e)}),i[t](o,...r)}function HE(e,t,n){const r=xD(e);DE(r,"iterate",EE);const i=r[t](...n);return-1!==i&&!1!==i||!bD(n[0])?i:(n[0]=xD(n[0]),r[t](...n))}function qE(e,t,n=[]){bE(),hE();const r=xD(e)[t].apply(e,n);return uE(),xE(),r}const jE=sN("__proto__,__v_isRef,__isVue"),$E=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(xN));function WE(e){xN(e)||(e=String(e));const t=xD(this);return DE(t,"has",e),t.hasOwnProperty(e)}class UE{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const r=this._isReadonly,i=this._isShallow;if("__v_isReactive"===t)return!r;if("__v_isReadonly"===t)return r;if("__v_isShallow"===t)return i;if("__v_raw"===t)return n===(r?i?dD:uD:i?hD:cD).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=vN(e);if(!r){let e;if(o&&(e=LE[t]))return e;if("hasOwnProperty"===t)return WE}const s=Reflect.get(e,t,CD(e)?e:n);if(xN(t)?$E.has(t):jE(t))return s;if(r||DE(e,"get",t),i)return s;if(CD(s)){const e=o&&AN(t)?s:s.value;return r&&kN(e)?fD(e):e}return kN(s)?r?fD(s):pD(s):s}}class KE extends UE{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t];const o=vN(e)&&AN(t);if(!this._isShallow){const r=yD(i);if(wD(n)||yD(n)||(i=xD(i),n=xD(n)),!o&&CD(i)&&!CD(n))return r?("production"!==process.env.NODE_ENV&&eE(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(i.value=n,!0)}const s=o?Number(t)<e.length:gN(e,t),a=Reflect.set(e,t,n,CD(e)?e:r);return e===xD(r)&&(s?BN(n,i)&&IE(e,"set",t,n,i):IE(e,"add",t,n)),a}deleteProperty(e,t){const n=gN(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&IE(e,"delete",t,void 0,r),i}has(e,t){const n=Reflect.has(e,t);return xN(t)&&$E.has(t)||DE(e,"has",t),n}ownKeys(e){return DE(e,"iterate",vN(e)?"length":OE),Reflect.ownKeys(e)}}class GE extends UE{constructor(e=!1){super(!0,e)}set(e,t){return"production"!==process.env.NODE_ENV&&eE(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return"production"!==process.env.NODE_ENV&&eE(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const JE=new KE,YE=new GE,XE=new KE(!0),ZE=new GE(!0),QE=e=>e,eD=e=>Reflect.getPrototypeOf(e);function tD(e){return function(...t){if("production"!==process.env.NODE_ENV){const n=t[0]?`on key "${t[0]}" `:"";eE(`${RN(e)} operation ${n}failed: target is readonly.`,xD(this))}return"delete"!==e&&("clear"===e?void 0:this)}}function nD(e,t){const n={get(n){const r=this.__v_raw,i=xD(r),o=xD(n);e||(BN(n,o)&&DE(i,"get",n),DE(i,"get",o));const{has:s}=eD(i),a=t?QE:e?SD:kD;return s.call(i,n)?a(r.get(n)):s.call(i,o)?a(r.get(o)):void(r!==i&&r.get(n))},get size(){const t=this.__v_raw;return!e&&DE(xD(t),"iterate",OE),t.size},has(t){const n=this.__v_raw,r=xD(n),i=xD(t);return e||(BN(t,i)&&DE(r,"has",t),DE(r,"has",i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){const i=this,o=i.__v_raw,s=xD(o),a=t?QE:e?SD:kD;return!e&&DE(s,"iterate",OE),o.forEach((e,t)=>n.call(r,a(e),a(t),i))}};pN(n,e?{add:tD("add"),set:tD("set"),delete:tD("delete"),clear:tD("clear")}:{add(e){t||wD(e)||yD(e)||(e=xD(e));const n=xD(this);return eD(n).has.call(n,e)||(n.add(e),IE(n,"add",e,e)),this},set(e,n){t||wD(n)||yD(n)||(n=xD(n));const r=xD(this),{has:i,get:o}=eD(r);let s=i.call(r,e);s?"production"!==process.env.NODE_ENV&&lD(r,i,e):(e=xD(e),s=i.call(r,e));const a=o.call(r,e);return r.set(e,n),s?BN(n,a)&&IE(r,"set",e,n,a):IE(r,"add",e,n),this},delete(e){const t=xD(this),{has:n,get:r}=eD(t);let i=n.call(t,e);i?"production"!==process.env.NODE_ENV&&lD(t,n,e):(e=xD(e),i=n.call(t,e));const o=r?r.call(t,e):void 0,s=t.delete(e);return i&&IE(t,"delete",e,void 0,o),s},clear(){const e=xD(this),t=0!==e.size,n="production"!==process.env.NODE_ENV?yN(e)?new Map(e):new Set(e):void 0,r=e.clear();return t&&IE(e,"clear",void 0,void 0,n),r}});return["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=function(e,t,n){return function(...r){const i=this.__v_raw,o=xD(i),s=yN(o),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=i[e](...r),h=n?QE:t?SD:kD;return!t&&DE(o,"iterate",l?NE:OE),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}(r,e,t)}),n}function rD(e,t){const n=nD(e,t);return(t,r,i)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(gN(n,r)&&r in t?n:t,r,i)}const iD={get:rD(!1,!1)},oD={get:rD(!1,!0)},sD={get:rD(!0,!1)},aD={get:rD(!0,!0)};function lD(e,t,n){const r=xD(n);if(r!==n&&t.call(e,r)){const t=TN(e);eE(`Reactive ${t} contains both the raw and reactive versions of the same object${"Map"===t?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const cD=new WeakMap,hD=new WeakMap,uD=new WeakMap,dD=new WeakMap;function pD(e){return yD(e)?e:gD(e,!1,JE,iD,cD)}function fD(e){return gD(e,!0,YE,sD,uD)}function mD(e){return gD(e,!0,ZE,aD,dD)}function gD(e,t,n,r,i){if(!kN(e))return"production"!==process.env.NODE_ENV&&eE(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=(s=e).__v_skip||!Object.isExtensible(s)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(TN(s));var s;if(0===o)return e;const a=i.get(e);if(a)return a;const l=new Proxy(e,2===o?r:n);return i.set(e,l),l}function vD(e){return yD(e)?vD(e.__v_raw):!(!e||!e.__v_isReactive)}function yD(e){return!(!e||!e.__v_isReadonly)}function wD(e){return!(!e||!e.__v_isShallow)}function bD(e){return!!e&&!!e.__v_raw}function xD(e){const t=e&&e.__v_raw;return t?xD(t):e}const kD=e=>kN(e)?pD(e):e,SD=e=>kN(e)?fD(e):e;function CD(e){return!!e&&!0===e.__v_isRef}function MD(e){return AD(e,!1)}function TD(e){return AD(e,!0)}function AD(e,t){return CD(e)?e:new OD(e,t)}class OD{constructor(e,t){this.dep=new ME,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:xD(e),this._value=t?e:kD(e),this.__v_isShallow=t}get value(){return"production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||wD(e)||yD(e);e=n?e:xD(e),BN(e,t)&&(this._rawValue=e,this._value=n?e:kD(e),"production"!==process.env.NODE_ENV?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}const ND={get:(e,t,n)=>{return"__v_raw"===t?e:CD(r=Reflect.get(e,t,n))?r.value:r;var r},set:(e,t,n,r)=>{const i=e[t];return CD(i)&&!CD(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function ED(e){return vD(e)?e:new Proxy(e,ND)}class DD{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ME(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=SE-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||nE===this))return cE(this,!0),!0;process.env.NODE_ENV}get value(){const e="production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return mE(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):"production"!==process.env.NODE_ENV&&eE("Write operation failed: computed value is readonly")}}const ID={},_D=new WeakMap;let PD;function RD(e,t,n=aN){const{immediate:r,deep:i,once:o,scheduler:s,augmentJob:a,call:l}=n,c=e=>{(n.onWarn||eE)("Invalid watch source: ",e,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},h=e=>i?e:wD(e)||!1===i||0===i?LD(e,1):LD(e);let u,d,p,f,m=!1,g=!1;if(CD(e)?(d=()=>e.value,m=wD(e)):vD(e)?(d=()=>h(e),m=!0):vN(e)?(g=!0,m=e.some(e=>vD(e)||wD(e)),d=()=>e.map(e=>CD(e)?e.value:vD(e)?h(e):wN(e)?l?l(e,2):e():void("production"!==process.env.NODE_ENV&&c(e)))):wN(e)?d=t?l?()=>l(e,2):e:()=>{if(p){bE();try{p()}finally{xE()}}const t=PD;PD=u;try{return l?l(e,3,[f]):e(f)}finally{PD=t}}:(d=cN,"production"!==process.env.NODE_ENV&&c(e)),t&&i){const e=d,t=!0===i?1/0:i;d=()=>LD(e(),t)}const v=tE,y=()=>{u.stop(),v&&v.active&&fN(v.effects,u)};if(o&&t){const e=t;t=(...t)=>{e(...t),y()}}let w=g?new Array(e.length).fill(ID):ID;const b=e=>{if(1&u.flags&&(u.dirty||e))if(t){const e=u.run();if(i||m||(g?e.some((e,t)=>BN(e,w[t])):BN(e,w))){p&&p();const n=PD;PD=u;try{const n=[e,w===ID?void 0:g&&w[0]===ID?[]:w,f];w=e,l?l(t,3,n):t(...n)}finally{PD=n}}}else u.run()};return a&&a(b),u=new oE(d),u.scheduler=s?()=>s(b,!1):b,f=e=>function(e,t=!1,n=PD){if(n){let t=_D.get(n);t||_D.set(n,t=[]),t.push(e)}else"production"===process.env.NODE_ENV||t||eE("onWatcherCleanup() was called when there was no active watcher to associate with.")}(e,!1,u),p=u.onStop=()=>{const e=_D.get(u);if(e){if(l)l(e,4);else for(const t of e)t();_D.delete(u)}},"production"!==process.env.NODE_ENV&&(u.onTrack=n.onTrack,u.onTrigger=n.onTrigger),t?r?b(!0):w=u.run():s?s(b.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function LD(e,t=1/0,n){if(t<=0||!kN(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,CD(e))LD(e.value,t,n);else if(vN(e))for(let r=0;r<e.length;r++)LD(e[r],t,n);else if("[object Set]"===MN(e)||yN(e))e.forEach(e=>{LD(e,t,n)});else if((e=>"[object Object]"===MN(e))(e)){for(const r in e)LD(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&LD(e[r],t,n)}return e}
13
+ /**
14
+ * @vue/runtime-core v3.5.25
15
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
+ * @license MIT
17
+ **/const BD=[];function zD(e){BD.push(e)}function VD(){BD.pop()}let FD=!1;function HD(e,...t){if(FD)return;FD=!0,bE();const n=BD.length?BD[BD.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=function(){let e=BD[BD.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const r=e.component&&e.component.parent;e=r&&r.vnode}return t}();if(r)WD(r,n,11,[e+t.map(e=>{var t,n;return null!=(n=null==(t=e.toString)?void 0:t.call(e))?n:JSON.stringify(e)}).join(""),n&&n.proxy,i.map(({vnode:e})=>`at <${fR(n,e.type)}>`).join("\n"),i]);else{const n=[`[Vue warn]: ${e}`,...t];i.length&&n.push("\n",...function(e){const t=[];return e.forEach((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",r=!!e.component&&null==e.component.parent,i=` at <${fR(e.component,e.type,r)}`,o=">"+n;return e.props?[i,...qD(e.props),o]:[i+o]}(e))}),t}(i)),console.warn(...n)}xE(),FD=!1}function qD(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(n=>{t.push(...jD(n,e[n]))}),n.length>3&&t.push(" ..."),t}function jD(e,t,n){return bN(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:CD(t)?(t=jD(e,xD(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):wN(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=xD(t),n?t:[`${e}=`,t])}const $D={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function WD(e,t,n,r){try{return r?e(...r):e()}catch(e){KD(e,t,n)}}function UD(e,t,n,r){if(wN(e)){const i=WD(e,t,n,r);return i&&SN(i)&&i.catch(e=>{KD(e,t,n)}),i}if(vN(e)){const i=[];for(let o=0;o<e.length;o++)i.push(UD(e[o],t,n,r));return i}"production"!==process.env.NODE_ENV&&HD("Invalid value type passed to callWithAsyncErrorHandling(): "+typeof e)}function KD(e,t,n,r=!0){const i=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||aN;if(t){let r=t.parent;const i=t.proxy,s="production"!==process.env.NODE_ENV?$D[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const t=r.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,i,s))return;r=r.parent}if(o)return bE(),WD(o,null,10,[e,i,s]),void xE()}!function(e,t,n,r=!0,i=!1){if("production"!==process.env.NODE_ENV){const i=$D[t];if(n&&zD(n),HD("Unhandled error"+(i?` during execution of ${i}`:"")),n&&VD(),r)throw e;console.error(e)}else{if(i)throw e;console.error(e)}}(e,n,i,r,s)}const GD=[];let JD=-1;const YD=[];let XD=null,ZD=0;const QD=Promise.resolve();let eI=null;function tI(e){const t=eI||QD;return e?t.then(this?e.bind(this):e):t}function nI(e){if(!(1&e.flags)){const t=aI(e),n=GD[GD.length-1];!n||!(2&e.flags)&&t>=aI(n)?GD.push(e):GD.splice(function(e){let t=JD+1,n=GD.length;for(;t<n;){const r=t+n>>>1,i=GD[r],o=aI(i);o<e||o===e&&2&i.flags?t=r+1:n=r}return t}(t),0,e),e.flags|=1,rI()}}function rI(){eI||(eI=QD.then(lI))}function iI(e){vN(e)?YD.push(...e):XD&&-1===e.id?XD.splice(ZD+1,0,e):1&e.flags||(YD.push(e),e.flags|=1),rI()}function oI(e,t,n=JD+1){for("production"!==process.env.NODE_ENV&&(t=t||new Map);n<GD.length;n++){const r=GD[n];if(r&&2&r.flags){if(e&&r.id!==e.uid)continue;if("production"!==process.env.NODE_ENV&&cI(t,r))continue;GD.splice(n,1),n--,4&r.flags&&(r.flags&=-2),r(),4&r.flags||(r.flags&=-2)}}}function sI(e){if(YD.length){const t=[...new Set(YD)].sort((e,t)=>aI(e)-aI(t));if(YD.length=0,XD)return void XD.push(...t);for(XD=t,"production"!==process.env.NODE_ENV&&(e=e||new Map),ZD=0;ZD<XD.length;ZD++){const t=XD[ZD];"production"!==process.env.NODE_ENV&&cI(e,t)||(4&t.flags&&(t.flags&=-2),8&t.flags||t(),t.flags&=-2)}XD=null,ZD=0}}const aI=e=>null==e.id?2&e.flags?-1:1/0:e.id;function lI(e){"production"!==process.env.NODE_ENV&&(e=e||new Map);const t="production"!==process.env.NODE_ENV?t=>cI(e,t):cN;try{for(JD=0;JD<GD.length;JD++){const e=GD[JD];if(e&&!(8&e.flags)){if("production"!==process.env.NODE_ENV&&t(e))continue;4&e.flags&&(e.flags&=-2),WD(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2)}}}finally{for(;JD<GD.length;JD++){const e=GD[JD];e&&(e.flags&=-2)}JD=-1,GD.length=0,sI(e),eI=null,(GD.length||YD.length)&&lI(e)}}function cI(e,t){const n=e.get(t)||0;if(n>100){const e=t.i,n=e&&pR(e.type);return KD(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}let hI=!1;const uI=new Map;"production"!==process.env.NODE_ENV&&(qN().__VUE_HMR_RUNTIME__={createRecord:gI(pI),rerender:gI(function(e,t){const n=dI.get(e);if(!n)return;n.initialDef.render=t,[...n.instances].forEach(e=>{t&&(e.render=t,fI(e.type).render=t),e.renderCache=[],hI=!0,8&e.job.flags||e.update(),hI=!1})}),reload:gI(function(e,t){const n=dI.get(e);if(!n)return;t=fI(t),mI(n.initialDef,t);const r=[...n.instances];for(let e=0;e<r.length;e++){const i=r[e],o=fI(i.type);let s=uI.get(o);s||(o!==n.initialDef&&mI(o,t),uI.set(o,s=new Set)),s.add(i),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(s.add(i),i.ceReload(t.styles),s.delete(i)):i.parent?nI(()=>{8&i.job.flags||(hI=!0,i.parent.update(),hI=!1,s.delete(i))}):i.appContext.reload?i.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),i.root.ce&&i!==i.root&&i.root.ce._removeChildStyle(o)}iI(()=>{uI.clear()})})});const dI=new Map;function pI(e,t){return!dI.has(e)&&(dI.set(e,{initialDef:fI(t),instances:new Set}),!0)}function fI(e){return mR(e)?e.__vccOpts:e}function mI(e,t){pN(e,t);for(const n in e)"__file"===n||n in t||delete e[n]}function gI(e){return(t,n)=>{try{return e(t,n)}catch(e){console.error(e),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let vI,yI=[],wI=!1;function bI(e,...t){vI?vI.emit(e,...t):wI||yI.push({event:e,args:t})}function xI(e,t){var n,r;if(vI=e,vI)vI.enabled=!0,yI.forEach(({event:e,args:t})=>vI.emit(e,...t)),yI=[];else if("undefined"!=typeof window&&window.HTMLElement&&!(null==(r=null==(n=window.navigator)?void 0:n.userAgent)?void 0:r.includes("jsdom"))){(t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{xI(e,t)}),setTimeout(()=>{vI||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,wI=!0,yI=[])},3e3)}else wI=!0,yI=[]}const kI=MI("component:added"),SI=MI("component:updated"),CI=MI("component:removed");function MI(e){return t=>{bI(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const TI=OI("perf:start"),AI=OI("perf:end");function OI(e){return(t,n,r)=>{bI(e,t.appContext.app,t.uid,t,n,r)}}let NI=null,EI=null;function DI(e){const t=NI;return NI=e,EI=e&&e.type.__scopeId||null,t}function II(e){NN(e)&&HD("Do not use built-in directive ids as custom directive id: "+e)}function _I(e,t,n,r){const i=e.dirs,o=t&&t.dirs;for(let s=0;s<i.length;s++){const a=i[s];o&&(a.oldValue=o[s].value);let l=a.dir[r];l&&(bE(),UD(l,n,8,[e.el,a,e,t]),xE())}}const PI=Symbol("_vte"),RI=Symbol("_leaveCb");function LI(e,t){6&e.shapeFlag&&e.component?(e.transition=t,LI(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function BI(e,t){return wN(e)?(()=>pN({name:e.name},t,{setup:e}))():e}function zI(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const VI=new WeakSet,FI=new WeakMap;function HI(e,t,n,r,i=!1){if(vN(e))return void e.forEach((e,o)=>HI(e,t&&(vN(t)?t[o]:t),n,r,i));if(jI(r)&&!i)return void(512&r.shapeFlag&&r.type.__asyncResolved&&r.component.subTree.component&&HI(e,t,n,r.component.subTree));const o=4&r.shapeFlag?hR(r.component):r.el,s=i?null:o,{i:a,r:l}=e;if("production"!==process.env.NODE_ENV&&!a)return void HD("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");const c=t&&t.r,h=a.refs===aN?a.refs={}:a.refs,u=a.setupState,d=xD(u),p=u===aN?hN:e=>("production"===process.env.NODE_ENV||(gN(d,e)&&!CD(d[e])&&HD(`Template ref "${e}" used on a non-ref value. It will not work in the production build.`),!VI.has(d[e])))&&gN(d,e),f=e=>!("production"!==process.env.NODE_ENV&&VI.has(e));if(null!=c&&c!==l)if(qI(t),bN(c))h[c]=null,p(c)&&(u[c]=null);else if(CD(c)){f(c)&&(c.value=null);const e=t;e.k&&(h[e.k]=null)}if(wN(l))WD(l,a,12,[s,h]);else{const t=bN(l),r=CD(l);if(t||r){const a=()=>{if(e.f){const n=t?p(l)?u[l]:h[l]:f(l)||!e.k?l.value:h[e.k];if(i)vN(n)&&fN(n,o);else if(vN(n))n.includes(o)||n.push(o);else if(t)h[l]=[o],p(l)&&(u[l]=h[l]);else{const t=[o];f(l)&&(l.value=t),e.k&&(h[e.k]=t)}}else t?(h[l]=s,p(l)&&(u[l]=s)):r?(f(l)&&(l.value=s),e.k&&(h[e.k]=s)):"production"!==process.env.NODE_ENV&&HD("Invalid template ref type:",l,`(${typeof l})`)};if(s){const t=()=>{a(),FI.delete(e)};t.id=-1,FI.set(e,t),SP(t,n)}else qI(e),a()}else"production"!==process.env.NODE_ENV&&HD("Invalid template ref type:",l,`(${typeof l})`)}}function qI(e){const t=FI.get(e);t&&(t.flags|=8,FI.delete(e))}qN().requestIdleCallback,qN().cancelIdleCallback;const jI=e=>!!e.type.__asyncLoader,$I=e=>e.type.__isKeepAlive;function WI(e,t){KI(e,"a",t)}function UI(e,t){KI(e,"da",t)}function KI(e,t,n=YP){const r=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(JI(t,r,n),n){let e=n.parent;for(;e&&e.parent;)$I(e.parent.vnode)&&GI(r,t,n,e),e=e.parent}}function GI(e,t,n,r){const i=JI(t,e,r,!0);n_(()=>{fN(r[t],i)},n)}function JI(e,t,n=YP,r=!1){if(n){const i=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...r)=>{bE();const i=eR(n),o=UD(t,n,e,r);return i(),xE(),o});return r?i.unshift(o):i.push(o),o}if("production"!==process.env.NODE_ENV){HD(`${LN($D[e].replace(/ hook$/,""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const YI=e=>(t,n=YP)=>{oR&&"sp"!==e||JI(e,(...e)=>t(...e),n)},XI=YI("bm"),ZI=YI("m"),QI=YI("bu"),e_=YI("u"),t_=YI("bum"),n_=YI("um"),r_=YI("sp"),i_=YI("rtg"),o_=YI("rtc");function s_(e,t=YP){JI("ec",e,t)}const a_=Symbol.for("v-ndc"),l_=e=>e?iR(e)?hR(e):l_(e.parent):null,c_=pN(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>"production"!==process.env.NODE_ENV?mD(e.props):e.props,$attrs:e=>"production"!==process.env.NODE_ENV?mD(e.attrs):e.attrs,$slots:e=>"production"!==process.env.NODE_ENV?mD(e.slots):e.slots,$refs:e=>"production"!==process.env.NODE_ENV?mD(e.refs):e.refs,$parent:e=>l_(e.parent),$root:e=>l_(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?y_(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{nI(e.update)}),$nextTick:e=>e.n||(e.n=tI.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?L_.bind(e):cN}),h_=e=>"_"===e||"$"===e,u_=(e,t)=>e!==aN&&!e.__isScriptSetup&&gN(e,t),d_={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:r,data:i,props:o,accessCache:s,type:a,appContext:l}=e;if("production"!==process.env.NODE_ENV&&"__isVue"===t)return!0;if("$"!==t[0]){const e=s[t];if(void 0!==e)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return o[t]}else{if(u_(r,t))return s[t]=1,r[t];if(__VUE_OPTIONS_API__&&i!==aN&&gN(i,t))return s[t]=2,i[t];if(gN(o,t))return s[t]=3,o[t];if(n!==aN&&gN(n,t))return s[t]=4,n[t];__VUE_OPTIONS_API__&&!f_||(s[t]=0)}}const c=c_[t];let h,u;return c?("$attrs"===t?(DE(e.attrs,"get",""),"production"!==process.env.NODE_ENV&&j_()):"production"!==process.env.NODE_ENV&&"$slots"===t&&DE(e,"get",t),c(e)):(h=a.__cssModules)&&(h=h[t])?h:n!==aN&&gN(n,t)?(s[t]=4,n[t]):(u=l.config.globalProperties,gN(u,t)?u[t]:void("production"===process.env.NODE_ENV||!NI||bN(t)&&0===t.indexOf("__v")||(i!==aN&&h_(t[0])&&gN(i,t)?HD(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===NI&&HD(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))))},set({_:e},t,n){const{data:r,setupState:i,ctx:o}=e;return u_(i,t)?(i[t]=n,!0):"production"!==process.env.NODE_ENV&&i.__isScriptSetup&&gN(i,t)?(HD(`Cannot mutate <script setup> binding "${t}" from Options API.`),!1):__VUE_OPTIONS_API__&&r!==aN&&gN(r,t)?(r[t]=n,!0):gN(e.props,t)?("production"!==process.env.NODE_ENV&&HD(`Attempting to mutate prop "${t}". Props are readonly.`),!1):"$"===t[0]&&t.slice(1)in e?("production"!==process.env.NODE_ENV&&HD(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&t in e.appContext.config.globalProperties?Object.defineProperty(o,t,{enumerable:!0,configurable:!0,value:n}):o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:o,type:s}},a){let l;return!!(n[a]||__VUE_OPTIONS_API__&&e!==aN&&"$"!==a[0]&&gN(e,a)||u_(t,a)||gN(o,a)||gN(r,a)||gN(c_,a)||gN(i.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:gN(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function p_(e){return vN(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}"production"!==process.env.NODE_ENV&&(d_.ownKeys=e=>(HD("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));let f_=!0;function m_(e){const t=y_(e),n=e.proxy,r=e.ctx;f_=!1,t.beforeCreate&&g_(t.beforeCreate,e,"bc");const{data:i,computed:o,methods:s,watch:a,provide:l,inject:c,created:h,beforeMount:u,mounted:d,beforeUpdate:p,updated:f,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:y,destroyed:w,unmounted:b,render:x,renderTracked:k,renderTriggered:S,errorCaptured:C,serverPrefetch:M,expose:T,inheritAttrs:A,components:O,directives:N,filters:E}=t,D="production"!==process.env.NODE_ENV?function(){const e=Object.create(null);return(t,n)=>{e[n]?HD(`${t} property "${n}" is already defined in ${e[n]}.`):e[n]=t}}():null;if("production"!==process.env.NODE_ENV){const[t]=e.propsOptions;if(t)for(const e in t)D("Props",e)}if(c&&function(e,t,n=cN){vN(e)&&(e=k_(e));for(const r in e){const i=e[r];let o;o=kN(i)?"default"in i?E_(i.from||r,i.default,!0):E_(i.from||r):E_(i),CD(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[r]=o,"production"!==process.env.NODE_ENV&&n("Inject",r)}}(c,r,D),s)for(const e in s){const t=s[e];wN(t)?("production"!==process.env.NODE_ENV?Object.defineProperty(r,e,{value:t.bind(n),configurable:!0,enumerable:!0,writable:!0}):r[e]=t.bind(n),"production"!==process.env.NODE_ENV&&D("Methods",e)):"production"!==process.env.NODE_ENV&&HD(`Method "${e}" has type "${typeof t}" in the component definition. Did you reference the function correctly?`)}if(i){"production"===process.env.NODE_ENV||wN(i)||HD("The data option must be a function. Plain object usage is no longer supported.");const t=i.call(n,n);if("production"!==process.env.NODE_ENV&&SN(t)&&HD("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),kN(t)){if(e.data=pD(t),"production"!==process.env.NODE_ENV)for(const e in t)D("Data",e),h_(e[0])||Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:()=>t[e],set:cN})}else"production"!==process.env.NODE_ENV&&HD("data() should return an object.")}if(f_=!0,o)for(const e in o){const t=o[e],i=wN(t)?t.bind(n,n):wN(t.get)?t.get.bind(n,n):cN;"production"!==process.env.NODE_ENV&&i===cN&&HD(`Computed property "${e}" has no getter.`);const s=!wN(t)&&wN(t.set)?t.set.bind(n):"production"!==process.env.NODE_ENV?()=>{HD(`Write operation failed: computed property "${e}" is readonly.`)}:cN,a=gR({get:i,set:s});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}),"production"!==process.env.NODE_ENV&&D("Computed",e)}if(a)for(const e in a)v_(a[e],r,n,e);if(l){const e=wN(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){"production"!==process.env.NODE_ENV&&(YP&&!YP.isMounted||HD("provide() can only be used inside setup()."));if(YP){let n=YP.provides;const r=YP.parent&&YP.parent.provides;r===n&&(n=YP.provides=Object.create(r)),n[e]=t}}(t,e[t])})}function I(e,t){vN(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(h&&g_(h,e,"c"),I(XI,u),I(ZI,d),I(QI,p),I(e_,f),I(WI,m),I(UI,g),I(s_,C),I(o_,k),I(i_,S),I(t_,y),I(n_,b),I(r_,M),vN(T))if(T.length){const t=e.exposed||(e.exposed={});T.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===cN&&(e.render=x),null!=A&&(e.inheritAttrs=A),O&&(e.components=O),N&&(e.directives=N),M&&zI(e)}function g_(e,t,n){UD(vN(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function v_(e,t,n,r){let i=r.includes(".")?B_(n,r):()=>n[r];if(bN(e)){const n=t[e];wN(n)?P_(i,n):"production"!==process.env.NODE_ENV&&HD(`Invalid watch handler specified by key "${e}"`,n)}else if(wN(e))P_(i,e.bind(n));else if(kN(e))if(vN(e))e.forEach(e=>v_(e,t,n,r));else{const r=wN(e.handler)?e.handler.bind(n):t[e.handler];wN(r)?P_(i,r,e):"production"!==process.env.NODE_ENV&&HD(`Invalid watch handler specified by key "${e.handler}"`,r)}else"production"!==process.env.NODE_ENV&&HD(`Invalid watch option: "${r}"`,e)}function y_(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,a=o.get(t);let l;return a?l=a:i.length||n||r?(l={},i.length&&i.forEach(e=>w_(l,e,s,!0)),w_(l,t,s)):l=t,kN(t)&&o.set(t,l),l}function w_(e,t,n,r=!1){const{mixins:i,extends:o}=t;o&&w_(e,o,n,!0),i&&i.forEach(t=>w_(e,t,n,!0));for(const i in t)if(r&&"expose"===i)"production"!==process.env.NODE_ENV&&HD('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const r=b_[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}const b_={data:x_,props:M_,emits:M_,methods:C_,computed:C_,beforeCreate:S_,created:S_,beforeMount:S_,mounted:S_,beforeUpdate:S_,updated:S_,beforeDestroy:S_,beforeUnmount:S_,destroyed:S_,unmounted:S_,activated:S_,deactivated:S_,errorCaptured:S_,serverPrefetch:S_,components:C_,directives:C_,watch:function(e,t){if(!e)return t;if(!t)return e;const n=pN(Object.create(null),e);for(const r in t)n[r]=S_(e[r],t[r]);return n},provide:x_,inject:function(e,t){return C_(k_(e),k_(t))}};function x_(e,t){return t?e?function(){return pN(wN(e)?e.call(this,this):e,wN(t)?t.call(this,this):t)}:t:e}function k_(e){if(vN(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function S_(e,t){return e?[...new Set([].concat(e,t))]:t}function C_(e,t){return e?pN(Object.create(null),e,t):t}function M_(e,t){return e?vN(e)&&vN(t)?[...new Set([...e,...t])]:pN(Object.create(null),p_(e),p_(null!=t?t:{})):t}function T_(){return{app:null,config:{isNativeTag:hN,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let A_=0;function O_(e,t){return function(t,n=null){wN(t)||(t=pN({},t)),null==n||kN(n)||("production"!==process.env.NODE_ENV&&HD("root props passed to app.mount() must be an object."),n=null);const r=T_(),i=new WeakSet,o=[];let s=!1;const a=r.app={_uid:A_++,_component:t,_props:n,_container:null,_context:r,_instance:null,version:yR,get config(){return r.config},set config(e){"production"!==process.env.NODE_ENV&&HD("app.config cannot be replaced. Modify individual options instead.")},use:(e,...t)=>(i.has(e)?"production"!==process.env.NODE_ENV&&HD("Plugin has already been applied to target app."):e&&wN(e.install)?(i.add(e),e.install(a,...t)):wN(e)?(i.add(e),e(a,...t)):"production"!==process.env.NODE_ENV&&HD('A plugin must either be a function or an object with an "install" function.'),a),mixin:e=>(__VUE_OPTIONS_API__?r.mixins.includes(e)?"production"!==process.env.NODE_ENV&&HD("Mixin has already been applied to target app"+(e.name?`: ${e.name}`:"")):r.mixins.push(e):"production"!==process.env.NODE_ENV&&HD("Mixins are only available in builds supporting Options API"),a),component:(e,t)=>("production"!==process.env.NODE_ENV&&rR(e,r.config),t?("production"!==process.env.NODE_ENV&&r.components[e]&&HD(`Component "${e}" has already been registered in target app.`),r.components[e]=t,a):r.components[e]),directive:(e,t)=>("production"!==process.env.NODE_ENV&&II(e),t?("production"!==process.env.NODE_ENV&&r.directives[e]&&HD(`Directive "${e}" has already been registered in target app.`),r.directives[e]=t,a):r.directives[e]),mount(i,o,l){if(!s){"production"!==process.env.NODE_ENV&&i.__vue_app__&&HD("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const o=a._ceVNode||VP(t,n);return o.appContext=r,!0===l?l="svg":!1===l&&(l=void 0),"production"!==process.env.NODE_ENV&&(r.reload=()=>{const t=HP(o);t.el=null,e(t,i,l)}),e(o,i,l),s=!0,a._container=i,i.__vue_app__=a,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=o.component,function(e,t){bI("app:init",e,t,{Fragment:DP,Text:IP,Comment:_P,Static:PP})}(a,yR)),hR(o.component)}"production"!==process.env.NODE_ENV&&HD("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`")},onUnmount(e){"production"!==process.env.NODE_ENV&&"function"!=typeof e&&HD("Expected function as first argument to app.onUnmount(), but got "+typeof e),o.push(e)},unmount(){s?(UD(o,a._instance,16),e(null,a._container),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=null,function(e){bI("app:unmount",e)}(a)),delete a._container.__vue_app__):"production"!==process.env.NODE_ENV&&HD("Cannot unmount an app that is not mounted.")},provide:(e,t)=>("production"!==process.env.NODE_ENV&&e in r.provides&&(gN(r.provides,e)?HD(`App already provides property with key "${String(e)}". It will be overwritten with the new value.`):HD(`App already provides property with key "${String(e)}" inherited from its parent element. It will be overwritten with the new value.`)),r.provides[e]=t,a),runWithContext(e){const t=N_;N_=a;try{return e()}finally{N_=t}}};return a}}let N_=null;function E_(e,t,n=!1){const r=XP();if(r||N_){let i=N_?N_._context.provides:r?null==r.parent||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&wN(t)?t.call(r&&r.proxy):t;"production"!==process.env.NODE_ENV&&HD(`injection "${String(e)}" not found.`)}else"production"!==process.env.NODE_ENV&&HD("inject() can only be used inside setup() or functional components.")}const D_=Symbol.for("v-scx"),I_=()=>{{const e=E_(D_);return e||"production"!==process.env.NODE_ENV&&HD("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),e}};function __(e,t){return R_(e,null,t)}function P_(e,t,n){return"production"===process.env.NODE_ENV||wN(t)||HD("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),R_(e,t,n)}function R_(e,t,n=aN){const{immediate:r,deep:i,flush:o,once:s}=n;"production"===process.env.NODE_ENV||t||(void 0!==r&&HD('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==i&&HD('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==s&&HD('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const a=pN({},n);"production"!==process.env.NODE_ENV&&(a.onWarn=HD);const l=t&&r||!t&&"post"!==o;let c;if(oR)if("sync"===o){const e=I_();c=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=cN,e.resume=cN,e.pause=cN,e}const h=YP;a.call=(e,t,n)=>UD(e,h,t,n);let u=!1;"post"===o?a.scheduler=e=>{SP(e,h&&h.suspense)}:"sync"!==o&&(u=!0,a.scheduler=(e,t)=>{t?e():nI(e)}),a.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,h&&(e.id=h.uid,e.i=h))};const d=RD(e,t,a);return oR&&(c?c.push(d):l&&d()),d}function L_(e,t,n){const r=this.proxy,i=bN(e)?e.includes(".")?B_(r,e):()=>r[e]:e.bind(r,r);let o;wN(t)?o=t:(o=t.handler,n=t);const s=eR(this),a=R_(i,o.bind(r),n);return s(),a}function B_(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}function z_(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||aN;if("production"!==process.env.NODE_ENV){const{emitsOptions:r,propsOptions:[i]}=e;if(r)if(t in r){const e=r[t];if(wN(e)){e(...n)||HD(`Invalid event arguments: event validation failed for event "${t}".`)}}else i&&LN(IN(t))in i||HD(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${LN(IN(t))}" prop.`)}let i=n;const o=t.startsWith("update:"),s=o&&((e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${IN(t)}Modifiers`]||e[`${PN(t)}Modifiers`])(r,t.slice(7));if(s&&(s.trim&&(i=n.map(e=>bN(e)?e.trim():e)),s.number&&(i=n.map(FN))),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&function(e,t,n){bI("component:emit",e.appContext.app,e,t,n)}(e,t,i),"production"!==process.env.NODE_ENV){const n=t.toLowerCase();n!==t&&r[LN(n)]&&HD(`Event "${n}" is emitted in component ${fR(e,e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${PN(t)}" instead of "${t}".`)}let a,l=r[a=LN(t)]||r[a=LN(IN(t))];!l&&o&&(l=r[a=LN(PN(t))]),l&&UD(l,e,6,i);const c=r[a+"Once"];if(c){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,UD(c,e,6,i)}}const V_=new WeakMap;function F_(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?V_:t.emitsCache,i=r.get(e);if(void 0!==i)return i;const o=e.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!wN(e)){const r=e=>{const n=F_(e,t,!0);n&&(a=!0,pN(s,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return o||a?(vN(o)?o.forEach(e=>s[e]=null):pN(s,o),kN(e)&&r.set(e,s),s):(kN(e)&&r.set(e,null),null)}function H_(e,t){return!(!e||!uN(t))&&(t=t.slice(2).replace(/Once$/,""),gN(e,t[0].toLowerCase()+t.slice(1))||gN(e,PN(t))||gN(e,t))}let q_=!1;function j_(){q_=!0}function $_(e){const{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[o],slots:s,attrs:a,emit:l,render:c,renderCache:h,props:u,data:d,setupState:p,ctx:f,inheritAttrs:m}=e,g=DI(e);let v,y;"production"!==process.env.NODE_ENV&&(q_=!1);try{if(4&n.shapeFlag){const e=i||r,t="production"!==process.env.NODE_ENV&&p.__isScriptSetup?new Proxy(e,{get:(e,t,n)=>(HD(`Property '${String(t)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(e,t,n))}):e;v=$P(c.call(t,e,h,"production"!==process.env.NODE_ENV?mD(u):u,p,d,f)),y=a}else{const e=t;"production"!==process.env.NODE_ENV&&a===u&&j_(),v=$P(e.length>1?e("production"!==process.env.NODE_ENV?mD(u):u,"production"!==process.env.NODE_ENV?{get attrs(){return j_(),mD(a)},slots:s,emit:l}:{attrs:a,slots:s,emit:l}):e("production"!==process.env.NODE_ENV?mD(u):u,null)),y=t.props?a:K_(a)}}catch(t){KD(t,e,1),v=VP(_P)}let w,b=v;if("production"!==process.env.NODE_ENV&&v.patchFlag>0&&2048&v.patchFlag&&([b,w]=W_(v)),y&&!1!==m){const e=Object.keys(y),{shapeFlag:t}=b;if(e.length)if(7&t)o&&e.some(dN)&&(y=G_(y,o)),b=HP(b,y,!1,!0);else if("production"!==process.env.NODE_ENV&&!q_&&b.type!==_P){const e=Object.keys(a),t=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];uN(i)?dN(i)||t.push(i[2].toLowerCase()+i.slice(3)):n.push(i)}n.length&&HD(`Extraneous non-props attributes (${n.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),t.length&&HD(`Extraneous non-emits event listeners (${t.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}return n.dirs&&("production"===process.env.NODE_ENV||J_(b)||HD("Runtime directive used on component with non-element root node. The directives will not function as intended."),b=HP(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&("production"===process.env.NODE_ENV||J_(b)||HD("Component inside <Transition> renders non-element root node that cannot be animated."),LI(b,n.transition)),"production"!==process.env.NODE_ENV&&w?w(b):v=b,DI(g),v}const W_=e=>{const t=e.children,n=e.dynamicChildren,r=U_(t,!1);if(!r)return[e,void 0];if("production"!==process.env.NODE_ENV&&r.patchFlag>0&&2048&r.patchFlag)return W_(r);const i=t.indexOf(r),o=n?n.indexOf(r):-1;return[$P(r),r=>{t[i]=r,n&&(o>-1?n[o]=r:r.patchFlag>0&&(e.dynamicChildren=[...n,r]))}]};function U_(e,t=!0){let n;for(let r=0;r<e.length;r++){const i=e[r];if(!RP(i))return;if(i.type!==_P||"v-if"===i.children){if(n)return;if(n=i,"production"!==process.env.NODE_ENV&&t&&n.patchFlag>0&&2048&n.patchFlag)return U_(n.children)}}return n}const K_=e=>{let t;for(const n in e)("class"===n||"style"===n||uN(n))&&((t||(t={}))[n]=e[n]);return t},G_=(e,t)=>{const n={};for(const r in e)dN(r)&&r.slice(9)in t||(n[r]=e[r]);return n},J_=e=>7&e.shapeFlag||e.type===_P;function Y_(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){const o=r[i];if(t[o]!==e[o]&&!H_(n,o))return!0}return!1}const X_={},Z_=()=>Object.create(X_),Q_=e=>Object.getPrototypeOf(e)===X_;function eP(e,t,n,r=!1){const i={},o=Z_();e.propsDefaults=Object.create(null),tP(e,t,i,o);for(const t in e.propsOptions[0])t in i||(i[t]=void 0);"production"!==process.env.NODE_ENV&&sP(t||{},i,e),n?e.props=r?i:gD(i,!1,XE,oD,hD):e.type.props?e.props=i:e.props=o,e.attrs=o}function tP(e,t,n,r){const[i,o]=e.propsOptions;let s,a=!1;if(t)for(let l in t){if(ON(l))continue;const c=t[l];let h;i&&gN(i,h=IN(l))?o&&o.includes(h)?(s||(s={}))[h]=c:n[h]=c:H_(e.emitsOptions,l)||l in r&&c===r[l]||(r[l]=c,a=!0)}if(o){const t=xD(n),r=s||aN;for(let s=0;s<o.length;s++){const a=o[s];n[a]=nP(i,t,a,r[a],e,!gN(r,a))}}return a}function nP(e,t,n,r,i,o){const s=e[n];if(null!=s){const e=gN(s,"default");if(e&&void 0===r){const e=s.default;if(s.type!==Function&&!s.skipFactory&&wN(e)){const{propsDefaults:o}=i;if(n in o)r=o[n];else{const s=eR(i);r=o[n]=e.call(null,t),s()}}else r=e;i.ce&&i.ce._setProp(n,r)}s[0]&&(o&&!e?r=!1:!s[1]||""!==r&&r!==PN(n)||(r=!0))}return r}const rP=new WeakMap;function iP(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?rP:t.propsCache,i=r.get(e);if(i)return i;const o=e.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!wN(e)){const r=e=>{l=!0;const[n,r]=iP(e,t,!0);pN(s,n),r&&a.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!o&&!l)return kN(e)&&r.set(e,lN),lN;if(vN(o))for(let e=0;e<o.length;e++){"production"===process.env.NODE_ENV||bN(o[e])||HD("props must be strings when using array syntax.",o[e]);const t=IN(o[e]);oP(t)&&(s[t]=aN)}else if(o){"production"===process.env.NODE_ENV||kN(o)||HD("invalid props options",o);for(const e in o){const t=IN(e);if(oP(t)){const n=o[e],r=s[t]=vN(n)||wN(n)?{type:n}:pN({},n),i=r.type;let l=!1,c=!0;if(vN(i))for(let e=0;e<i.length;++e){const t=i[e],n=wN(t)&&t.name;if("Boolean"===n){l=!0;break}"String"===n&&(c=!1)}else l=wN(i)&&"Boolean"===i.name;r[0]=l,r[1]=c,(l||gN(r,"default"))&&a.push(t)}}}const c=[s,a];return kN(e)&&r.set(e,c),c}function oP(e){return"$"!==e[0]&&!ON(e)||("production"!==process.env.NODE_ENV&&HD(`Invalid prop name: "${e}" is a reserved property.`),!1)}function sP(e,t,n){const r=xD(t),i=n.propsOptions[0],o=Object.keys(e).map(e=>IN(e));for(const e in i){let t=i[e];null!=t&&aP(e,r[e],t,"production"!==process.env.NODE_ENV?mD(r):r,!o.includes(e))}}function aP(e,t,n,r,i){const{type:o,required:s,validator:a,skipCheck:l}=n;if(s&&i)HD('Missing required prop: "'+e+'"');else if(null!=t||s){if(null!=o&&!0!==o&&!l){let n=!1;const r=vN(o)?o:[o],i=[];for(let e=0;e<r.length&&!n;e++){const{valid:o,expectedType:s}=cP(t,r[e]);i.push(s||""),n=o}if(!n)return void HD(function(e,t,n){if(0===n.length)return`Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;let r=`Invalid prop: type check failed for prop "${e}". Expected ${n.map(RN).join(" | ")}`;const i=n[0],o=TN(t),s=hP(t,i),a=hP(t,o);1===n.length&&uP(i)&&!function(...e){return e.some(e=>"boolean"===e.toLowerCase())}(i,o)&&(r+=` with value ${s}`);r+=`, got ${o} `,uP(o)&&(r+=`with value ${a}.`);return r}(e,t,i))}a&&!a(t,r)&&HD('Invalid prop: custom validator check failed for prop "'+e+'".')}}const lP=sN("String,Number,Boolean,Function,Symbol,BigInt");function cP(e,t){let n;const r=function(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e)return e.constructor&&e.constructor.name||"";return""}(t);if("null"===r)n=null===e;else if(lP(r)){const i=typeof e;n=i===r.toLowerCase(),n||"object"!==i||(n=e instanceof t)}else n="Object"===r?kN(e):"Array"===r?vN(e):e instanceof t;return{valid:n,expectedType:r}}function hP(e,t){return"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}function uP(e){return["string","number","boolean"].some(t=>e.toLowerCase()===t)}const dP=e=>"_"===e||"_ctx"===e||"$stable"===e,pP=e=>vN(e)?e.map($P):[$P(e)],fP=(e,t,n)=>{if(t._n)return t;const r=function(e,t=NI){if(!t)return e;if(e._n)return e;const n=(...r)=>{n._d;const i=DI(t);let o;try{o=e(...r)}finally{DI(i),n._d}return("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&SI(t),o};return n._n=!0,n._c=!0,n._d=!0,n}((...r)=>("production"===process.env.NODE_ENV||!YP||null===n&&NI||n&&n.root!==YP.root||HD(`Slot "${e}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),pP(t(...r))),n);return r._c=!1,r},mP=(e,t,n)=>{const r=e._ctx;for(const n in e){if(dP(n))continue;const i=e[n];if(wN(i))t[n]=fP(n,i,r);else if(null!=i){"production"!==process.env.NODE_ENV&&HD(`Non-function value encountered for slot "${n}". Prefer function slots for better performance.`);const e=pP(i);t[n]=()=>e}}},gP=(e,t)=>{"production"===process.env.NODE_ENV||$I(e.vnode)||HD("Non-function value encountered for default slot. Prefer function slots for better performance.");const n=pP(t);e.slots.default=()=>n},vP=(e,t,n)=>{for(const r in t)!n&&dP(r)||(e[r]=t[r])};let yP,wP;function bP(e,t){e.appContext.config.performance&&kP()&&wP.mark(`vue-${t}-${e.uid}`),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&TI(e,t,kP()?wP.now():Date.now())}function xP(e,t){if(e.appContext.config.performance&&kP()){const n=`vue-${t}-${e.uid}`,r=n+":end",i=`<${fR(e,e.type)}> ${t}`;wP.mark(r),wP.measure(i,n,r),wP.clearMeasures(i),wP.clearMarks(n),wP.clearMarks(r)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&AI(e,t,kP()?wP.now():Date.now())}function kP(){return void 0!==yP||("undefined"!=typeof window&&window.performance?(yP=!0,wP=window.performance):yP=!1),yP}const SP=function(e,t){t&&t.pendingBranch?vN(e)?t.effects.push(...e):t.effects.push(e):iI(e)};function CP(e){return function(e){!function(){const e=[];if("boolean"!=typeof __VUE_OPTIONS_API__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_OPTIONS_API__"),qN().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_DEVTOOLS__"),qN().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_HYDRATION_MISMATCH_DETAILS__"),qN().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1),"production"!==process.env.NODE_ENV&&e.length){const t=e.length>1;console.warn(`Feature flag${t?"s":""} ${e.join(", ")} ${t?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.\n\nFor more details, see https://link.vuejs.org/feature-flags.`)}}();const t=qN();t.__VUE__=!0,"production"===process.env.NODE_ENV&&!__VUE_PROD_DEVTOOLS__||xI(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:n,remove:r,patchProp:i,createElement:o,createText:s,createComment:a,setText:l,setElementText:c,parentNode:h,nextSibling:u,setScopeId:d=cN,insertStaticContent:p}=e,f=(e,t,n,r=null,i=null,o=null,s=void 0,a=null,l=("production"===process.env.NODE_ENV||!hI)&&!!t.dynamicChildren)=>{if(e===t)return;e&&!LP(e,t)&&(r=j(e),z(e,i,o,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:c,ref:h,shapeFlag:u}=t;switch(c){case IP:m(e,t,n,r);break;case _P:g(e,t,n,r);break;case PP:null==e?v(t,n,r,s):"production"!==process.env.NODE_ENV&&y(e,t,n,s);break;case DP:O(e,t,n,r,i,o,s,a,l);break;default:1&u?x(e,t,n,r,i,o,s,a,l):6&u?N(e,t,n,r,i,o,s,a,l):64&u||128&u?c.process(e,t,n,r,i,o,s,a,l,U):"production"!==process.env.NODE_ENV&&HD("Invalid VNode type:",c,`(${typeof c})`)}null!=h&&i?HI(h,e&&e.ref,o,t||e,!t):null==h&&e&&null!=e.ref&&HI(e.ref,null,o,e,!0)},m=(e,t,r,i)=>{if(null==e)n(t.el=s(t.children),r,i);else{const n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},g=(e,t,r,i)=>{null==e?n(t.el=a(t.children||""),r,i):t.el=e.el},v=(e,t,n,r)=>{[e.el,e.anchor]=p(e.children,t,n,r,e.el,e.anchor)},y=(e,t,n,r)=>{if(t.children!==e.children){const i=u(e.anchor);b(e),[t.el,t.anchor]=p(t.children,n,i,r)}else t.el=e.el,t.anchor=e.anchor},w=({el:e,anchor:t},r,i)=>{let o;for(;e&&e!==t;)o=u(e),n(e,r,i),e=o;n(t,r,i)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=u(e),r(e),e=n;r(t)},x=(e,t,n,r,i,o,s,a,l)=>{if("svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e)k(t,n,r,i,o,s,a,l);else{const n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),M(e,t,i,o,s,a,l)}finally{n&&n._endPatch()}}},k=(e,t,r,s,a,l,h,u)=>{let d,p;const{props:f,shapeFlag:m,transition:g,dirs:v}=e;if(d=e.el=o(e.type,l,f&&f.is,f),8&m?c(d,e.children):16&m&&C(e.children,d,null,s,a,MP(e,l),h,u),v&&_I(e,null,s,"created"),S(d,e,e.scopeId,h,s),f){for(const e in f)"value"===e||ON(e)||i(d,e,null,f[e],l,s);"value"in f&&i(d,"value",null,f.value,l),(p=f.onVnodeBeforeMount)&&KP(p,s,e)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(VN(d,"__vnode",e,!0),VN(d,"__vueParentComponent",s,!0)),v&&_I(e,null,s,"beforeMount");const y=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(a,g);y&&g.beforeEnter(d),n(d,t,r),((p=f&&f.onVnodeMounted)||y||v)&&SP(()=>{p&&KP(p,s,e),y&&g.enter(d),v&&_I(e,null,s,"mounted")},a)},S=(e,t,n,r,i)=>{if(n&&d(e,n),r)for(let t=0;t<r.length;t++)d(e,r[t]);if(i){let n=i.subTree;if("production"!==process.env.NODE_ENV&&n.patchFlag>0&&2048&n.patchFlag&&(n=U_(n.children)||n),t===n||EP(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=i.vnode;S(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},C=(e,t,n,r,i,o,s,a,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=a?WP(e[c]):$P(e[c]);f(null,l,t,n,r,i,o,s,a)}},M=(e,t,n,r,o,s,a)=>{const l=t.el=e.el;("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(l.__vnode=t);let{patchFlag:h,dynamicChildren:u,dirs:d}=t;h|=16&e.patchFlag;const p=e.props||aN,f=t.props||aN;let m;if(n&&TP(n,!1),(m=f.onVnodeBeforeUpdate)&&KP(m,n,t,e),d&&_I(t,e,n,"beforeUpdate"),n&&TP(n,!0),"production"!==process.env.NODE_ENV&&hI&&(h=0,a=!1,u=null),(p.innerHTML&&null==f.innerHTML||p.textContent&&null==f.textContent)&&c(l,""),u?(T(e.dynamicChildren,u,l,n,r,MP(t,o),s),"production"!==process.env.NODE_ENV&&AP(e,t)):a||P(e,t,l,null,n,r,MP(t,o),s,!1),h>0){if(16&h)A(l,p,f,n,o);else if(2&h&&p.class!==f.class&&i(l,"class",null,f.class,o),4&h&&i(l,"style",p.style,f.style,o),8&h){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const r=e[t],s=p[r],a=f[r];a===s&&"value"!==r||i(l,r,s,a,o,n)}}1&h&&e.children!==t.children&&c(l,t.children)}else a||null!=u||A(l,p,f,n,o);((m=f.onVnodeUpdated)||d)&&SP(()=>{m&&KP(m,n,t,e),d&&_I(t,e,n,"updated")},r)},T=(e,t,n,r,i,o,s)=>{for(let a=0;a<t.length;a++){const l=e[a],c=t[a],u=l.el&&(l.type===DP||!LP(l,c)||198&l.shapeFlag)?h(l.el):n;f(l,c,u,null,r,i,o,s,!0)}},A=(e,t,n,r,o)=>{if(t!==n){if(t!==aN)for(const s in t)ON(s)||s in n||i(e,s,t[s],null,o,r);for(const s in n){if(ON(s))continue;const a=n[s],l=t[s];a!==l&&"value"!==s&&i(e,s,l,a,o,r)}"value"in n&&i(e,"value",t.value,n.value,o)}},O=(e,t,r,i,o,a,l,c,h)=>{const u=t.el=e?e.el:s(""),d=t.anchor=e?e.anchor:s("");let{patchFlag:p,dynamicChildren:f,slotScopeIds:m}=t;"production"!==process.env.NODE_ENV&&(hI||2048&p)&&(p=0,h=!1,f=null),m&&(c=c?c.concat(m):m),null==e?(n(u,r,i),n(d,r,i),C(t.children||[],r,d,o,a,l,c,h)):p>0&&64&p&&f&&e.dynamicChildren?(T(e.dynamicChildren,f,r,o,a,l,c),"production"!==process.env.NODE_ENV?AP(e,t):(null!=t.key||o&&t===o.subTree)&&AP(e,t,!0)):P(e,t,r,d,o,a,l,c,h)},N=(e,t,n,r,i,o,s,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?i.ctx.activate(t,n,r,s,l):E(t,n,r,i,o,s,l):D(e,t,l)},E=(e,t,n,r,i,o,s)=>{const a=e.component=function(e,t,n){const r=e.type,i=(t?t.appContext:e.appContext)||GP,o={uid:JP++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new rE(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:iP(r,i),emitsOptions:F_(r,i),emit:null,emitted:null,propsDefaults:aN,inheritAttrs:r.inheritAttrs,ctx:aN,data:aN,props:aN,attrs:aN,slots:aN,refs:aN,setupState:aN,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};"production"!==process.env.NODE_ENV?o.ctx=function(e){const t={};return Object.defineProperty(t,"_",{configurable:!0,enumerable:!1,get:()=>e}),Object.keys(c_).forEach(n=>{Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:()=>c_[n](e),set:cN})}),t}(o):o.ctx={_:o};o.root=t?t.root:o,o.emit=z_.bind(null,o),e.ce&&e.ce(o);return o}(e,r,i);if("production"!==process.env.NODE_ENV&&a.type.__hmrId&&function(e){const t=e.type.__hmrId;let n=dI.get(t);n||(pI(t,e.type),n=dI.get(t)),n.instances.add(e)}(a),"production"!==process.env.NODE_ENV&&(zD(e),bP(a,"mount")),$I(e)&&(a.ctx.renderer=U),"production"!==process.env.NODE_ENV&&bP(a,"init"),function(e,t=!1,n=!1){t&&QP(t);const{props:r,children:i}=e.vnode,o=iR(e);eP(e,r,o,t),((e,t,n)=>{const r=e.slots=Z_();if(32&e.vnode.shapeFlag){const e=t._;e?(vP(r,t,n),n&&VN(r,"_",e,!0)):mP(t,r)}else t&&gP(e,t)})(e,i,n||t);const s=o?function(e,t){const n=e.type;if("production"!==process.env.NODE_ENV){if(n.name&&rR(n.name,e.appContext.config),n.components){const t=Object.keys(n.components);for(let n=0;n<t.length;n++)rR(t[n],e.appContext.config)}if(n.directives){const e=Object.keys(n.directives);for(let t=0;t<e.length;t++)II(e[t])}n.compilerOptions&&aR()&&HD('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,d_),"production"===process.env.NODE_ENV||function(e){const{ctx:t,propsOptions:[n]}=e;n&&Object.keys(n).forEach(n=>{Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>e.props[n],set:cN})})}(e);const{setup:r}=n;if(r){bE();const i=e.setupContext=r.length>1?function(e){const t=t=>{if("production"!==process.env.NODE_ENV&&(e.exposed&&HD("expose() should be called only once per setup()."),null!=t)){let e=typeof t;"object"===e&&(vN(t)?e="array":CD(t)&&(e="ref")),"object"!==e&&HD(`expose() should be passed a plain object, received ${e}.`)}e.exposed=t||{}};if("production"!==process.env.NODE_ENV){let n,r;return Object.freeze({get attrs(){return n||(n=new Proxy(e.attrs,cR))},get slots(){return r||(r=function(e){return new Proxy(e.slots,{get:(t,n)=>(DE(e,"get","$slots"),t[n])})}(e))},get emit(){return(t,...n)=>e.emit(t,...n)},expose:t})}return{attrs:new Proxy(e.attrs,cR),slots:e.slots,emit:e.emit,expose:t}}(e):null,o=eR(e),s=WD(r,e,0,["production"!==process.env.NODE_ENV?mD(e.props):e.props,i]),a=SN(s);if(xE(),o(),!a&&!e.sp||jI(e)||zI(e),a){if(s.then(tR,tR),t)return s.then(n=>{sR(e,n,t)}).catch(t=>{KD(t,e,0)});if(e.asyncDep=s,"production"!==process.env.NODE_ENV&&!e.suspense){HD(`Component <${fR(e,n)}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else sR(e,s,t)}else lR(e,t)}(e,t):void 0;t&&QP(!1)}(a,!1,s),"production"!==process.env.NODE_ENV&&xP(a,"init"),"production"!==process.env.NODE_ENV&&hI&&(e.el=null),a.asyncDep){if(i&&i.registerDep(a,I,s),!e.el){const r=a.subTree=VP(_P);g(null,r,t,n),e.placeholder=r.el}}else I(a,e,t,n,i,o,s);"production"!==process.env.NODE_ENV&&(VD(),xP(a,"mount"))},D=(e,t,n)=>{const r=t.component=e.component;if(function(e,t,n){const{props:r,children:i,component:o}=e,{props:s,children:a,patchFlag:l}=t,c=o.emitsOptions;if("production"!==process.env.NODE_ENV&&(i||a)&&hI)return!0;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!i&&!a||a&&a.$stable)||r!==s&&(r?!s||Y_(r,s,c):!!s);if(1024&l)return!0;if(16&l)return r?Y_(r,s,c):!!s;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(s[n]!==r[n]&&!H_(c,n))return!0}}return!1}(e,t,n)){if(r.asyncDep&&!r.asyncResolved)return"production"!==process.env.NODE_ENV&&zD(t),_(r,t,n),void("production"!==process.env.NODE_ENV&&VD());r.next=t,r.update()}else t.el=e.el,r.vnode=t},I=(e,t,n,r,i,o,s)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:l,vnode:c}=e;{const n=OP(e);if(n)return t&&(t.el=c.el,_(e,t,s)),void n.asyncDep.then(()=>{e.isUnmounted||a()})}let u,d=t;"production"!==process.env.NODE_ENV&&zD(t||e.vnode),TP(e,!1),t?(t.el=c.el,_(e,t,s)):t=c,n&&zN(n),(u=t.props&&t.props.onVnodeBeforeUpdate)&&KP(u,l,t,c),TP(e,!0),"production"!==process.env.NODE_ENV&&bP(e,"render");const p=$_(e);"production"!==process.env.NODE_ENV&&xP(e,"render");const m=e.subTree;e.subTree=p,"production"!==process.env.NODE_ENV&&bP(e,"patch"),f(m,p,h(m.el),j(m),e,i,o),"production"!==process.env.NODE_ENV&&xP(e,"patch"),t.el=p.el,null===d&&function({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r!==e)break;(e=t.vnode).el=n,t=t.parent}}(e,p.el),r&&SP(r,i),(u=t.props&&t.props.onVnodeUpdated)&&SP(()=>KP(u,l,t,c),i),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&SI(e),"production"!==process.env.NODE_ENV&&VD()}else{let s;const{el:a,props:l}=t,{bm:c,m:h,parent:u,root:d,type:p}=e,m=jI(t);TP(e,!1),c&&zN(c),!m&&(s=l&&l.onVnodeBeforeMount)&&KP(s,u,t),TP(e,!0);{d.ce&&!1!==d.ce._def.shadowRoot&&d.ce._injectChildStyle(p),"production"!==process.env.NODE_ENV&&bP(e,"render");const s=e.subTree=$_(e);"production"!==process.env.NODE_ENV&&xP(e,"render"),"production"!==process.env.NODE_ENV&&bP(e,"patch"),f(null,s,n,r,e,i,o),"production"!==process.env.NODE_ENV&&xP(e,"patch"),t.el=s.el}if(h&&SP(h,i),!m&&(s=l&&l.onVnodeMounted)){const e=t;SP(()=>KP(s,u,e),i)}(256&t.shapeFlag||u&&jI(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&SP(e.a,i),e.isMounted=!0,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&kI(e),t=n=r=null}};e.scope.on();const l=e.effect=new oE(a);e.scope.off();const c=e.update=l.run.bind(l),u=e.job=l.runIfDirty.bind(l);u.i=e,u.id=e.uid,l.scheduler=()=>nI(u),TP(e,!0),"production"!==process.env.NODE_ENV&&(l.onTrack=e.rtc?t=>zN(e.rtc,t):void 0,l.onTrigger=e.rtg?t=>zN(e.rtg,t):void 0),c()},_=(e,t,n)=>{t.component=e;const r=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,r){const{props:i,attrs:o,vnode:{patchFlag:s}}=e,a=xD(i),[l]=e.propsOptions;let c=!1;if("production"!==process.env.NODE_ENV&&function(e){for(;e;){if(e.type.__hmrId)return!0;e=e.parent}}(e)||!(r||s>0)||16&s){let r;tP(e,t,i,o)&&(c=!0);for(const o in a)t&&(gN(t,o)||(r=PN(o))!==o&&gN(t,r))||(l?!n||void 0===n[o]&&void 0===n[r]||(i[o]=nP(l,a,o,void 0,e,!0)):delete i[o]);if(o!==a)for(const e in o)t&&gN(t,e)||(delete o[e],c=!0)}else if(8&s){const n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let s=n[r];if(H_(e.emitsOptions,s))continue;const h=t[s];if(l)if(gN(o,s))h!==o[s]&&(o[s]=h,c=!0);else{const t=IN(s);i[t]=nP(l,a,t,h,e,!1)}else h!==o[s]&&(o[s]=h,c=!0)}}c&&IE(e.attrs,"set",""),"production"!==process.env.NODE_ENV&&sP(t||{},i,e)}(e,t.props,r,n),((e,t,n)=>{const{vnode:r,slots:i}=e;let o=!0,s=aN;if(32&r.shapeFlag){const r=t._;r?"production"!==process.env.NODE_ENV&&hI?(vP(i,t,n),IE(e,"set","$slots")):n&&1===r?o=!1:vP(i,t,n):(o=!t.$stable,mP(t,i)),s=t}else t&&(gP(e,t),s={default:1});if(o)for(const e in i)dP(e)||null!=s[e]||delete i[e]})(e,t.children,n),bE(),oI(e),xE()},P=(e,t,n,r,i,o,s,a,l=!1)=>{const h=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:p,shapeFlag:f}=t;if(p>0){if(128&p)return void L(h,d,n,r,i,o,s,a,l);if(256&p)return void R(h,d,n,r,i,o,s,a,l)}8&f?(16&u&&q(h,i,o),d!==h&&c(n,d)):16&u?16&f?L(h,d,n,r,i,o,s,a,l):q(h,i,o,!0):(8&u&&c(n,""),16&f&&C(d,n,r,i,o,s,a,l))},R=(e,t,n,r,i,o,s,a,l)=>{t=t||lN;const c=(e=e||lN).length,h=t.length,u=Math.min(c,h);let d;for(d=0;d<u;d++){const r=t[d]=l?WP(t[d]):$P(t[d]);f(e[d],r,n,null,i,o,s,a,l)}c>h?q(e,i,o,!0,!1,u):C(t,n,r,i,o,s,a,l,u)},L=(e,t,n,r,i,o,s,a,l)=>{let c=0;const h=t.length;let u=e.length-1,d=h-1;for(;c<=u&&c<=d;){const r=e[c],h=t[c]=l?WP(t[c]):$P(t[c]);if(!LP(r,h))break;f(r,h,n,null,i,o,s,a,l),c++}for(;c<=u&&c<=d;){const r=e[u],c=t[d]=l?WP(t[d]):$P(t[d]);if(!LP(r,c))break;f(r,c,n,null,i,o,s,a,l),u--,d--}if(c>u){if(c<=d){const e=d+1,u=e<h?t[e].el:r;for(;c<=d;)f(null,t[c]=l?WP(t[c]):$P(t[c]),n,u,i,o,s,a,l),c++}}else if(c>d)for(;c<=u;)z(e[c],i,o,!0),c++;else{const p=c,m=c,g=new Map;for(c=m;c<=d;c++){const e=t[c]=l?WP(t[c]):$P(t[c]);null!=e.key&&("production"!==process.env.NODE_ENV&&g.has(e.key)&&HD("Duplicate keys found during update:",JSON.stringify(e.key),"Make sure keys are unique."),g.set(e.key,c))}let v,y=0;const w=d-m+1;let b=!1,x=0;const k=new Array(w);for(c=0;c<w;c++)k[c]=0;for(c=p;c<=u;c++){const r=e[c];if(y>=w){z(r,i,o,!0);continue}let h;if(null!=r.key)h=g.get(r.key);else for(v=m;v<=d;v++)if(0===k[v-m]&&LP(r,t[v])){h=v;break}void 0===h?z(r,i,o,!0):(k[h-m]=c+1,h>=x?x=h:b=!0,f(r,t[h],n,null,i,o,s,a,l),y++)}const S=b?function(e){const t=e.slice(),n=[0];let r,i,o,s,a;const l=e.length;for(r=0;r<l;r++){const l=e[r];if(0!==l){if(i=n[n.length-1],e[i]<l){t[r]=i,n.push(r);continue}for(o=0,s=n.length-1;o<s;)a=o+s>>1,e[n[a]]<l?o=a+1:s=a;l<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}o=n.length,s=n[o-1];for(;o-- >0;)n[o]=s,s=t[s];return n}(k):lN;for(v=S.length-1,c=w-1;c>=0;c--){const e=m+c,u=t[e],d=t[e+1],p=e+1<h?d.el||d.placeholder:r;0===k[c]?f(null,u,n,p,i,o,s,a,l):b&&(v<0||c!==S[v]?B(u,n,p,2):v--)}}},B=(e,t,i,o,s=null)=>{const{el:a,type:l,transition:c,children:h,shapeFlag:u}=e;if(6&u)return void B(e.component.subTree,t,i,o);if(128&u)return void e.suspense.move(t,i,o);if(64&u)return void l.move(e,t,i,U);if(l===DP){n(a,t,i);for(let e=0;e<h.length;e++)B(h[e],t,i,o);return void n(e.anchor,t,i)}if(l===PP)return void w(e,t,i);if(2!==o&&1&u&&c)if(0===o)c.beforeEnter(a),n(a,t,i),SP(()=>c.enter(a),s);else{const{leave:o,delayLeave:s,afterLeave:l}=c,h=()=>{e.ctx.isUnmounted?r(a):n(a,t,i)},u=()=>{a._isLeaving&&a[RI](!0),o(a,()=>{h(),l&&l()})};s?s(a,h,u):u()}else n(a,t,i)},z=(e,t,n,r=!1,i=!1)=>{const{type:o,props:s,ref:a,children:l,dynamicChildren:c,shapeFlag:h,patchFlag:u,dirs:d,cacheIndex:p}=e;if(-2===u&&(i=!1),null!=a&&(bE(),HI(a,null,n,e,!0),xE()),null!=p&&(t.renderCache[p]=void 0),256&h)return void t.ctx.deactivate(e);const f=1&h&&d,m=!jI(e);let g;if(m&&(g=s&&s.onVnodeBeforeUnmount)&&KP(g,t,e),6&h)H(e.component,n,r);else{if(128&h)return void e.suspense.unmount(n,r);f&&_I(e,null,t,"beforeUnmount"),64&h?e.type.remove(e,t,n,U,r):c&&!c.hasOnce&&(o!==DP||u>0&&64&u)?q(c,t,n,!1,!0):(o===DP&&384&u||!i&&16&h)&&q(l,t,n),r&&V(e)}(m&&(g=s&&s.onVnodeUnmounted)||f)&&SP(()=>{g&&KP(g,t,e),f&&_I(e,null,t,"unmounted")},n)},V=e=>{const{type:t,el:n,anchor:i,transition:o}=e;if(t===DP)return void("production"!==process.env.NODE_ENV&&e.patchFlag>0&&2048&e.patchFlag&&o&&!o.persisted?e.children.forEach(e=>{e.type===_P?r(e.el):V(e)}):F(n,i));if(t===PP)return void b(e);const s=()=>{r(n),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(1&e.shapeFlag&&o&&!o.persisted){const{leave:t,delayLeave:r}=o,i=()=>t(n,s);r?r(e.el,s,i):i()}else s()},F=(e,t)=>{let n;for(;e!==t;)n=u(e),r(e),e=n;r(t)},H=(e,t,n)=>{"production"!==process.env.NODE_ENV&&e.type.__hmrId&&function(e){dI.get(e.type.__hmrId).instances.delete(e)}(e);const{bum:r,scope:i,job:o,subTree:s,um:a,m:l,a:c}=e;var h;NP(l),NP(c),r&&zN(r),i.stop(),o&&(o.flags|=8,z(s,e,t,n)),a&&SP(a,t),SP(()=>{e.isUnmounted=!0},t),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(h=e,vI&&"function"==typeof vI.cleanupBuffer&&!vI.cleanupBuffer(h)&&CI(h))},q=(e,t,n,r=!1,i=!1,o=0)=>{for(let s=o;s<e.length;s++)z(e[s],t,n,r,i)},j=e=>{if(6&e.shapeFlag)return j(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=u(e.anchor||e.el),n=t&&t[PI];return n?u(n):t};let $=!1;const W=(e,t,n)=>{null==e?t._vnode&&z(t._vnode,null,null,!0):f(t._vnode||null,e,t,null,null,null,n),t._vnode=e,$||($=!0,oI(),sI(),$=!1)},U={p:f,um:z,m:B,r:V,mt:E,mc:C,pc:P,pbc:T,n:j,o:e};let K;return{render:W,hydrate:K,createApp:O_(W)}}(e)}function MP({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function TP({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function AP(e,t,n=!1){const r=e.children,i=t.children;if(vN(r)&&vN(i))for(let e=0;e<r.length;e++){const t=r[e];let o=i[e];1&o.shapeFlag&&!o.dynamicChildren&&((o.patchFlag<=0||32===o.patchFlag)&&(o=i[e]=WP(i[e]),o.el=t.el),n||-2===o.patchFlag||AP(t,o)),o.type===IP&&-1!==o.patchFlag&&(o.el=t.el),o.type!==_P||o.el||(o.el=t.el),"production"!==process.env.NODE_ENV&&o.el&&(o.el.__vnode=o)}}function OP(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:OP(t)}function NP(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}const EP=e=>e.__isSuspense;const DP=Symbol.for("v-fgt"),IP=Symbol.for("v-txt"),_P=Symbol.for("v-cmt"),PP=Symbol.for("v-stc");function RP(e){return!!e&&!0===e.__v_isVNode}function LP(e,t){if("production"!==process.env.NODE_ENV&&6&t.shapeFlag&&e.component){const n=uI.get(t.type);if(n&&n.has(e.component))return e.shapeFlag&=-257,t.shapeFlag&=-513,!1}return e.type===t.type&&e.key===t.key}const BP=({key:e})=>null!=e?e:null,zP=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?bN(e)||CD(e)||wN(e)?{i:NI,r:e,k:t,f:!!n}:e:null);const VP="production"!==process.env.NODE_ENV?(...e)=>FP(...e):FP;function FP(e,t=null,n=null,r=0,i=null,o=!1){if(e&&e!==a_||("production"===process.env.NODE_ENV||e||HD(`Invalid vnode type when creating vnode: ${e}.`),e=_P),RP(e)){const r=HP(e,t,!0);return n&&UP(r,n),r.patchFlag=-2,r}if(mR(e)&&(e=e.__vccOpts),t){t=function(e){return e?bD(e)||Q_(e)?pN({},e):e:null}(t);let{class:e,style:n}=t;e&&!bN(e)&&(t.class=GN(e)),kN(n)&&(bD(n)&&!vN(n)&&(n=pN({},n)),t.style=jN(n))}const s=bN(e)?1:EP(e)?128:(e=>e.__isTeleport)(e)?64:kN(e)?4:wN(e)?2:0;return"production"!==process.env.NODE_ENV&&4&s&&bD(e)&&HD("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",e=xD(e)),function(e,t=null,n=null,r=0,i=null,o=(e===DP?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&BP(t),ref:t&&zP(t),scopeId:EI,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:NI};return a?(UP(l,n),128&o&&e.normalize(l)):n&&(l.shapeFlag|=bN(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&HD("VNode created with invalid key (NaN). VNode type:",l.type),l}(e,t,n,r,i,s,o,!0)}function HP(e,t,n=!1,r=!1){const{props:i,ref:o,patchFlag:s,children:a,transition:l}=e,c=t?function(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)if("class"===e)t.class!==r.class&&(t.class=GN([t.class,r.class]));else if("style"===e)t.style=jN([t.style,r.style]);else if(uN(e)){const n=t[e],i=r[e];!i||n===i||vN(n)&&n.includes(i)||(t[e]=n?[].concat(n,i):i)}else""!==e&&(t[e]=r[e])}return t}(i||{},t):i,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&BP(c),ref:t&&t.ref?n&&o?vN(o)?o.concat(zP(t)):[o,zP(t)]:zP(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===s&&vN(a)?a.map(qP):a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==DP?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&HP(e.ssContent),ssFallback:e.ssFallback&&HP(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&LI(h,l.clone(h)),h}function qP(e){const t=HP(e);return vN(e.children)&&(t.children=e.children.map(qP)),t}function jP(e=" ",t=0){return VP(IP,null,e,t)}function $P(e){return null==e||"boolean"==typeof e?VP(_P):vN(e)?VP(DP,null,e.slice()):RP(e)?WP(e):VP(IP,null,String(e))}function WP(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:HP(e)}function UP(e,t){let n=0;const{shapeFlag:r}=e;if(null==t)t=null;else if(vN(t))n=16;else if("object"==typeof t){if(65&r){const n=t.default;return void(n&&(n._c&&(n._d=!1),UP(e,n()),n._c&&(n._d=!0)))}{n=32;const r=t._;r||Q_(t)?3===r&&NI&&(1===NI.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=NI}}else wN(t)?(t={default:t,_ctx:NI},n=32):(t=String(t),64&r?(n=16,t=[jP(t)]):n=8);e.children=t,e.shapeFlag|=n}function KP(e,t,n,r=null){UD(e,t,7,[n,r])}const GP=T_();let JP=0;let YP=null;const XP=()=>YP||NI;let ZP,QP;{const e=qN(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};ZP=t("__VUE_INSTANCE_SETTERS__",e=>YP=e),QP=t("__VUE_SSR_SETTERS__",e=>oR=e)}const eR=e=>{const t=YP;return ZP(e),e.scope.on(),()=>{e.scope.off(),ZP(t)}},tR=()=>{YP&&YP.scope.off(),ZP(null)},nR=sN("slot,component");function rR(e,{isNativeTag:t}){(nR(e)||t(e))&&HD("Do not use built-in or reserved HTML elements as component id: "+e)}function iR(e){return 4&e.vnode.shapeFlag}let oR=!1;function sR(e,t,n){wN(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:kN(t)?("production"!==process.env.NODE_ENV&&RP(t)&&HD("setup() should not return VNodes directly - return a render function instead."),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(e.devtoolsRawSetupState=t),e.setupState=ED(t),"production"!==process.env.NODE_ENV&&function(e){const{ctx:t,setupState:n}=e;Object.keys(xD(n)).forEach(e=>{if(!n.__isScriptSetup){if(h_(e[0]))return void HD(`setup() return property ${JSON.stringify(e)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>n[e],set:cN})}})}(e)):"production"!==process.env.NODE_ENV&&void 0!==t&&HD("setup() should return an object. Received: "+(null===t?"null":typeof t)),lR(e,n)}const aR=()=>!0;function lR(e,t,n){const r=e.type;if(e.render||(e.render=r.render||cN),__VUE_OPTIONS_API__){const t=eR(e);bE();try{m_(e)}finally{xE(),t()}}"production"===process.env.NODE_ENV||r.render||e.render!==cN||t||(r.template?HD('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):HD("Component is missing template or render function: ",r))}const cR="production"!==process.env.NODE_ENV?{get:(e,t)=>(j_(),DE(e,"get",""),e[t]),set:()=>(HD("setupContext.attrs is readonly."),!1),deleteProperty:()=>(HD("setupContext.attrs is readonly."),!1)}:{get:(e,t)=>(DE(e,"get",""),e[t])};function hR(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ED((t=e.exposed,!gN(t,"__v_skip")&&Object.isExtensible(t)&&VN(t,"__v_skip",!0),t)),{get:(t,n)=>n in t?t[n]:n in c_?c_[n](e):void 0,has:(e,t)=>t in e||t in c_})):e.proxy;var t}const uR=/(?:^|[-_])\w/g,dR=e=>e.replace(uR,e=>e.toUpperCase()).replace(/[-_]/g,"");function pR(e,t=!0){return wN(e)?e.displayName||e.name:e.name||t&&e.__name}function fR(e,t,n=!1){let r=pR(t);if(!r&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(r=e[1])}if(!r&&e){const n=e=>{for(const n in e)if(e[n]===t)return n};r=n(e.components)||e.parent&&n(e.parent.type.components)||n(e.appContext.components)}return r?dR(r):n?"App":"Anonymous"}function mR(e){return wN(e)&&"__vccOpts"in e}const gR=(e,t)=>{const n=function(e,t,n=!1){let r,i;wN(e)?r=e:(r=e.get,i=e.set);const o=new DD(r,i,n);return process.env.NODE_ENV,o}(e,0,oR);if("production"!==process.env.NODE_ENV){const e=XP();e&&e.appContext.config.warnRecursiveComputed&&(n._warnRecursive=!0)}return n};function vR(e,t,n){try{const r=arguments.length;return 2===r?kN(t)&&!vN(t)?RP(t)?VP(e,null,[t]):VP(e,t):VP(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&RP(n)&&(n=[n]),VP(e,t,n))}finally{}}const yR="3.5.25",wR="production"!==process.env.NODE_ENV?HD:cN;
18
+ /**
19
+ * @vue/runtime-dom v3.5.25
20
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
21
+ * @license MIT
22
+ **/
23
+ let bR;process.env.NODE_ENV,process.env.NODE_ENV;const xR="undefined"!=typeof window&&window.trustedTypes;if(xR)try{bR=xR.createPolicy("vue",{createHTML:e=>e})}catch(e){"production"!==process.env.NODE_ENV&&wR(`Error creating trusted types policy: ${e}`)}const kR=bR?e=>bR.createHTML(e):e=>e,SR="undefined"!=typeof document?document:null,CR=SR&&SR.createElement("template"),MR={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const i="svg"===t?SR.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?SR.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?SR.createElement(e,{is:n}):SR.createElement(e);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:e=>SR.createTextNode(e),createComment:e=>SR.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>SR.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,i,o){const s=n?n.previousSibling:t.lastChild;if(i&&(i===o||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==o&&(i=i.nextSibling););else{CR.innerHTML=kR("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const i=CR.content;if("svg"===r||"mathml"===r){const e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},TR=Symbol("_vtc");const AR=Symbol("_vod"),OR=Symbol("_vsh"),NR=Symbol("production"!==process.env.NODE_ENV?"CSS_VAR_TEXT":""),ER=/(?:^|;)\s*display\s*:/;const DR=/[^\\];\s*$/,IR=/\s*!important$/;function _R(e,t,n){if(vN(n))n.forEach(n=>_R(e,t,n));else if(null==n&&(n=""),"production"!==process.env.NODE_ENV&&DR.test(n)&&wR(`Unexpected semicolon at the end of '${t}' style value: '${n}'`),t.startsWith("--"))e.setProperty(t,n);else{const r=function(e,t){const n=RR[t];if(n)return n;let r=IN(t);if("filter"!==r&&r in e)return RR[t]=r;r=RN(r);for(let n=0;n<PR.length;n++){const i=PR[n]+r;if(i in e)return RR[t]=i}return t}(e,t);IR.test(n)?e.setProperty(PN(r),n.replace(IR,""),"important"):e[r]=n}}const PR=["Webkit","Moz","ms"],RR={};const LR="http://www.w3.org/1999/xlink";function BR(e,t,n,r,i,o=ZN(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(LR,t.slice(6,t.length)):e.setAttributeNS(LR,t,n):null==n||o&&!QN(n)?e.removeAttribute(t):e.setAttribute(t,o?"":xN(n)?String(n):n)}function zR(e,t,n,r,i){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?kR(n):n));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const r="OPTION"===o?e.getAttribute("value")||"":e.value,i=null==n?"checkbox"===e.type?"on":"":String(n);return r===i&&"_value"in e||(e.value=i),null==n&&e.removeAttribute(t),void(e._value=n)}let s=!1;if(""===n||null==n){const r=typeof e[t];"boolean"===r?n=QN(n):null==n&&"string"===r?(n="",s=!0):"number"===r&&(n=0,s=!0)}try{e[t]=n}catch(e){"production"===process.env.NODE_ENV||s||wR(`Failed setting prop "${t}" on <${o.toLowerCase()}>: value ${n} is invalid.`,e)}s&&e.removeAttribute(i||t)}const VR=Symbol("_vei");function FR(e,t,n,r,i=null){const o=e[VR]||(e[VR]={}),s=o[t];if(r&&s)s.value="production"!==process.env.NODE_ENV?WR(r,t):r;else{const[n,a]=function(e){let t;if(HR.test(e)){let n;for(t={};n=e.match(HR);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):PN(e.slice(2));return[n,t]}(t);if(r){const s=o[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();UD(function(e,t){if(vN(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=$R(),n}("production"!==process.env.NODE_ENV?WR(r,t):r,i);!function(e,t,n,r){e.addEventListener(t,n,r)}(e,n,s,a)}else s&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,n,s,a),o[t]=void 0)}}const HR=/(?:Once|Passive|Capture)$/;let qR=0;const jR=Promise.resolve(),$R=()=>qR||(jR.then(()=>qR=0),qR=Date.now());function WR(e,t){return wN(e)||vN(e)?e:(wR(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof e}.`),cN)}const UR=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const KR=pN({patchProp:(e,t,n,r,i,o)=>{const s="svg"===i;"class"===t?function(e,t,n){const r=e[TR];r&&(t=(t?[t,...r]:[...r]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,r,s):"style"===t?function(e,t,n){const r=e.style,i=bN(n);let o=!1;if(n&&!i){if(t)if(bN(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&_R(r,t,"")}else for(const e in t)null==n[e]&&_R(r,e,"");for(const e in n)"display"===e&&(o=!0),_R(r,e,n[e])}else if(i){if(t!==n){const e=r[NR];e&&(n+=";"+e),r.cssText=n,o=ER.test(n)}}else t&&e.removeAttribute("style");AR in e&&(e[AR]=o?r.display:"",e[OR]&&(r.display="none"))}(e,n,r):uN(t)?dN(t)||FR(e,t,0,r,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,r){if(r)return"innerHTML"===t||"textContent"===t||!!(t in e&&UR(t)&&wN(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(UR(t)&&bN(n))return!1;return t in e}(e,t,r,s))?(zR(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||BR(e,t,r,s,0,"value"!==t)):!e._isVueCE||!/[A-Z]/.test(t)&&bN(r)?("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),BR(e,t,r,s)):zR(e,IN(t),r,0,t)}},MR);let GR;const JR=(...e)=>{const t=(GR||(GR=CP(KR))).createApp(...e);"production"!==process.env.NODE_ENV&&(function(e){Object.defineProperty(e.config,"isNativeTag",{value:e=>JN(e)||YN(e)||XN(e),writable:!1})}(t),function(e){{const t=e.config.isCustomElement;Object.defineProperty(e.config,"isCustomElement",{get:()=>t,set(){wR("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const n=e.config.compilerOptions,r='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(e.config,"compilerOptions",{get:()=>(wR(r),n),set(){wR(r)}})}}(t));const{mount:n}=t;return t.mount=e=>{const r=function(e){if(bN(e)){const t=document.querySelector(e);return"production"===process.env.NODE_ENV||t||wR(`Failed to mount app: mount target selector "${e}" returned null.`),t}"production"!==process.env.NODE_ENV&&window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode&&wR('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');return e}
24
+ /**
25
+ * vue v3.5.25
26
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
27
+ * @license MIT
28
+ **/(e);if(!r)return;const i=t._component;wN(i)||i.render||i.template||(i.template=r.innerHTML),1===r.nodeType&&(r.textContent="");const o=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(t){if(!kN(t))return null;if(t.__isVue)return["div",e,"VueInstance"];if(CD(t)){bE();const n=t.value;return xE(),["div",{},["span",e,h(t)],"<",a(n),">"]}return vD(t)?["div",{},["span",e,wD(t)?"ShallowReactive":"Reactive"],"<",a(t),">"+(yD(t)?" (readonly)":"")]:yD(t)?["div",{},["span",e,wD(t)?"ShallowReadonly":"Readonly"],"<",a(t),">"]:null},hasBody:e=>e&&e.__isVue,body(e){if(e&&e.__isVue)return["div",{},...o(e.$)]}};function o(e){const t=[];e.type.props&&e.props&&t.push(s("props",xD(e.props))),e.setupState!==aN&&t.push(s("setup",e.setupState)),e.data!==aN&&t.push(s("data",xD(e.data)));const n=l(e,"computed");n&&t.push(s("computed",n));const i=l(e,"inject");return i&&t.push(s("injected",i)),t.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:e}]]),t}function s(e,t){return t=pN({},t),Object.keys(t).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},e],["div",{style:"padding-left:1.25em"},...Object.keys(t).map(e=>["div",{},["span",r,e+": "],a(t[e],!1)])]]:["span",{}]}function a(e,i=!0){return"number"==typeof e?["span",t,e]:"string"==typeof e?["span",n,JSON.stringify(e)]:"boolean"==typeof e?["span",r,e]:kN(e)?["object",{object:i?xD(e):e}]:["span",n,String(e)]}function l(e,t){const n=e.type;if(wN(n))return;const r={};for(const i in e.ctx)c(n,i,t)&&(r[i]=e.ctx[i]);return r}function c(e,t,n){const r=e[n];return!!(vN(r)&&r.includes(t)||kN(r)&&t in r)||!(!e.extends||!c(e.extends,t,n))||!(!e.mixins||!e.mixins.some(e=>c(e,t,n)))||void 0}function h(e){return wD(e)?"ShallowRef":e.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}();class YR{constructor(e){this.#G=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ie=(e,t)=>{const{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:s}=i,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(!this.#G){(this.#re??e.dom.parentElement??document.body).appendChild(this.element),this.#G=!0}if(r||c)return;if(!this.#oe(e,t))return void this.hide();JT({getBoundingClientRect:()=>Fm(e,a,l)},this.element,{placement:"bottom-start",middleware:[GT(),UT(this.#se),...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()},this.update=(e,t)=>{this.#ae(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{const{selection:n}=e.state,{empty:r,$from:i}=n,o=e.state.selection instanceof Df;if("undefined"==typeof document)return;const s=this.element.contains(document.activeElement),a=!e.hasFocus()&&!s,l=!e.editable,c=(h=t,e=>$m(h)(e.$from))(e.state.selection);var h;return!a&&!l&&r&&o&&c?i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,""):void 0},this.destroy=()=>{this.#ae.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#le=e.debounce??200,this.#oe=e.shouldShow??this.#ce,this.#he=e.trigger??"/",this.#se=e.offset,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.#ae=Xe(this.#ie,this.#le)}#G;#te;#ne;#re;#le;#he;#oe;#ae;#se;#ie;#ce(e){const t=this.getContent(e);if(!t)return!1;const n=t.at(-1);return!!n&&(Array.isArray(this.#he)?this.#he.includes(n):this.#he===n)}}function XR(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=XR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ZR(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=XR(e))&&(r&&(r+=" "),r+=t);return r}
29
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:QR,setPrototypeOf:eL,isFrozen:tL,getPrototypeOf:nL,getOwnPropertyDescriptor:rL}=Object;let{freeze:iL,seal:oL,create:sL}=Object,{apply:aL,construct:lL}="undefined"!=typeof Reflect&&Reflect;iL||(iL=function(e){return e}),oL||(oL=function(e){return e}),aL||(aL=function(e,t,n){return e.apply(t,n)}),lL||(lL=function(e,t){return new e(...t)});const cL=SL(Array.prototype.forEach),hL=SL(Array.prototype.lastIndexOf),uL=SL(Array.prototype.pop),dL=SL(Array.prototype.push),pL=SL(Array.prototype.splice),fL=SL(String.prototype.toLowerCase),mL=SL(String.prototype.toString),gL=SL(String.prototype.match),vL=SL(String.prototype.replace),yL=SL(String.prototype.indexOf),wL=SL(String.prototype.trim),bL=SL(Object.prototype.hasOwnProperty),xL=SL(RegExp.prototype.test),kL=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return lL(e,n)}}(TypeError);function SL(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return aL(e,t,r)}}function CL(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fL;eL&&eL(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(tL(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ML(e){for(let t=0;t<e.length;t++){bL(e,t)||(e[t]=null)}return e}function TL(e){const t=sL(null);for(const[n,r]of QR(e)){bL(e,n)&&(Array.isArray(r)?t[n]=ML(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=TL(r):t[n]=r)}return t}function AL(e,t){for(;null!==e;){const n=rL(e,t);if(n){if(n.get)return SL(n.get);if("function"==typeof n.value)return SL(n.value)}e=nL(e)}return function(){return null}}const OL=iL(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),NL=iL(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),EL=iL(["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"]),DL=iL(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),IL=iL(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_L=iL(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),PL=iL(["#text"]),RL=iL(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),LL=iL(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),BL=iL(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zL=iL(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),VL=oL(/\{\{[\w\W]*|[\w\W]*\}\}/gm),FL=oL(/<%[\w\W]*|[\w\W]*%>/gm),HL=oL(/\$\{[\w\W]*/gm),qL=oL(/^data-[\-\w.\u00B7-\uFFFF]+$/),jL=oL(/^aria-[\-\w]+$/),$L=oL(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WL=oL(/^(?:\w+script|data):/i),UL=oL(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),KL=oL(/^html$/i),GL=oL(/^[a-z][.\w]*(-[.\w]+)+$/i);var JL=Object.freeze({__proto__:null,ARIA_ATTR:jL,ATTR_WHITESPACE:UL,CUSTOM_ELEMENT:GL,DATA_ATTR:qL,DOCTYPE_NAME:KL,ERB_EXPR:FL,IS_ALLOWED_URI:$L,IS_SCRIPT_OR_DATA:WL,MUSTACHE_EXPR:VL,TMPLIT_EXPR:HL});const YL=1,XL=3,ZL=7,QL=8,eB=9,tB=function(){return"undefined"==typeof window?null:window};var nB=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tB();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==eB||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:h,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:f}=t,m=c.prototype,g=AL(m,"cloneNode"),v=AL(m,"remove"),y=AL(m,"nextSibling"),w=AL(m,"childNodes"),b=AL(m,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,k="";const{implementation:S,createNodeIterator:C,createDocumentFragment:M,getElementsByTagName:T}=r,{importNode:A}=i;let O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof QR&&"function"==typeof b&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:N,ERB_EXPR:E,TMPLIT_EXPR:D,DATA_ATTR:I,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:L}=JL;let{IS_ALLOWED_URI:B}=JL,z=null;const V=CL({},[...OL,...NL,...EL,...IL,...PL]);let F=null;const H=CL({},[...RL,...LL,...BL,...zL]);let q=Object.seal(sL(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),j=null,$=null,W=!0,U=!0,K=!1,G=!0,J=!1,Y=!0,X=!1,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!0,ie=!1,oe=!0,se=!1,ae={},le=null;const ce=CL({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let he=null;const ue=CL({},["audio","video","img","source","image","track"]);let de=null;const pe=CL({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let ve=ge,ye=!1,we=null;const be=CL({},[fe,me,ge],mL);let xe=CL({},["mi","mo","mn","ms","mtext"]),ke=CL({},["annotation-xml"]);const Se=CL({},["title","style","font","a","script"]);let Ce=null;const Me=["application/xhtml+xml","text/html"];let Te=null,Ae=null;const Oe=r.createElement("form"),Ne=function(e){return e instanceof RegExp||e instanceof Function},Ee=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ae||Ae!==e){if(e&&"object"==typeof e||(e={}),e=TL(e),Ce=-1===Me.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===Ce?mL:fL,z=bL(e,"ALLOWED_TAGS")?CL({},e.ALLOWED_TAGS,Te):V,F=bL(e,"ALLOWED_ATTR")?CL({},e.ALLOWED_ATTR,Te):H,we=bL(e,"ALLOWED_NAMESPACES")?CL({},e.ALLOWED_NAMESPACES,mL):be,de=bL(e,"ADD_URI_SAFE_ATTR")?CL(TL(pe),e.ADD_URI_SAFE_ATTR,Te):pe,he=bL(e,"ADD_DATA_URI_TAGS")?CL(TL(ue),e.ADD_DATA_URI_TAGS,Te):ue,le=bL(e,"FORBID_CONTENTS")?CL({},e.FORBID_CONTENTS,Te):ce,j=bL(e,"FORBID_TAGS")?CL({},e.FORBID_TAGS,Te):TL({}),$=bL(e,"FORBID_ATTR")?CL({},e.FORBID_ATTR,Te):TL({}),ae=!!bL(e,"USE_PROFILES")&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,U=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,J=e.SAFE_FOR_TEMPLATES||!1,Y=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,re=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,B=e.ALLOWED_URI_REGEXP||$L,ve=e.NAMESPACE||ge,xe=e.MATHML_TEXT_INTEGRATION_POINTS||xe,ke=e.HTML_INTEGRATION_POINTS||ke,q=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(q.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(U=!1),te&&(ee=!0),ae&&(z=CL({},PL),F=[],!0===ae.html&&(CL(z,OL),CL(F,RL)),!0===ae.svg&&(CL(z,NL),CL(F,LL),CL(F,zL)),!0===ae.svgFilters&&(CL(z,EL),CL(F,LL),CL(F,zL)),!0===ae.mathMl&&(CL(z,IL),CL(F,BL),CL(F,zL))),e.ADD_TAGS&&(z===V&&(z=TL(z)),CL(z,e.ADD_TAGS,Te)),e.ADD_ATTR&&(F===H&&(F=TL(F)),CL(F,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&CL(de,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(le===ce&&(le=TL(le)),CL(le,e.FORBID_CONTENTS,Te)),oe&&(z["#text"]=!0),X&&CL(z,["html","head","body"]),z.table&&(CL(z,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw kL('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw kL('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,k=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(f,o)),null!==x&&"string"==typeof k&&(k=x.createHTML(""));iL&&iL(e),Ae=e}},De=CL({},[...NL,...EL,...DL]),Ie=CL({},[...IL,..._L]),_e=function(e){dL(n.removed,{element:e});try{b(e).removeChild(e)}catch(t){v(e)}},Pe=function(e,t){try{dL(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){dL(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{_e(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=gL(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ce&&ve===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=x?x.createHTML(e):e;if(ve===ge)try{t=(new p).parseFromString(i,Ce)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ve,"template",null);try{t.documentElement.innerHTML=ye?k:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),ve===ge?T.call(t,X?"html":"body")[0]:X?t.documentElement:o},Le=function(e){return C.call(e.ownerDocument||e,e,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Be=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},ze=function(e){return"function"==typeof l&&e instanceof l};function Ve(e,t,r){cL(e,e=>{e.call(n,t,r,Ae)})}const Fe=function(e){let t=null;if(Ve(O.beforeSanitizeElements,e,null),Be(e))return _e(e),!0;const r=Te(e.nodeName);if(Ve(O.uponSanitizeElement,e,{tagName:r,allowedTags:z}),Y&&e.hasChildNodes()&&!ze(e.firstElementChild)&&xL(/<[/\w!]/g,e.innerHTML)&&xL(/<[/\w!]/g,e.textContent))return _e(e),!0;if(e.nodeType===ZL)return _e(e),!0;if(Y&&e.nodeType===QL&&xL(/<[/\w]/g,e.data))return _e(e),!0;if(!z[r]||j[r]){if(!j[r]&&qe(r)){if(q.tagNameCheck instanceof RegExp&&xL(q.tagNameCheck,r))return!1;if(q.tagNameCheck instanceof Function&&q.tagNameCheck(r))return!1}if(oe&&!le[r]){const t=b(e)||e.parentNode,n=w(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,y(e))}}}return _e(e),!0}return e instanceof c&&!function(e){let t=b(e);t&&t.tagName||(t={namespaceURI:ve,tagName:"template"});const n=fL(e.tagName),r=fL(t.tagName);return!!we[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(De[n]):e.namespaceURI===fe?t.namespaceURI===ge?"math"===n:t.namespaceURI===me?"math"===n&&ke[r]:Boolean(Ie[n]):e.namespaceURI===ge?!(t.namespaceURI===me&&!ke[r])&&!(t.namespaceURI===fe&&!xe[r])&&!Ie[n]&&(Se[n]||!De[n]):!("application/xhtml+xml"!==Ce||!we[e.namespaceURI]))}(e)?(_e(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!xL(/<\/no(script|embed|frames)/i,e.innerHTML)?(J&&e.nodeType===XL&&(t=e.textContent,cL([N,E,D],e=>{t=vL(t,e," ")}),e.textContent!==t&&(dL(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ve(O.afterSanitizeElements,e,null),!1):(_e(e),!0)},He=function(e,t,n){if(re&&("id"===t||"name"===t)&&(n in r||n in Oe))return!1;if(U&&!$[t]&&xL(I,t));else if(W&&xL(_,t));else if(!F[t]||$[t]){if(!(qe(e)&&(q.tagNameCheck instanceof RegExp&&xL(q.tagNameCheck,e)||q.tagNameCheck instanceof Function&&q.tagNameCheck(e))&&(q.attributeNameCheck instanceof RegExp&&xL(q.attributeNameCheck,t)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(t))||"is"===t&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&xL(q.tagNameCheck,n)||q.tagNameCheck instanceof Function&&q.tagNameCheck(n))))return!1}else if(de[t]);else if(xL(B,vL(n,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==yL(n,"data:")||!he[e]){if(K&&!xL(P,vL(n,R,"")));else if(n)return!1}else;return!0},qe=function(e){return"annotation-xml"!==e&&gL(e,L)},je=function(e){Ve(O.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Be(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:a,value:l}=o,c=Te(s),h=l;let u="value"===s?h:wL(h);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Ve(O.uponSanitizeAttribute,e,r),u=r.attrValue,!ie||"id"!==c&&"name"!==c||(Pe(s,e),u="user-content-"+u),Y&&xL(/((--!?|])>)|<\/(style|title)/i,u)){Pe(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Pe(s,e);continue}if(!G&&xL(/\/>/i,u)){Pe(s,e);continue}J&&cL([N,E,D],e=>{u=vL(u,e," ")});const d=Te(e.nodeName);if(He(d,c,u)){if(x&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(a);else switch(f.getAttributeType(d,c)){case"TrustedHTML":u=x.createHTML(u);break;case"TrustedScriptURL":u=x.createScriptURL(u)}if(u!==h)try{a?e.setAttributeNS(a,s,u):e.setAttribute(s,u),Be(e)?_e(e):uL(n.removed)}catch(t){Pe(s,e)}}else Pe(s,e)}Ve(O.afterSanitizeAttributes,e,null)},$e=function e(t){let n=null;const r=Le(t);for(Ve(O.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ve(O.uponSanitizeShadowNode,n,null),Fe(n),je(n),n.content instanceof s&&e(n.content);Ve(O.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ze(e)){if("function"!=typeof e.toString)throw kL("toString is not a function");if("string"!=typeof(e=e.toString()))throw kL("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Ee(t),n.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Te(e.nodeName);if(!z[t]||j[t])throw kL("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Re("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===YL&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!ee&&!J&&!X&&-1===e.indexOf("<"))return x&&ne?x.createHTML(e):e;if(r=Re(e),!r)return ee?null:ne?k:""}r&&Q&&_e(r.firstChild);const h=Le(se?e:r);for(;a=h.nextNode();)Fe(a),je(a),a.content instanceof s&&$e(a.content);if(se)return e;if(ee){if(te)for(c=M.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(F.shadowroot||F.shadowrootmode)&&(c=A.call(i,c,!0)),c}let u=X?r.outerHTML:r.innerHTML;return X&&z["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&xL(KL,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),J&&cL([N,E,D],e=>{u=vL(u,e," ")}),x&&ne?x.createHTML(u):u},n.setConfig=function(){Ee(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Ae=null,Z=!1},n.isValidAttribute=function(e,t,n){Ae||Ee({});const r=Te(e),i=Te(t);return He(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&dL(O[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=hL(O[e],t);return-1===n?void 0:pL(O[e],n,1)[0]}return uL(O[e])},n.removeHooks=function(e){O[e]=[]},n.removeAllHooks=function(){O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function rB({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}rB.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};let iB=e=>crypto.getRandomValues(new Uint8Array(e)),oB=(e,t=21)=>((e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,i=-~(1.6*r*t/e.length);return(o=t)=>{let s="";for(;;){let t=n(i),a=0|i;for(;a--;)if(s+=e[t[a]&r]||"",s.length>=o)return s}}})(e,0|t,iB);var sB=Object.defineProperty,aB=Object.getOwnPropertySymbols,lB=Object.prototype.hasOwnProperty,cB=Object.prototype.propertyIsEnumerable,hB=(e,t,n)=>t in e?sB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uB=(e,t)=>{for(var n in t||(t={}))lB.call(t,n)&&hB(e,n,t[n]);if(aB)for(var n of aB(t))cB.call(t,n)&&hB(e,n,t[n]);return e};function dB(e,t){return Object.assign(e,{meta:uB({package:"@milkdown/components"},t)}),e}const pB=CM({imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function fB(e){return Ay(e,"paragraph",(e,t,n)=>{var r,i;if(1!==(null==(r=e.children)?void 0:r.length))return;const o=null==(i=e.children)?void 0:i[0];if(!o||"image"!==o.type)return;const{url:s,alt:a,title:l}=o,c={type:"image-block",url:s,alt:a,title:l};n.children.splice(t,1,c)})}dB(pB,{displayName:"Config<image-block>",group:"ImageBlock"});const mB=EM("remark-image-block",()=>()=>fB);dB(mB.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),dB(mB.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var gB=Object.defineProperty,vB=Object.getOwnPropertySymbols,yB=Object.prototype.hasOwnProperty,wB=Object.prototype.propertyIsEnumerable,bB=(e,t,n)=>t in e?gB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xB=(e,t)=>{for(var n in t||(t={}))yB.call(t,n)&&bB(e,n,t[n]);if(vB)for(var n of vB(t))wB.call(t,n)&&bB(e,n,t[n]);return e};const kB="image-block",SB=MM("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${kB}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw sm(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",xB({"data-type":kB},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{const r=t.url,i=t.title;let o=Number(t.alt||1);(Number.isNaN(o)||0===o)&&(o=1),e.addNode(n,{src:r,caption:i,ratio:o})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));function CB({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}dB(SB.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"}),CB.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const MB=oB("abcdefg",8),TB=BI({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:s,uploadPlaceholderText:a,className:l}){var c,h;const u=MD(!1),d=MD(),p=MD(null!=(c=t.value)?c:""),f=MD(MB()),m=MD(0!==(null==(h=t.value)?void 0:h.length)),g=e=>{const t=e.target.value;m.value=0!==t.length,p.value=t},v=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=d.value)?void 0:t.value)?r:"")},y=e=>{var t;const i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),m.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>vR("div",{class:ZR("image-edit",l)},vR(CB,{icon:i,class:"image-icon"}),vR("div",{class:ZR("link-importer",u.value&&"focus")},vR("input",{ref:d,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:p.value,onInput:g,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!m.value&&vR("div",{class:"placeholder"},vR("input",{disabled:e.value,class:"hidden",id:f.value,type:"file",accept:"image/*",onChange:y}),vR("label",{class:"uploader",for:f.value},vR(CB,{icon:o})),vR("span",{class:"text",onClick:()=>{var e;return null==(e=d.value)?void 0:e.focus()}},a))),p.value&&vR("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=d.value)?void 0:e.value)?t:"")}},vR(CB,{icon:s})))}}),AB=BI({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:r,setAttr:i,config:o}){var s;const a=MD(),l=MD(),c=MD(Boolean(null==(s=t.value)?void 0:s.length)),h=MD(0),u=()=>{var e;const t=a.value;if(!t)return;const r=t.closest(".milkdown-image-block");if(!r)return;const i=r.getBoundingClientRect().width;if(!i)return;const o=t.height,s=t.width,l=s<i?o:i*(o/s),c=(l*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=l.toFixed(2),t.dataset.height=c,t.style.height=`${c}px`},d=e=>{e.preventDefault(),e.stopPropagation(),r.value||(c.value=!c.value)},p=e=>{const t=e.target.value;h.value&&window.clearTimeout(h.value),h.value=window.setTimeout(()=>{i("caption",t)},1e3)},f=e=>{const t=e.target.value;h.value&&(window.clearTimeout(h.value),h.value=0),i("caption",t)},m=e=>{e.preventDefault();const t=a.value;if(!t)return;const n=t.getBoundingClientRect().top,r=e.clientY-n,i=Number(r<100?100:r).toFixed(2);t.dataset.height=i,t.style.height=`${i}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);const e=a.value;if(!e)return;const t=Number(e.dataset.origin),n=Number(e.dataset.height),r=Number.parseFloat(Number(n/t).toFixed(2));Number.isNaN(r)||i("ratio",r)},v=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>vR(DP,null,vR("div",{class:"image-wrapper"},vR("div",{class:"operation"},vR("div",{class:"operation-item",onPointerdown:d},vR(CB,{icon:o.captionIcon}))),vR("img",{ref:a,"data-type":kB,onLoad:u,src:e.value,alt:t.value}),vR("div",{ref:l,class:"image-resize-handle",onPointerdown:v})),c.value&&vR("input",{draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==o?void 0:o.captionPlaceholderText,onInput:p,onBlur:f,value:t.value}))}});var OB=Object.defineProperty,NB=Object.getOwnPropertySymbols,EB=Object.prototype.hasOwnProperty,DB=Object.prototype.propertyIsEnumerable,IB=(e,t,n)=>t in e?OB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const _B=BI({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?vR(AB,((e,t)=>{for(var n in t||(t={}))EB.call(t,n)&&IB(e,n,t[n]);if(NB)for(var n of NB(t))DB.call(t,n)&&IB(e,n,t[n]);return e})({},e)):vR(TB,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload})}}}),PB=SM(SB.node,e=>(t,n,r)=>{const i=MD(t.attrs.src),o=MD(t.attrs.caption),s=MD(t.attrs.ratio),a=MD(!1),l=MD(!n.editable),c=e.get(pB.key),h=JR(_B,{src:i,caption:o,ratio:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?nB.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";const d=__(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;s.value=e.attrs.ratio,o.value=e.attrs.caption,l.value=!n.editable};return f(t),h.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{d(),h.unmount(),u.remove()}}});dB(PB,{displayName:"NodeView<image-block>",group:"ImageBlock"});const RB=[mB,SB,PB,pB].flat();var LB,BB;if("undefined"!=typeof WeakMap){let e=new WeakMap;LB=t=>e.get(t),BB=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;LB=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},BB=(r,i)=>(n==t&&(n=0),e[n++]=r,e[n++]=i)}var zB=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,i=t/this.width|0;let o=r+1,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){const{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return LB(e)||BB(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const i=e.child(r);let o=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){const t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[];let i=0,o=null;const s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;const h=c.child(e),{colspan:u,rowspan:d,colwidth:p}=h.attrs;for(let e=0;e<d;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:l,n:d-e});break}const c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=h.nodeSize}const h=(a+1)*t;let u=0;for(;i<h;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),l++}0!==t&&0!==n||(o||(o=[])).push({type:"zero_sized"});const a=new zB(t,n,r,o);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let i=0;i<e.map.length;i++){const o=e.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[2*((i+n)%e.width)];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=VB(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e);return a}(e))}};function VB(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function FB(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,i=Number(e.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const n in t){const r=t[n].getFromDOM,i=r&&r(e);null!=i&&(o[n]=i)}return o}function HB(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function qB(e){if(null!==e){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(const t of e)if("number"!=typeof t)throw new TypeError("colwidth must be null or an array of numbers")}}function jB(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var $B=new Jf("selectingCells");function WB(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function UB(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function KB(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=WB(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function GB(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function JB(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function YB(e,t,n){const r=e.node(-1),i=zB.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function XB(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function ZB(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var QB=class e extends Af{constructor(e,t=e){const n=e.node(-1),r=zB.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=a.map(e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=i+e+1;return new Of(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(GB(r)&&GB(i)&&JB(r,i)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Df.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=zB.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){const s=[];for(let o=n*t.width+r.left,a=r.left;a<r.right;a++,o++){const n=t.map[o];if(i[n])continue;i[n]=!0;const a=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-a.left,h=a.right-r.right;if(c>0||h>0){let e=l.attrs;if(c>0&&(e=XB(e,0,c)),h>0&&(e=XB(e,e.colspan-h,h)),a.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<r.top||a.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}o.push(e.child(n).copy(Dd.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:o;return new Bd(Dd.from(s),1,1)}replace(e,t=Bd.empty){const n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){const{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?Bd.empty:t)}const i=Af.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Bd(Dd.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=zB.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),i=zB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=zB.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,s)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),i=zB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new ez(this.$anchorCell.pos,this.$headCell.pos)}};QB.prototype.visible=!1,Af.jsonID("cell",QB);var ez=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&JB(t,n)?new QB(t,n):Af.near(n,1)}};function tz(e){if(!(e.selection instanceof QB))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push(AS.node(n,n+e.nodeSize,{class:"selectedCell"}))}),ES.create(e.doc,t)}var nz=new Jf("fix-tables");function rz(e,t,n,r){const i=e.childCount,o=t.childCount;e:for(let s=0,a=0;s<o;s++){const o=t.child(s);for(let t=a,r=Math.min(i,s+3);t<r;t++)if(e.child(t)==o){a=t+1,n+=o.nodeSize;continue e}r(o,n),a<i&&e.child(a).sameMarkup(o)?rz(e.child(a),o,n+1,r):o.nodesBetween(0,o.content.size,r,n+1),n+=o.nodeSize}}function iz(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const i=zB.get(t);if(!i.problems)return r;r||(r=e.tr);const o=[];for(let e=0;e<i.height;e++)o.push(0);for(let e=0;e<i.problems.length;e++){const s=i.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const i=e.attrs;for(let e=0;e<i.rowspan;e++)o[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,XB(i,i.colspan-s.n,s.n))}else if("missing"==s.type)o[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}else if("zero_sized"==s.type){const e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let s,a;for(let e=0;e<o.length;e++)o[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<i.height;l++){const n=t.child(l),i=c+n.nodeSize,h=o[l];if(h>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const o=[];for(let n=0;n<h;n++){const n=jB(e.schema)[t].createAndFill();n&&o.push(n)}const u=0!=l&&s!=l-1||a!=l?i-1:c+1;r.insert(r.mapping.map(u),o)}c=i}return r.setMeta(nz,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&rz(t.doc,e.doc,0,r):e.doc.descendants(r),n}function oz(e){const t=zB.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){const r=[];for(let n=0;n<i;n++){const s=o*i+n,a=t.map[s];if(o>0){const e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){const e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function sz(e,t){const n=[],r=zB.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){const i=e.child(s),a=[];for(let n=0;n<o;n++){const i=t[s][n];if(!i)continue;const o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;const c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}const l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function az(e){return function(e,t){for(let n=t.depth;n>=0;n-=1){const r=t.node(n);if(e(r)){return{node:r,pos:0===n?0:t.before(n),start:t.start(n),depth:n}}}return null}(e=>"table"===e.type.spec.tableRole,e)}function lz(e,t){const n=az(t.$from);if(!n)return;const r=zB.get(n.node);if(e<0||e>r.width-1)return;return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function cz(e,t){const n=az(t.$from);if(!n)return;const r=zB.get(n.node);if(e<0||e>r.height-1)return;return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function hz(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){const t=lz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){const t=lz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>i&&(i=t)})}const o=[];for(let t=r;t<=i;t++){const n=lz(t,e.selection);n&&n.length>0&&o.push(t)}r=o[0],i=o[o.length-1];const s=lz(r,e.selection),a=cz(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=i;t>=r;t--){const n=lz(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}if(!c)return;return{$anchor:l,$head:e.doc.resolve(c.pos),indexes:o}}function uz(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){const t=cz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){const t=cz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>i&&(i=t)})}const o=[];for(let t=r;t<=i;t++){const n=cz(t,e.selection);n&&n.length>0&&o.push(t)}r=o[0],i=o[o.length-1];const s=cz(r,e.selection),a=lz(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=i;t>=r;t--){const n=cz(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}if(!c)return;return{$anchor:l,$head:e.doc.resolve(c.pos),indexes:o}}function dz(e,t,n,r){const i=t[0]>n[0]?-1:1,o=e.splice(t[0],t.length),s=o.length%2==0?1:0;let a;return a=-1===i?n[0]:n[n.length-1]-s,e.splice(a,0,...o),e}function pz(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function fz(e){var t,n;const{tr:r,originIndex:i,targetIndex:o,select:s,pos:a}=e,l=az(r.doc.resolve(a));if(!l)return!1;const c=null==(t=hz(r,i))?void 0:t.indexes,h=null==(n=hz(r,o))?void 0:n.indexes;if(!c||!h)return!1;if(c.includes(o))return!1;const u=function(e,t,n){let r=pz(oz(e));return r=dz(r,t,n),r=pz(r),sz(e,r)}(l.node,c,h);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const d=zB.get(u),p=l.start,f=o,m=d.positionAt(d.height-1,f,u),g=r.doc.resolve(p+m),v=d.positionAt(0,f,u),y=r.doc.resolve(p+v);return r.setSelection(QB.colSelection(g,y)),!0}function mz(e){var t,n;const{tr:r,originIndex:i,targetIndex:o,select:s,pos:a}=e,l=az(r.doc.resolve(a));if(!l)return!1;const c=null==(t=uz(r,i))?void 0:t.indexes,h=null==(n=uz(r,o))?void 0:n.indexes;if(!c||!h)return!1;if(c.includes(o))return!1;const u=function(e,t,n){let r=oz(e);return r=dz(r,t,n),sz(e,r)}(l.node,c,h);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const d=zB.get(u),p=l.start,f=o,m=d.positionAt(f,d.width-1,u),g=r.doc.resolve(p+m),v=d.positionAt(f,0,u),y=r.doc.resolve(p+v);return r.setSelection(QB.rowSelection(g,y)),!0}function gz(e){const t=e.selection,n=KB(e),r=n.node(-1),i=n.start(-1),o=zB.get(r);return{...t instanceof QB?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function vz(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){const r=jB(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){const o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,ZB(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{const l=null==o?jB(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function yz(e,t){if(!UB(e))return!1;if(t){const n=gz(e);t(vz(e.tr,n,n.left))}return!0}function wz(e,t){if(!UB(e))return!1;if(t){const n=gz(e);t(vz(e.tr,n,n.right))}return!0}function bz(e,{map:t,table:n,tableStart:r},i){const o=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),h=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,XB(h,i-t.colCount(l)));else{const t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=h.rowspan}}function xz(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;const s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);const l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){const c=t.map[s];if(!l.has(c))if(l.add(c),i>0&&c==t.map[s-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[s+t.width]){const s=n.nodeAt(c),l=s.attrs,h=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),h),o+=l.colspan-1}}}function kz(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Sz(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!UB(t))return!1;if(n){const r=jB(t.schema),i=gz(t),o=t.tr,s=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0==o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0}}(e):function(t,n){if(!UB(t))return!1;if(n){const r=jB(t.schema),i=gz(t),o=t.tr,s=kz("row",i,r),a=kz("column",i,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,h="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{const t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,h,n.attrs)}),n(o)}return!0}}function Cz(e){return function(t,n){if(!UB(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(KB(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(Df.between(e,(i=e,i.node(0).resolve(i.pos+i.nodeAfter.nodeSize)))).scrollIntoView())}var i;return!0}}function Mz(e,t){const n=e.selection;if(!(n instanceof QB))return!1;if(t){const r=e.tr,i=jB(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Bd(i,0,0))}),r.docChanged&&t(r)}return!0}function Tz(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content;const o=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(o||l)&&(i=Az(jB(s).row,new Bd(i,o,l)).content),a.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;a.push(n||r?Az(jB(s).row,new Bd(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(Dd.empty),n[i]<r){const o=jB(e).cell.createAndFill(),s=[];for(let e=n[i];e<r;e++)s.push(o);t[i]=t[i].append(Dd.from(s))}return{height:t.length,width:r,rows:t}}(s,a)}function Az(e,t){const n=e.createAndFill();return new Mf(n).replace(0,n.content.size,t).doc}function Oz(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){const i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!0;const i=n.nodeAt(o),{top:h,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:s-h}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:h+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function Nz(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){const i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;const i=n.nodeAt(o),h=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,XB(i.attrs,s-h,i.attrs.colspan-(s-h))),e.insert(u+i.nodeSize,i.type.createAndFill(XB(i.attrs,0,s-h))),c+=i.attrs.rowspan-1}}return l}function Ez(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw new Error("No table found");let s=zB.get(o);const{top:a,left:l}=r,c=l+i.width,h=a+i.height,u=e.tr;let d=0;function p(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=zB.get(o),d=u.mapping.maps.length}(function(e,t,n,r,i,o,s){const a=jB(e.doc.type.schema);let l,c;if(i>t.width)for(let o=0,h=0;o<t.height;o++){const u=n.child(o);h+=u.nodeSize;const d=[];let p;p=null==u.lastChild||u.lastChild.type==a.cell?l||(l=a.cell.createAndFill()):c||(c=a.header_cell.createAndFill());for(let e=t.width;e<i;e++)d.push(p);e.insert(e.mapping.slice(s).map(h-1+r),d)}if(o>t.height){const h=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){const i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==a.header_cell;h.push(i?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Dd.from(h)),d=[];for(let e=t.height;e<o;e++)d.push(u);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),d)}return!(!l&&!c)})(u,s,o,n,c,h,d)&&p(),Oz(u,s,o,n,l,c,a,d)&&p(),Oz(u,s,o,n,l,c,h,d)&&p(),Nz(u,s,o,n,a,h,l,d)&&p(),Nz(u,s,o,n,a,h,c,d)&&p();for(let e=a;e<h;e++){const t=s.positionAt(e,l,o),r=s.positionAt(e,c,o);u.replace(u.mapping.slice(d).map(t+n),u.mapping.slice(d).map(r+n),new Bd(i.rows[e-a],0,0))}p(),u.setSelection(new QB(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(h-1,c-1,o)))),t(u)}Sz("row",{useDeprecatedLogic:!0}),Sz("column",{useDeprecatedLogic:!0}),Sz("cell",{useDeprecatedLogic:!0});var Dz=$b({ArrowLeft:_z("horiz",-1),ArrowRight:_z("horiz",1),ArrowUp:_z("vert",-1),ArrowDown:_z("vert",1),"Shift-ArrowLeft":Pz("horiz",-1),"Shift-ArrowRight":Pz("horiz",1),"Shift-ArrowUp":Pz("vert",-1),"Shift-ArrowDown":Pz("vert",1),Backspace:Mz,"Mod-Backspace":Mz,Delete:Mz,"Mod-Delete":Mz});function Iz(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function _z(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof QB)return Iz(n,r,Af.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;const s=zz(i,e,t);if(null==s)return!1;if("horiz"==e)return Iz(n,r,Af.near(n.doc.resolve(o.head+t),t));{const i=n.doc.resolve(s),o=YB(i,e,t);let a;return a=o?Af.near(o,1):t<0?Af.near(n.doc.resolve(i.before(-1)),-1):Af.near(n.doc.resolve(i.after(-1)),1),Iz(n,r,a)}}}function Pz(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof QB)s=o;else{const r=zz(i,e,t);if(null==r)return!1;s=new QB(n.doc.resolve(r))}const a=YB(s.$headCell,e,t);return!!a&&Iz(n,r,new QB(s.$anchorCell,a))}}function Rz(e,t){const n=WB(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new QB(n))),!0)}function Lz(e,t,n){if(!UB(e.state))return!1;let r=Tz(n);const i=e.state.selection;if(i instanceof QB){r||(r={width:1,height:1,rows:[Dd.from(Az(jB(e.state.schema).cell,n))]});const t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),s=zB.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){const t=[],i=[];for(let e=0;e<n.length;e++){const o=n[e],s=[];for(let n=t[e]||0,i=0;n<r;i++){let a=o.child(i%o.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(XB(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(Dd.from(s))}n=i,e=r}if(t!=i){const e=[];for(let r=0,o=0;r<i;r++,o++){const s=[],a=n[o%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),s.push(t)}e.push(Dd.from(s))}n=e,t=i}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),Ez(e.state,e.dispatch,o,s,r),!0}if(r){const t=KB(e.state),n=t.start(-1);return Ez(e.state,e.dispatch,n,zB.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function Bz(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Vz(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof QB)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(i=WB(e.state.selection.$anchor))&&(null==(n=Fz(e,t))?void 0:n.pos)!=i.pos)o(i,t),t.preventDefault();else if(!r)return;function o(t,n){let r=Fz(e,n);const i=null==$B.getState(e.state);if(!r||!JB(t,r)){if(!i)return;r=t}const o=new QB(t,r);if(i||!e.state.selection.eq(o)){const n=e.state.tr.setSelection(o);i&&n.setMeta($B,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=$B.getState(e.state)&&e.dispatch(e.state.tr.setMeta($B,-1))}function a(n){const i=n,a=$B.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(Vz(e,i.target)!=r&&(l=Fz(e,t),!l))return s();l&&o(l,i)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function zz(e,t,n){if(!(e.state.selection instanceof Df))return null;const{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){const o=r.before(i),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function Vz(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function Fz(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?WB(e.state.doc.resolve(n.pos)):null}var Hz=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),qz(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,qz(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function qz(e,t,n,r,i,o){var s;let a=0,l=!0,c=t.firstChild;const h=e.firstChild;if(h){for(let e=0,n=0;e<h.childCount;e++){const{colspan:s,colwidth:u}=h.child(e).attrs;for(let e=0;e<s;e++,n++){const s=i==n?o:u&&u[e],h=s?s+"px":"";if(a+=s||r,s||(l=!1),c)c.style.width!=h&&(c.style.width=h),c=c.nextSibling;else{const e=document.createElement("col");e.style.width=h,t.appendChild(e)}}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var jz=new Jf("tableColumnResizing");function $z({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Hz,lastColumnResizable:i=!0}={}){const o=new Uf({key:jz,state:{init(e,t){var i,s;const a=null==(s=null==(i=o.spec)?void 0:i.props)?void 0:s.nodeViews,l=jB(t.schema).table.name;return r&&a&&(a[l]=(e,t)=>new r(e,n,t)),new Wz(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=jz.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;const i=jz.getState(e.state);if(!i)return;if(!i.dragging){const o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(o){const{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=Uz(e,t,"left",n):i-t.clientX<=n&&(s=Uz(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=zB.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Gz(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;const t=jz.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Gz(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return!1;const o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,s=jz.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=e.domAtPos(t),s=o.node.childNodes[o.offset];let a=s.offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(a-=r[e],l--);return a/l}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",h);const r=jz.getState(e.state);(null==r?void 0:r.dragging)&&(!function(e,t,n){const r=e.state.doc.resolve(t),i=r.node(-1),o=zB.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<o.height;e++){const t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;const r=o.map[t],c=i.nodeAt(r).attrs,h=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[h]==n)continue;const u=c.colwidth?c.colwidth.slice():Yz(c.colspan);u[h]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Kz(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(jz,{setDragging:null})))}function h(t){if(!t.which)return c(t);const i=jz.getState(e.state);if(i&&i.dragging){const o=Kz(i.dragging,t,n);Jz(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(jz,{setDragging:{startX:t.clientX,startWidth:l}})),Jz(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",h),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=jz.getState(e);if(t&&t.activeHandle>-1)return function(e,t){var n;const r=[],i=e.doc.resolve(t),o=i.node(-1);if(!o)return ES.empty;const s=zB.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let t=0;t<s.height;t++){const i=l+t*s.width;if(!(l!=s.width-1&&s.map[i]==s.map[i+1]||0!=t&&s.map[i]==s.map[i-s.width])){const t=s.map[i],l=a+t+o.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(n=jz.getState(e))?void 0:n.dragging)&&r.push(AS.node(a+t,a+t+o.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),r.push(AS.widget(l,c))}}return ES.create(e.doc,r)}(e,t.activeHandle)},nodeViews:{}}});return o}var Wz=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(jz);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return GB(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Uz(e,t,n,r){const i="right"==n?-r:r,o=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!o)return-1;const{pos:s}=o,a=WB(e.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=zB.get(a.node(-1)),c=a.start(-1),h=l.map.indexOf(a.pos-c);return h%l.width==0?-1:c+l.map[h-1]}function Kz(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Gz(e,t){e.dispatch(e.state.tr.setMeta(jz,{setHandle:t}))}function Jz(e,t,n,r){const i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=zB.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&qz(o,l.firstChild,l,r,a,n)}function Yz(e){return Array(e).fill(0)}function Xz({allowTableNodeSelection:e=!1}={}){return new Uf({key:$B,state:{init:()=>null,apply(e,t){const n=e.getMeta($B);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:tz,handleDOMEvents:{mousedown:Bz},createSelectionBetween:e=>null!=$B.getState(e.state)?e.state.selection:null,handleTripleClick:Rz,handleKeyDown:Dz,handlePaste:Lz},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,i=(t||e).doc;let o,s;if(r instanceof _f&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)o=QB.create(i,r.from);else if("row"==s){const e=i.resolve(r.from+1);o=QB.rowSelection(e,e)}else if(!n){const e=zB.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];o=QB.create(i,t+1,n)}}else r instanceof Df&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(r)?o=Df.create(i,r.from):r instanceof Df&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(o=Df.create(i,r.$from.start(),r.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}(r,iz(r,n),e)})}var Zz="undefined"!=typeof navigator?navigator:null,Qz=Zz&&Zz.userAgent||"",eV=/Edge\/(\d+)/.exec(Qz),tV=/MSIE \d/.exec(Qz),nV=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qz),rV=!!!(tV||nV||eV)&&!!Zz&&/Apple Computer/.test(Zz.vendor),iV=new Jf("safari-ime-span"),oV=!1;function sV(e){const t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var aV=new Uf(rV?{key:iV,props:{decorations:function(e){const{$from:t,$to:n,to:r}=e.selection;if(oV&&t.sameParent(n)){const t=AS.widget(r,sV,{ignoreSelection:!0,key:"safari-ime-span"});return ES.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{oV=!0},compositionend:()=>{oV=!1}}}}:{key:iV});function lV(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}function cV(e,t,n){const r=wy((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([hV(e[0]),uV(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)Ty(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){const e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],s=i[o][1];let a=0;const l=n.children.indexOf(e);let c=!1,h=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){const n=u.index,i={index:u.index,input:u.input,stack:[...t,e]};let o=s(...u,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(a!==n&&h.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(o)?h.push(...o):o&&h.push(o),a=n+u[0].length,c=!0),!r.global)break;u=r.exec(e.value)}c?(a<e.value.length&&h.push({type:"text",value:e.value.slice(a)}),n.children.splice(l,1,...h)):h=[e];return l+h.length}(e,t)}}function hV(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function uV(e){return"function"==typeof e?e:function(){return e}}const dV="phrasing",pV=["autolink","link","image","label"];function fV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function mV(e){this.config.enter.autolinkProtocol.call(this,e)}function gV(e){this.config.exit.autolinkProtocol.call(this,e)}function vV(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yV(e){this.config.exit.autolinkEmail.call(this,e)}function wV(e){this.exit(e)}function bV(e){cV(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xV],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,kV]],{ignore:["link","linkReference"]})}function xV(e,t,n,r,i){let o="";if(!SV(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");if(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])))return!1;return!0}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=lV(e,"(");let o=lV(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function kV(e,t,n,r){return!(!SV(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function SV(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||Og(n)||Ag(n))&&(!t||47!==n)}function CV(){this.buffer()}function MV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function TV(){this.buffer()}function AV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function OV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gg(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NV(e){this.exit(e)}function EV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gg(this.sliceSerialize(e)).toLowerCase(),n.label=t}function DV(e){this.exit(e)}function IV(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function _V(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,i){const o=r.createTracker(i);let s=o.move("[^");const a=r.enter("footnoteDefinition"),l=r.enter("label");s+=o.move(r.safe(r.associationId(e),{before:s,after:"]"})),l(),s+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),s+=o.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,o.current()),t?RV:PV)));return a(),s},footnoteReference:IV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function PV(e,t,n){return 0===t?e:RV(e,t,n)}function RV(e,t,n){return(n?"":" ")+e}IV.peek=function(){return"["};const LV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function BV(e){this.enter({type:"delete",children:[]},e)}function zV(e){this.exit(e)}function VV(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function FV(e){return e.length}function HV(e){return null==e?"":String(e)}function qV(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function jV(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function $V(e){this.exit(e),this.data.inTable=void 0}function WV(e){this.enter({type:"tableRow",children:[]},e)}function UV(e){this.exit(e)}function KV(e){this.enter({type:"tableCell",children:[]},e)}function GV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,JV));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function JV(e,t){return"|"===t?t:e}function YV(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=Fy.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){const i=l(e,n,r),o=a([i]);return o.slice(0,o.indexOf("\n"))}}};function s(e,t,n,r){const i=n.enter("tableCell"),s=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),a}function a(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||FV,o=[],s=[],a=[],l=[];let c=0,h=-1;for(;++h<e.length;){const t=[],r=[];let o=-1;for(e[h].length>c&&(c=e[h].length);++o<e[h].length;){const s=HV(e[h][o]);if(!1!==n.alignDelimiters){const e=i(s);r[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e)}t.push(s)}s[h]=t,a[h]=r}let u=-1;if("object"==typeof r&&"length"in r)for(;++u<c;)o[u]=qV(r[u]);else{const e=qV(r);for(;++u<c;)o[u]=e}u=-1;const d=[],p=[];for(;++u<c;){const e=o[u];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[u]-t.length-r.length);const s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&(i=t.length+i+r.length,i>l[u]&&(l[u]=i),p[u]=i),d[u]=s}s.splice(1,0,d),a.splice(1,0,p),h=-1;const f=[];for(;++h<s.length;){const e=s[h],t=a[h];u=-1;const r=[];for(;++u<c;){const i=e[u]||"";let s="",a="";if(!1!==n.alignDelimiters){const e=l[u]-(t[u]||0),n=o[u];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),a=s):a=" ".repeat(e)}!1===n.delimiterStart||u||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===i||!1===n.delimiterStart&&!u||r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&u===c-1||r.push("|")}f.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return f.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],a=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],0,t,n);return a(),o}}function XV(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function ZV(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function QV(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(s);let l=Fy.listItem(e,t,n,{...r,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}VV.peek=function(){return"~"};const eF={tokenize:function(e,t,n){let r=0;return function t(o){if((87===o||119===o)&&r<3)return r++,e.consume(o),t;if(46===o&&3===r)return e.consume(o),i;return n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},tF={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(rF,l,a)(t):null===t||Mg(t)||Og(t)||45!==t&&Ag(t)?l(t):(o=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},nF={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(rF,t,o)(s):null===s||Mg(s)||Og(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},rF={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||Mg(s)||Og(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||Mg(e)||Og(e)?t(e):r(e)}function o(e){return vg(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):vg(t)?(e.consume(t),s):n(t)}},partial:!0},iF={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return yg(e)?n(e):t(e)}},partial:!0},oF={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!hF.call(r,r.previous)||fF(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(eF,e.attempt(tF,e.attempt(nF,i),n),n)(t)};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:hF},sF={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){if((72===t||104===t)&&uF.call(r,r.previous)&&!fF(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s;return n(t)};function s(t){if(vg(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),o?l:(o=!0,a)):n(t)}function l(t){return null===t||bg(t)||Mg(t)||Og(t)||Ag(t)?n(t):e.attempt(tF,e.attempt(nF,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:uF},aF={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let i,o;return function(t){if(!pF(t)||!dF.call(r,r.previous)||fF(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)};function s(t){return pF(t)?(e.consume(t),s):64===t?(e.consume(t),a):n(t)}function a(t){return 46===t?e.check(iF,c,l)(t):45===t||95===t||yg(t)?(o=!0,e.consume(t),a):c(t)}function l(t){return e.consume(t),i=!0,a}function c(s){return o&&i&&vg(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:dF},lF={};let cF=48;for(;cF<123;)lF[cF]=aF,cF++,58===cF?cF=65:91===cF&&(cF=97);function hF(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||Mg(e)}function uF(e){return!vg(e)}function dF(e){return!(47===e||pF(e))}function pF(e){return 43===e||45===e||46===e||95===e||yg(e)}function fF(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}lF[43]=aF,lF[45]=aF,lF[46]=aF,lF[95]=aF,lF[72]=[aF,sF],lF[104]=[aF,sF],lF[87]=[aF,oF],lF[119]=[aF,oF];const mF={tokenize:function(e,t,n){const r=this;return Eg(e,function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function gF(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!s||!s._balanced)return n(i);const a=gg(r.sliceSerialize({start:s.end,end:r.now()}));if(94!==a.codePointAt(0)||!o.includes(a.slice(1)))return n(i);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)}}function vF(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const 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++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function yF(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!o||null===a||91===a||Mg(a))return n(a);if(93===a){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(gg(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return Mg(a)||(o=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function wF(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!s||null===t||91===t||Mg(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=gg(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return Mg(t)||(s=!0),a++,e.consume(t),92===t?h:c}function h(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function u(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),Eg(e,d,"gfmFootnoteDefinitionWhitespace")):n(t)}function d(e){return t(e)}}function bF(e,t,n){return e.check(Vg,t,e.attempt(mF,t,n))}function xF(e){e.exit("gfmFootnoteDefinition")}function kF(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const i=this.previous,o=this.events;let s=0;return function(t){if(126===i&&"characterEscape"!==o[o.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),a(t)};function a(o){const l=Pg(i);if(126===o)return s>1?r(o):(e.consume(o),s++,a);if(s<2&&!t)return r(o);const c=e.exit("strikethroughSequenceTemporary"),h=Pg(o);return c._open=!h||2===h&&Boolean(l),c._close=!l||2===l&&Boolean(h),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&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";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&cg(s,s.length,0,Rg(a,e.slice(r+1,n),t)),cg(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),cg(e,r-1,n-r+3,s),n=r+s.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class SF{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0===n&&0===r.length)return;for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,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(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function CF(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function MF(e,t,n){const r=this;let i,o=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?b:a;if(o===b&&r.parser.lazy[r.now().line])return n(e);return o(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return i=!0,s+=1,l(e)}(t)}function l(t){return null===t?n(t):Cg(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),u):n(t):Tg(t)?Eg(e,l,"whitespace")(t):(s+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||Mg(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?h:c)}function h(t){return 92===t||124===t?(e.consume(t),c):c(t)}function u(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,Tg(t)?Eg(e,d,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):d(t))}function d(t){return 45===t||58===t?f(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):w(t)}function p(t){return Tg(t)?Eg(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||Cg(t)?y(t):w(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):w(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return Tg(t)?Eg(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?d(n):(null===n||Cg(n))&&i&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):w(n)}function w(e){return n(e)}function b(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||Cg(n)?(e.exit("tableRow"),t(n)):Tg(n)?Eg(e,x,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||Mg(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?S:k)}function S(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function TF(e,t){let n,r,i,o=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],h=!1,u=0;const d=new SF;for(;++o<e.length;){const p=e[o],f=p[1];"enter"===p[0]?"tableHead"===f.type?(h=!1,0!==u&&(OF(d,t,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(o,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,i=void 0,l=[0,0,0,0],c=[0,o+1,0,0],h&&(h=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(o,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],i=AF(d,t,l,a,void 0,i)),l=c,c=[l[1],o,0,0])):(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=AF(d,t,l,a,void 0,i),l=[0,0,0,0]),c[2]=o)):"tableHead"===f.type?(h=!0,u=o):"tableRow"===f.type||"tableDelimiterRow"===f.type?(u=o,0!==l[1]?(c[0]=c[1],i=AF(d,t,l,a,o,i)):0!==c[1]&&(i=AF(d,t,c,a,o,i)),a=0):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=o)}for(0!==u&&OF(d,t,u,n,r),d.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=CF(t.events,o))}return e}function AF(e,t,n,r,i,o){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},NF(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=NF(t.events,n[1]);if(o={type:s,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=NF(t.events,n[2]),o=NF(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const 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){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},NF(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function OF(e,t,n,r,i){const o=[],s=NF(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function NF(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const EF={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i};function i(t){return Mg(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return Cg(r)?t(r):Tg(r)?e.check({tokenize:DF},t,n)(r):n(r)}}};function DF(e,t,n){return Eg(e,function(e){return null===e?n(e):t(e)},"whitespace")}const IF={};function _F(e){const t=e||IF,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return dg([{text:lF},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wF,continuation:{tokenize:bF},exit:xF}},text:{91:{name:"gfmFootnoteCall",tokenize:yF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:gF,resolveTo:vF}}},kF(e),{flow:{null:{name:"table",tokenize:MF,resolveAll:TF}}},{text:{91:EF}}])}(t)),i.push([{transforms:[bV],enter:{literalAutolink:fV,literalAutolinkEmail:mV,literalAutolinkHttp:mV,literalAutolinkWww:mV},exit:{literalAutolink:wV,literalAutolinkEmail:yV,literalAutolinkHttp:gV,literalAutolinkWww:vV}},{enter:{gfmFootnoteCallString:CV,gfmFootnoteCall:MV,gfmFootnoteDefinitionLabelString:TV,gfmFootnoteDefinition:AV},exit:{gfmFootnoteCallString:OV,gfmFootnoteCall:NV,gfmFootnoteDefinitionLabelString:EV,gfmFootnoteDefinition:DV}},{canContainEols:["delete"],enter:{strikethrough:BV},exit:{strikethrough:zV}},{enter:{table:jV,tableData:KV,tableHeader:KV,tableRow:WV},exit:{codeText:GV,table:$V,tableData:UV,tableHeader:UV,tableRow:UV}},{exit:{taskListCheckValueChecked:XV,taskListCheckValueUnchecked:XV,paragraph:ZV}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dV,notInConstruct:pV},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dV,notInConstruct:pV},{character:":",before:"[ps]",after:"\\/",inConstruct:dV,notInConstruct:pV}]},_V(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:LV}],handlers:{delete:VV}},YV(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:QV}}]}}(t))}function PF(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}const RF=NM("strike_through");PF(RF,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const LF=TM("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(RF.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));PF(LF.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),PF(LF.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const BF=vM("ToggleStrikeThrough",e=>()=>Ib(LF.type(e)));PF(BF,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const zF=yM(e=>Dm(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),LF.type(e)));PF(zF,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});const VF=AM("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(DC);return()=>t.call(BF.key)}}});PF(VF.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),PF(VF.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const FF=function(e){const t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:qB}};for(const e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>FB(e,t)}],toDOM:e=>["td",HB(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>FB(e,t)}],toDOM:e=>["th",HB(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),HF=MM("table",()=>({...FF.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:0===t}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{const n=t.content.firstChild?.content;if(!n)return;const r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));PF(HF.node,{displayName:"NodeSchema<table>",group:"Table"}),PF(HF.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const qF=MM("table_header_row",()=>({...FF.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>Boolean("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode()}}}));PF(qF.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),PF(qF.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});const jF=MM("table_row",()=>({...FF.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));PF(jF.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),PF(jF.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const $F=MM("table_cell",()=>({...FF.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));PF($F.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),PF($F.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const WF=MM("table_header",()=>({...FF.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));function UF(e,t=3,n=3){const r=Array(n).fill(0).map(()=>$F.type(e).createAndFill()),i=Array(n).fill(0).map(()=>WF.type(e).createAndFill()),o=Array(t).fill(0).map((t,n)=>0===n?qF.type(e).create(null,i):jF.type(e).create(null,r));return HF.type(e).create(null,o)}function KF(e){return(t,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),o=$m(e=>"table"===e.type.name)(i),s=o?{node:o.node,from:o.start}:void 0,a="row"===e;if(s){const e=zB.get(s.node);if(t>=0&&t<(a?e.height:e.width)){const n=e.positionAt(a?t:e.height-1,a?e.width-1:t,s.node),i=r.doc.resolve(s.from+n),o=a?QB.rowSelection:QB.colSelection,l=e.positionAt(a?t:0,a?0:t,s.node),c=r.doc.resolve(s.from+l);return Hm(r.setSelection(o(i,c)))}}return r}}PF(WF.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),PF(WF.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});const GF=KF("row"),JF=KF("col");function YF(e,t,{map:n,tableStart:r,table:i},o){const s=Array(o).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),a=Array(n.width).fill(0).map((t,r)=>{const o=i.nodeAt(n.map[r]);return $F.type(e).createAndFill({alignment:o?.attrs.alignment})});return t.insert(s,jF.type(e).create(null,a)),t}function XF(e){const t=function(e){const t=az(e.$from);if(!t)return;const n=zB.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return Hm(e.setSelection(new QB(t,n)))}}return e}const ZF=vM("GoToPrevTableCell",()=>()=>Cz(-1));PF(ZF,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const QF=vM("GoToNextTableCell",()=>()=>Cz(1));PF(QF,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const eH=vM("ExitTable",e=>()=>(t,n)=>{if(!UB(t))return!1;const{$head:r}=t.selection,i=(o=r,s=HF.type(e),qm(e=>e.type===s)(o));var o,s;if(!i)return!1;const{to:a}=i,l=t.tr.replaceWith(a,a,RA.type(e).createAndFill());return l.setSelection(Af.near(l.doc.resolve(a),1)).scrollIntoView(),n?.(l),!0});PF(eH,{displayName:"Command<breakTableCommand>",group:"Table"});const tH=vM("InsertTable",e=>({row:t,col:n}={})=>(r,i)=>{const{selection:o,tr:s}=r,{from:a}=o,l=UF(e,t,n),c=s.replaceSelectionWith(l),h=Af.findFrom(c.doc.resolve(a),1,!0);return h&&c.setSelection(h),i?.(c),!0});PF(tH,{displayName:"Command<insertTableCommand>",group:"Table"});const nH=vM("MoveRow",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:i,select:o=!0,pos:s=e.selection.from}=r,a=e.tr;return!!mz({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})&&(null==t||t(a),!0)};var r});PF(nH,{displayName:"Command<moveRowCommand>",group:"Table"});const rH=vM("MoveCol",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:i,select:o=!0,pos:s=e.selection.from}=r,a=e.tr;return!!fz({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})&&(null==t||t(a),!0)};var r});PF(rH,{displayName:"Command<moveColCommand>",group:"Table"});const iH=vM("SelectRow",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,i=n?.(GF(e.index,e.pos)(r));return Boolean(i)});PF(iH,{displayName:"Command<selectRowCommand>",group:"Table"});const oH=vM("SelectCol",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,i=n?.(JF(e.index,e.pos)(r));return Boolean(i)});PF(oH,{displayName:"Command<selectColCommand>",group:"Table"});const sH=vM("SelectTable",()=>()=>(e,t)=>{const{tr:n}=e,r=t?.(XF(n));return Boolean(r)});PF(sH,{displayName:"Command<selectTableCommand>",group:"Table"});const aH=vM("DeleteSelectedCells",()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof QB))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?function(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}(e,t):i?function(e,t){if(!UB(e))return!1;if(t){const n=gz(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;bz(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=zB.get(e)}t(r)}return!0}(e,t):function(e,t){if(!UB(e))return!1;if(t){const n=gz(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;xz(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=zB.get(n.table)}t(r)}return!0}(e,t)});PF(aH,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const lH=vM("AddColBefore",()=>()=>yz);PF(lH,{displayName:"Command<addColBeforeCommand>",group:"Table"});const cH=vM("AddColAfter",()=>()=>wz);PF(cH,{displayName:"Command<addColAfterCommand>",group:"Table"});const hH=vM("AddRowBefore",e=>()=>(t,n)=>{if(!UB(t))return!1;if(n){const r=gz(t);n(YF(e,t.tr,r,r.top))}return!0});PF(hH,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const uH=vM("AddRowAfter",e=>()=>(t,n)=>{if(!UB(t))return!1;if(n){const r=gz(t);n(YF(e,t.tr,r,r.bottom))}return!0});PF(uH,{displayName:"Command<addRowAfterCommand>",group:"Table"});const dH=vM("SetAlign",()=>(e="left")=>function(e,t){return function(n,r){if(!UB(n))return!1;const i=KB(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){const o=n.tr;n.selection instanceof QB?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}}("alignment",e));PF(dH,{displayName:"Command<setAlignCommand>",group:"Table"});const pH=yM(e=>new Yf(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,i)=>{const o=t.doc.resolve(r);if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),HF.type(e)))return null;const s=Math.max(Number(n.groups?.row??0),2),a=UF(e,s,Number(n.groups?.col)),l=t.tr.replaceRangeWith(r,i,a);return l.setSelection(Df.create(l.doc,r+3)).scrollIntoView()}));PF(pH,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const fH=function(e){const t=n=>async()=>{await n.wait(SC);const r=e(n);return n.update(rM,e=>[...e,r]),t.pasteRule=r,()=>{n.update(rM,e=>e.filter(e=>e!==r))}};return t}(e=>({run:(t,n,r)=>{if(r)return t;let i=t.content;return t.content.forEach((t,n,r)=>{if(t?.type!==HF.type(e))return;const o=t.childCount,s=t.lastChild?.childCount??0;if(0===o||0===s)return void(i=i.replaceChild(r,RA.type(e).create()));const a=t.firstChild;if(!(s>0&&a&&0===a.childCount))return;const l=Array(s).fill(0).map(()=>WF.type(e).createAndFill()),c=new Bd(Dd.from(l),0,0),h=a.replace(0,0,c),u=t.replace(0,a.nodeSize,new Bd(Dd.from(h),0,0));i=i.replaceChild(r,u)}),new Bd(Dd.from(i),t.openStart,t.openEnd)}}));PF(fH,{displayName:"PasteRule<table>",group:"Table"});const mH=AM("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(DC);return()=>t.call(QF.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(DC);return()=>t.call(ZF.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{const t=e.get(DC);return()=>t.call(eH.key)}}});PF(mH.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),PF(mH.shortcuts,{displayName:"Keymap<table>",group:"Table"});const gH="footnote_definition",vH="footnoteDefinition",yH=MM("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${gH}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":gH},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===vH,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===gH,runner:(e,t)=>{e.openNode(vH,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));PF(yH.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),PF(yH.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const wH="footnote_reference",bH=MM("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${wH}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":wH},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===wH,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));PF(bH.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),PF(bH.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const xH=TO.extendSchema(e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw sm(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const i=null!=t.label?`${t.label}.`:"•",o=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:a,checked:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,i=t.attrs.listType,o="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:i,spread:o,checked:s}),e.next(t.content),e.closeNode()}}}});PF(xH.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),PF(xH.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});const kH=yM(()=>new Yf(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{const i=e.doc.resolve(n);let o=0,s=i.node(o);for(;s&&"list_item"!==s.type.name;)o--,s=i.node(o);if(!s||null!=s.attrs.checked)return null;const a=Boolean("x"===t.groups?.checked),l=i.before(o),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));PF(kH,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const SH=[VF,mH].flat(),CH=[pH,kH],MH=[zF],TH=[fH],AH=xM(()=>aV);PF(AH,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});PF(xM(()=>$z({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const OH=xM(()=>Xz({allowTableNodeSelection:!0}));PF(OH,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const NH=EM("remarkGFM",()=>_F);PF(NH.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),PF(NH.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});const EH=new Jf("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");const DH=xM(()=>new Uf({key:EH,appendTransaction:(e,t,n)=>{let r;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{if(r||(r=n.tr),"table_cell"!==e.type.name)return;const i=n.doc.resolve(t),o=i.node(i.depth),s=i.node(i.depth-1).firstChild;if(!s)return;const a=function(e,t){let n=0;return t.forEach((t,r,i)=>{t===e&&(n=i)}),n}(e,o),l=s.maybeChild(a);if(!l)return;const c=l.attrs.alignment;c!==e.attrs.alignment&&r.setNodeMarkup(t,void 0,{...e.attrs,alignment:c})}),r}}));PF(DH,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});const IH=[DH,AH,NH,OH].flat(),_H=[[xH,HF,qF,jF,WF,$F,yH,bH,RF,LF].flat(),CH,TH,MH,SH,[QF,ZF,eH,tH,nH,rH,iH,oH,sH,aH,hH,uH,lH,cH,dH,BF],IH].flat();function PH(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}const RH=PH(HH,0),LH=PH(FH,0),BH=PH((e,t)=>FH(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function zH(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const VH=50;function FH(e,t,n=t.selection.ranges){let r=n.map(e=>zH(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-VH,r),l=e.sliceDoc(i,i+VH),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=2*VH?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+VH),s=e.sliceDoc(i-VH,i));let d=/^\s*/.exec(o)[0].length,p=/\s*$/.exec(s)[0].length,f=s.length-p-n.length;return o.slice(d,d+t.length)==t&&s.slice(f,f+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(s.charAt(f-1))?1:0}}:null}(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t,n=0;n<i.length;n++)if(t=i[n]){let i=r[n],{open:o,close:s}=t;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}function HH(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:o}of n){let n=r.length,s=1e9,a=zH(t,e).line;if(a){for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)!s&&o||e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null}const qH=dr.define(),jH=dr.define(),$H=Vn.define(),WH=Vn.define({combine:e=>Or(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),UH=Un.define({create:()=>cq.empty,update(e,t){let n=t.state.facet(WH),r=t.annotation(qH);if(r){let i=QH.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?eq(s,s.length,n.minDepth,i):iq(s,t.startState.selection),new cq(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(jH);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(gr.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=QH.fromTransaction(t),s=t.annotation(gr.time),a=t.annotation(gr.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new cq(e.done.map(QH.fromJSON),e.undone.map(QH.fromJSON))});function KH(e={}){return[UH,WH.of(e),hl.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?JH:"historyRedo"==e.inputType?YH:null;return!!n&&(e.preventDefault(),n(t))}})]}function GH(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(UH,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}const JH=GH(0,!1),YH=GH(1,!1),XH=GH(0,!0),ZH=GH(1,!0);class QH{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new QH(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new QH(e.changes&&On.fromJSON(e.changes),[],e.mapped&&An.fromJSON(e.mapped),e.startSelection&&Ln.fromJSON(e.startSelection),e.selectionsAfter.map(Ln.fromJSON))}static fromTransaction(e,t){let n=nq;for(let t of e.startState.facet($H)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new QH(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,nq)}static selection(e){return new QH(void 0,nq,void 0,void 0,e)}}function eq(e,t,n,r){let i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function tq(e,t){return e.length?t.length?e.concat(t):e:t}const nq=[],rq=200;function iq(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-rq));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),eq(e,e.length-1,1e9,n.setSelAfter(r)))}return[QH.selection([t])]}function oq(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function sq(e,t){if(!e.length)return e;let n=e.length,r=nq;for(;n;){let i=aq(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[QH.selection(r)]:nq}function aq(e,t,n){let r=tq(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):nq,n);if(!e.changes)return QH.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new QH(i,mr.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const lq=/^(input\.type|delete)($|\.)/;let cq=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,o){let s=this.done,a=s[s.length-1];return s=a&&a.changes&&!a.changes.empty&&t.changes&&(!r||lq.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,o)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];o>=t&&i<=s&&(r=!0)}}),r}(a.changes,t.changes))||"input.type.compose"==r)?eq(s,s.length-1,i.minDepth,new QH(t.changes.compose(a.changes),tq(mr.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,nq)):eq(s,s.length,i.minDepth,t),new e(s,nq,n,r)}addSelection(t,n,r,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:nq;return o.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&(s=o[o.length-1],a=t,s.ranges.length==a.ranges.length&&0===s.ranges.filter((e,t)=>e.empty!=a.ranges[t].empty).length)?this:new e(iq(this.done,t),this.undone,n,r);var s,a}addMapping(t){return new e(sq(this.done,t),sq(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:qH.of({side:e,rest:oq(r),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let n=1==r.length?nq:r.slice(0,r.length-1);return i.mapped&&(n=sq(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:qH.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}};cq.empty=new cq(nq,nq);const hq=[{key:"Mod-z",run:JH,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:YH,preventDefault:!0},{linux:"Ctrl-Shift-z",run:YH,preventDefault:!0},{key:"Mod-u",run:XH,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ZH,preventDefault:!0}];function uq(e,t){return Ln.create(e.ranges.map(t),e.mainIndex)}function dq(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function pq({state:e,dispatch:t},n){let r=uq(e.selection,n);return!r.eq(e.selection,!0)&&(t(dq(e,r)),!0)}function fq(e,t){return Ln.cursor(t?e.to:e.from)}function mq(e,t){return pq(e,n=>n.empty?e.moveByChar(n,t):fq(n,t))}function gq(e){return e.textDirectionAt(e.state.selection.main.head)==So.LTR}const vq=e=>mq(e,!gq(e)),yq=e=>mq(e,gq(e));function wq(e,t){return pq(e,n=>n.empty?e.moveByGroup(n,t):fq(n,t))}function bq(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function xq(e,t,n){let r,i,o=_h(e).resolveInner(t.head),s=n?ut.closedBy:ut.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;bq(e,t,s)?o=t:r=n?t.to:t.from}return i=o.type.prop(s)&&(r=n?Ju(e,o.from,1):Ju(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,Ln.cursor(i,n?-1:1)}function kq(e,t){return pq(e,n=>{if(!n.empty)return fq(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Sq=e=>kq(e,!1),Cq=e=>kq(e,!0);function Mq(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(hl.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function Tq(e,t){let n,r=Mq(e),{state:i}=e,o=uq(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):fq(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=hl.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(dq(i,o),{effects:n}),!0}const Aq=e=>Tq(e,!1),Oq=e=>Tq(e,!0);function Nq(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=Ln.cursor(r.from+n))}return i}function Eq(e,t){let n=uq(e.state.selection,e=>{let n=t(e);return Ln.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(dq(e.state,n)),!0)}function Dq(e,t){return Eq(e,n=>e.moveByChar(n,t))}const Iq=e=>Dq(e,!gq(e)),_q=e=>Dq(e,gq(e));function Pq(e,t){return Eq(e,n=>e.moveByGroup(n,t))}function Rq(e,t){return Eq(e,n=>e.moveVertically(n,t))}const Lq=e=>Rq(e,!1),Bq=e=>Rq(e,!0);function zq(e,t){return Eq(e,n=>e.moveVertically(n,t,Mq(e).height))}const Vq=e=>zq(e,!1),Fq=e=>zq(e,!0),Hq=({state:e,dispatch:t})=>(t(dq(e,{anchor:0})),!0),qq=({state:e,dispatch:t})=>(t(dq(e,{anchor:e.doc.length})),!0),jq=({state:e,dispatch:t})=>(t(dq(e,{anchor:e.selection.main.anchor,head:0})),!0),$q=({state:e,dispatch:t})=>(t(dq(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function Wq(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(dq(n,Ln.create(i,i.length-1))),!0)}function Uq(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=Kq(e,s,!1)):s>i&&(n="delete.forward",s=Kq(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=Kq(e,i,!1),o=Kq(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:Ln.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?hl.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Kq(e,t,n){if(e instanceof hl)for(let r of e.state.facet(hl.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}const Gq=(e,t,n)=>Uq(e,r=>{let i,o,s=r.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(i=l.text.slice(0,s-l.from))){if("\t"==i[i.length-1])return s-1;let e=Wr(i,a.tabSize)%Kh(a)||Kh(a);for(let t=0;t<e&&" "==i[i.length-1-t];t++)s--;o=s}else o=xn(l.text,s-l.from,t,t)+l.from,o==s&&l.number!=(t?a.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(o-l.from,s-l.from))&&(o=xn(l.text,o-l.from,!1,!1)+l.from);return o}),Jq=e=>Gq(e,!1,!0),Yq=e=>Gq(e,!0,!1),Xq=(e,t)=>Uq(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=xn(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&r==n.head||(e=c),r=a}return r}),Zq=e=>Xq(e,!1);function Qq(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function ej(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Qq(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)i.push(Ln.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)i.push(Ln.range(e.anchor-s,e.head-s))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:Ln.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function tj(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Qq(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const nj=rj(!1);function rj(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=_h(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(ut.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(i.to,o.from))?{from:i.to,to:o.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new Yh(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=Jh(a,r);for(null==l&&(l=Wr(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?({from:r,to:i}=s):r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let c=["",Gh(t,l)];return s&&c.push(Gh(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:un.of(c)},range:Ln.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function ij(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:Ln.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const oj=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(ij(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Uh)})}),{userEvent:"input.indent"})),!0),sj=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(ij(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Wr(r,e.tabSize),o=0,s=Gh(e,Math.max(0,i-Kh(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),aj=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>pq(e,t=>xq(e.state,t,!gq(e))),shift:e=>Eq(e,t=>xq(e.state,t,!gq(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>pq(e,t=>xq(e.state,t,gq(e))),shift:e=>Eq(e,t=>xq(e.state,t,gq(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>ej(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>tj(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>ej(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>tj(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>Wq(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>Wq(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Ln.create([n.main]):n.main.empty||(r=Ln.create([Ln.cursor(n.main.head)])),!!r&&(t(dq(e,r)),!0)}},{key:"Mod-Enter",run:rj(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Qq(e).map(({from:t,to:n})=>Ln.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Ln.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=uq(e.selection,t=>{let n=_h(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Ln.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(dq(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:sj},{key:"Mod-]",run:oj},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Yh(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=ij(e,(t,i,o)=>{let s=Jh(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=Gh(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Qq(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=uq(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t){let n=!1,r=uq(e.selection,t=>{let r=Ju(e,t.head,-1)||Ju(e,t.head,1)||t.head>0&&Ju(e,t.head-1,1)||t.head<e.doc.length&&Ju(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return Ln.cursor(i)});return!!n&&(t(dq(e,r)),!0)}(e,t)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=zH(e.state,n.from);return r.line?RH(e):!!r.block&&BH(e)}},{key:"Alt-A",run:LH},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:vq,shift:Iq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>wq(e,!gq(e)),shift:e=>Pq(e,!gq(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>pq(e,t=>Nq(e,t,!gq(e))),shift:e=>Eq(e,t=>Nq(e,t,!gq(e))),preventDefault:!0},{key:"ArrowRight",run:yq,shift:_q,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>wq(e,gq(e)),shift:e=>Pq(e,gq(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>pq(e,t=>Nq(e,t,gq(e))),shift:e=>Eq(e,t=>Nq(e,t,gq(e))),preventDefault:!0},{key:"ArrowUp",run:Sq,shift:Lq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Hq,shift:jq},{mac:"Ctrl-ArrowUp",run:Aq,shift:Vq},{key:"ArrowDown",run:Cq,shift:Bq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:qq,shift:$q},{mac:"Ctrl-ArrowDown",run:Oq,shift:Fq},{key:"PageUp",run:Aq,shift:Vq},{key:"PageDown",run:Oq,shift:Fq},{key:"Home",run:e=>pq(e,t=>Nq(e,t,!1)),shift:e=>Eq(e,t=>Nq(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Hq,shift:jq},{key:"End",run:e=>pq(e,t=>Nq(e,t,!0)),shift:e=>Eq(e,t=>Nq(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:qq,shift:$q},{key:"Enter",run:nj,shift:nj},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Jq,shift:Jq,preventDefault:!0},{key:"Delete",run:Yq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Zq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>Xq(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>Uq(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>Uq(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:vq,shift:Iq,preventDefault:!0},{key:"Ctrl-f",run:yq,shift:_q},{key:"Ctrl-p",run:Sq,shift:Lq},{key:"Ctrl-n",run:Cq,shift:Bq},{key:"Ctrl-a",run:e=>pq(e,t=>Ln.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>Eq(e,t=>Ln.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>pq(e,t=>Ln.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>Eq(e,t=>Ln.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:Yq},{key:"Ctrl-h",run:Jq},{key:"Ctrl-k",run:e=>Uq(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:Zq},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:un.of(["",""])},range:Ln.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:xn(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:xn(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:Ln.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Oq}].map(e=>({mac:e.key,run:e.run,shift:e.shift})))),lj={key:"Tab",run:oj,shift:sj};var cj=200,hj=function(){};hj.prototype.append=function(e){return e.length?(e=hj.from(e),!this.length&&e||e.length<cj&&this.leafAppend(e)||this.length<cj&&e.leafPrepend(this)||this.appendInner(e)):this},hj.prototype.prepend=function(e){return e.length?hj.from(e).append(this):this},hj.prototype.appendInner=function(e){return new dj(this,e)},hj.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?hj.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},hj.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},hj.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},hj.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},hj.from=function(e){return e instanceof hj?e:e&&e.length?new uj(e):hj.empty};var uj=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=cj)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=cj)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(hj);hj.empty=new uj([]);var dj=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(hj);class pj{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}t&&(n=this.remapping(i,this.items.length),r=n.maps.length);let o,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(i,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new fj(e.map));let t,i=e.step.map(n.slice(r));i&&a.maybeStep(i).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new fj(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(o=n?e.selection.map(n.slice(r)):e.selection,s=new pj(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:o}}addTransform(e,t,n,r){let i=[],o=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),h=new fj(e.mapping.maps[n],c,t);(l=a&&a.merge(h))&&(h=l,n?i.pop():s=s.slice(0,s.length-1)),i.push(h),t&&(o++,t=void 0),r||(a=h)}let l=o-n.depth;return l>gj&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),o-=l),new pj(s.append(i),o)}remapping(e,t){let n=new jp;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new pj(this.items.append(e.map(e=>new fj(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let l=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&s++,n.push(new fj(l,o,c))}else n.push(new fj(l))},r);let l=[];for(let e=t;e<o;e++)l.push(new fj(i.maps[e]));let c=this.items.slice(0,r).append(l).append(n),h=new pj(c,s);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let l,c=new fj(s.invert(),e,a),h=r.length-1;(l=r.length&&r[h].merge(c))?r[h]=l:r.push(c)}}else o.map&&n--},this.items.length,0),new pj(hj.from(r.reverse()),i)}}pj.empty=new pj(hj.empty,0);class fj{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new fj(t.getMap().invert(),t,this.selection)}}}class mj{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const gj=20;function vj(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function yj(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let wj=!1,bj=null;function xj(e){let t=e.plugins;if(bj!=t){wj=!1,bj=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){wj=!0;break}}return wj}const kj=new Jf("history"),Sj=new Jf("closeHistory");function Cj(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Uf({key:kj,state:{init:()=>new mj(pj.empty,pj.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let i,o=n.getMeta(kj);if(o)return o.historyState;n.getMeta(Sj)&&(e=new mj(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(kj))return s.getMeta(kj).redo?new mj(e.done.addTransform(n,void 0,r,xj(t)),e.undone,vj(n.mapping.maps),e.prevTime,e.prevComposition):new mj(e.done,e.undone.addTransform(n,void 0,r,xj(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new mj(e.done.rebased(n,i),e.undone.rebased(n,i),yj(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new mj(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),yj(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=s?yj(e.prevRanges,n.mapping):vj(n.mapping.maps);return new mj(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,xj(t)),pj.empty,a,n.time,null==i?e.prevComposition:i)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Tj:"historyRedo"==n?Aj:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Mj(e,t){return(n,r)=>{let i=kj.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=xj(t),i=kj.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),l=new mj(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(kj,{redo:n,historyState:l})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}const Tj=Mj(!1,!0),Aj=Mj(!0,!0);var Oj=Object.defineProperty,Nj=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,Ij=(e,t,n)=>t in e?Oj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_j=(e,t)=>{for(var n in t||(t={}))Ej.call(t,n)&&Ij(e,n,t[n]);if(Nj)for(var n of Nj(t))Dj.call(t,n)&&Ij(e,n,t[n]);return e};function Pj(e,t){return Object.assign(e,{meta:_j({package:"@milkdown/components"},t)}),e}const Rj=CM({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");Pj(Rj,{displayName:"Config<code-block>",group:"CodeBlock"});class Lj{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function Bj({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}Bj.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function zj(e){return t=this,n=null,r=function*(){try{return navigator.clipboard.writeText(e)}catch(t){const n=document.createElement("textarea"),r=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const i=document.getSelection(),o=i?i.rangeCount>0&&i.getRangeAt(0):null;document.body.appendChild(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(n),o&&(i.removeAllRanges(),i.addRange(o)),r&&r.focus()}},new Promise((e,i)=>{var o=e=>{try{a(r.next(e))}catch(e){i(e)}},s=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,s);a((r=r.apply(t,n)).next())});var t,n,r}const Vj=BI({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){const t=()=>{zj(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>vR(DP,null,vR("button",{type:"button",class:"copy-button",onClick:t},vR(Bj,{icon:e.copyIcon}),e.copyText))}}),Fj=BI({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:i}){const o=MD(),s=MD(!1),a=MD(),l=MD(),c=MD("");P_([s,o,l],()=>{c.value="";const e=o.value,t=l.value;e&&t&&JT(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});const h=e=>{if(e.preventDefault(),e.stopPropagation(),i())return;const t=!s.value;s.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},u=e=>{const t=e.target;c.value=t.value},d=e=>{"Escape"===e.key&&(c.value="")},p=gR(()=>{var t;if(!s.value)return[];const n=null!=(t=r())?t:[],i=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),o=n.filter(e=>{const t=c.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==i});return 0===o.length?[]:i?[i,...o]:o}),f=e=>{const t=e.target;if(o.value&&o.value.contains(t))return;const n=l.value,r=o.value;r&&n&&"true"===r.dataset.expanded&&(n.contains(t)||(s.value=!1))};return ZI(()=>{window.addEventListener("click",f)}),n_(()=>{window.removeEventListener("click",f)}),()=>vR(DP,null,vR("button",{type:"button",ref:o,class:"language-button",onClick:h,"data-expanded":String(s.value)},e.value||"Text",vR("div",{class:"expand-icon"},vR(Bj,{icon:t.expandIcon}))),vR("div",{ref:l,class:"language-picker"},s.value?vR("div",{class:"list-wrapper"},vR("div",{class:"search-box"},vR("div",{class:"search-icon"},vR(Bj,{icon:t.searchIcon})),vR("input",{ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:c.value,onInput:u,onKeydown:d}),vR("div",{class:ZR("clear-icon",0===c.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),c.value=""}},vR(Bj,{icon:t.clearSearchIcon}))),vR("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){const e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},p.value.length?p.value.map(r=>vR("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),s.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):vR("li",{class:"language-list-item no-result"},t.noResultText))):null))}}),Hj=BI({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){const{previewOnlyMode:t,config:n,preview:r}=e,i=MD();return __(()=>{const e=i.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);const t=r.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=nB.sanitize(t))}),()=>r.value?vR("div",{class:"preview-panel"},!t.value&&vR(DP,null,vR("div",{class:"preview-divider"}),vR("div",{class:ZR("preview-label",t&&"hidden")},n.previewLabel)),vR("div",{ref:i,class:"preview"})):null}}),qj=BI({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){var t;const n=MD(null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly()),r=MD(),i=MD(null);ZI(()=>{for(var t;null==(t=r.value)?void 0:t.firstChild;)r.value.removeChild(r.value.firstChild);r.value&&r.value.appendChild(e.codemirror.dom)}),P_(()=>[e.text.value,e.language.value],()=>{const t=e.config.renderPreview(e.language.value,e.text.value,e=>i.value=e);t&&(i.value=t);void 0===t&&!i.value&&(i.value=nB.sanitize(e.config.previewLoading)),null===t&&(i.value=null)},{immediate:!0});const o=()=>{};return()=>{var t;return vR(DP,null,vR("div",{class:"tools"},vR(Fj,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),vR("div",{class:"tools-button-group"},vR(Vj,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:o,text:e.text.value}),i.value?vR("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},vR(Bj,{icon:e.config.previewToggleButton(n.value)})):null)),vR("div",{ref:r,class:ZR("codemirror-host",i.value&&n.value&&"hidden")}),vR(Hj,{text:e.text,language:e.language,config:e.config,previewOnlyMode:n,preview:i}))}}});class jj{constructor(e,t,n,r,i){this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=i,this.selected=MD(!1),this.language=MD(""),this.text=MD(""),this.updating=!1,this.languageName="",this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1;const{main:r}=e.state.selection,i=n+r.from,o=n+r.to,s=this.view.state.selection;if(e.docChanged||s.from!==i||s.to!==o){const t=this.view.state.tr;e.changes.iterChanges((e,r,i,o,s)=>{s.length?t.replaceWith(n+e,n+r,this.view.state.schema.text(s.toString())):t.delete(n+e,n+r),n+=o-i-(r-e)}),t.setSelection(Df.create(t.doc,i,o)),this.view.dispatch(t)}},this.createApp=()=>JR(qj,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const e=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>!!Cb(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>Tj(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>Aj(e.state,e.dispatch)},{key:"Mod-y",run:()=>Aj(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;const t=this.cm.state.selection.ranges;if(t.length>1)return!1;const n=t[0];if(n&&(!n.empty||n.anchor>0))return!1;if(this.cm.state.doc.lines>=2)return!1;const r=this.view.state,i=null!=(e=this.getPos())?e:0,o=r.tr.replaceWith(i,i+this.node.nodeSize,r.schema.nodes.paragraph.createChecked({},this.node.content));return o.setSelection(Df.near(o.doc.resolve(i))),this.view.dispatch(o),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;const{state:r}=this.cm;let i=r.selection.main;if(!i.empty)return!1;if("line"===e&&(i=r.doc.lineAt(i.head)),t<0?i.from>0:i.to<r.doc.length)return!1;const o=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),s=Df.near(this.view.state.doc.resolve(o),t),a=this.view.state.tr.setSelection(s).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new er,this.readOnlyConf=new er,this.cm=new hl({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Ar.readOnly.of(!this.view.editable)),Il(),yl.of(this.codeMirrorKeymap()),this.languageConf.of([]),Ar.changeFilter.of(()=>this.view.editable),...i.extensions,hl.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=__(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){const t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e;this.loader.load(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Ar.readOnly.of(!this.view.editable))});const t=function(e,t){if(e===t)return null;let n=0,r=e.length,i=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&i>n&&e.charCodeAt(r-1)===t.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:t.slice(n,i)}}(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}const $j=SM(ZA.node,e=>{const t=e.get(Rj.key),n=new Lj(t.languages);return(e,r,i)=>new jj(e,r,i,n,t)});Pj($j,{displayName:"NodeView<code-block>",group:"CodeBlock"});const Wj=[$j,Rj],Uj="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Kj{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Uj(e)):Uj,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return kn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Sn(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Cn(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&e<t.length&&t.charCodeAt(e)==o&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(Kj.prototype[Symbol.iterator]=function(){return this});const Gj={from:-1,to:-1,match:/.*/.exec("")},Jj="gm"+(null==/x/.unicode?"":"u");class Yj{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Gj,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Qj(e,t,n,r,i);this.re=new RegExp(t,Jj+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=e$(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=e$(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const Xj=new WeakMap;class Zj{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Xj.get(e);if(!r||r.from>=n||r.to<=t){let r=new Zj(t,e.sliceString(t,n));return Xj.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),Xj.set(e,new Zj(o,i)),new Zj(t,i.slice(t-o,n-o))}}class Qj{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Gj,this.matchPos=e$(e,r),this.re=new RegExp(t,Jj+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=Zj.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=e$(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Zj.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function e$(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function t$(e){let t=si("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,o,s,a,l]=n,c=a?+a.slice(1):0,h=s?+s:i.number;if(s&&l){let e=h/100;o&&(e=e*("-"==o?-1:1)+i.number/r.doc.lines),h=Math.round(r.doc.lines*e)}else s&&o&&(h=h*("-"==o?-1:1)+i.number);let u=r.doc.line(Math.max(1,Math.min(r.doc.lines,h))),d=Ln.cursor(u.from+Math.max(0,Math.min(c,u.length)));e.dispatch({effects:[n$.of(!1),hl.scrollIntoView(d.from,{y:"center"})],selection:d}),e.focus()}return{dom:si("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:n$.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},si("label",e.state.phrase("Go to line"),": ",t)," ",si("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),si("button",{name:"close",onclick:()=>{e.dispatch({effects:n$.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]))}}"undefined"!=typeof Symbol&&(Yj.prototype[Symbol.iterator]=Qj.prototype[Symbol.iterator]=function(){return this});const n$=mr.define(),r$=Un.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(n$)&&(e=n.value);return e},provide:e=>Nc.from(e,e=>e?t$:null)}),i$=hl.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),o$={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},s$=Vn.define({combine:e=>Or(e,o$,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});const a$=ho.mark({class:"cm-selectionMatch"}),l$=ho.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function c$(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==Sr.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==Sr.Word)}const h$=ls.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(s$),{state:n}=e,r=n.selection;if(r.ranges.length>1)return ho.none;let i,o=r.main,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return ho.none;let e=n.wordAt(o.head);if(!e)return ho.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return ho.none;if(t.wholeWords){if(i=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!c$(s,n,o.from,o.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==Sr.Word&&e(t.sliceDoc(r-1,r))==Sr.Word}(s,n,o.from,o.to))return ho.none}else if(i=n.sliceDoc(o.from,o.to),!i)return ho.none}let a=[];for(let r of e.visibleRanges){let e=new Kj(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||c$(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?a.push(l$.range(r,i)):(r>=o.to||i<=o.from)&&a.push(a$.range(r,i)),a.length>t.maxMatches))return ho.none}}return ho.set(a)}},{decorations:e=>e.decorations}),u$=hl.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const d$=Vn.define({combine:e=>Or(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new H$(e),scrollToMatch:e=>hl.scrollIntoView(e)})});class p${constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Jj),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new b$(this):new g$(this)}getCursor(e,t=0,n){let r=e.doc?e:Ar.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?v$(this,r,t,n):m$(this,r,t,n)}}class f${constructor(e){this.spec=e}}function m$(e,t,n,r){return new Kj(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=e.sliceString(o,Math.min(e.length,r+2))),!(t(y$(i,n-o))==Sr.Word&&t(w$(i,n-o))==Sr.Word||t(w$(i,r-o))==Sr.Word&&t(y$(i,r-o))==Sr.Word))}(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}class g$ extends f${constructor(e){super(e)}nextMatch(e,t,n){let r=m$(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=m$(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=m$(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=m$(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=m$(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function v$(e,t,n,r){return new Yj(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(i=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(i(y$(n.input,n.index))!=Sr.Word||i(w$(n.input,n.index))!=Sr.Word)&&(i(w$(n.input,n.index+n[0].length))!=Sr.Word||i(y$(n.input,n.index+n[0].length))!=Sr.Word)):void 0},n,r);var i}function y$(e,t){return e.slice(xn(e,t,!1),t)}function w$(e,t){return e.slice(t,xn(e,t))}class b$ extends f${nextMatch(e,t,n){let r=v$(this.spec,e,n,e.doc.length).next();return r.done&&(r=v$(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=v$(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=v$(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=v$(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const x$=mr.define(),k$=mr.define(),S$=Un.define({create:e=>new C$(R$(e).create(),null),update(e,t){for(let n of t.effects)n.is(x$)?e=new C$(n.value.create(),e.panel):n.is(k$)&&(e=new C$(e.query,n.value?P$:null));return e},provide:e=>Nc.from(e,e=>e.panel)});class C${constructor(e,t){this.query=e,this.panel=t}}const M$=ho.mark({class:"cm-searchMatch"}),T$=ho.mark({class:"cm-searchMatch cm-searchMatch-selected"}),A$=ls.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(S$))}update(e){let t=e.state.field(S$);(t!=e.startState.field(S$)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return ho.none;let{view:n}=this,r=new Pr;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?T$:M$)})}return r.finish()}},{decorations:e=>e.decorations});function O$(e){return t=>{let n=t.state.field(S$,!1);return n&&n.query.spec.valid?e(t,n):z$(t)}}const N$=O$((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Ln.single(r.from,r.to),o=e.state.facet(d$);return e.dispatch({selection:i,effects:[W$(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),B$(e),!0}),E$=O$((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=Ln.single(i.from,i.to),s=e.state.facet(d$);return e.dispatch({selection:o,effects:[W$(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),B$(e),!0}),D$=O$((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:Ln.create(n.map(e=>Ln.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),I$=O$((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s,a,l=o,c=[],h=[];l.from==r&&l.to==i&&(a=n.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=t.nextMatch(n,l.from,l.to),h.push(hl.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=e.state.changes(c);return l&&(s=Ln.single(l.from,l.to).map(u),h.push(W$(e,l)),h.push(n.facet(d$).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:h,userEvent:"input.replace"}),!0}),_$=O$((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:hl.announce.of(r),userEvent:"input.replace.all"}),!0});function P$(e){return e.state.facet(d$).createPanel(e)}function R$(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(d$);return new p$({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function L$(e){let t=Mc(e,P$);return t&&t.dom.querySelector("[main-field]")}function B$(e){let t=L$(e);t&&t==e.root.activeElement&&t.select()}const z$=e=>{let t=e.state.field(S$,!1);if(t&&t.panel){let n=L$(e);if(n&&n!=e.root.activeElement){let r=R$(e.state,t.query.spec);r.valid&&e.dispatch({effects:x$.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[k$.of(!0),t?x$.of(R$(e.state,t.query.spec)):mr.appendConfig.of(K$)]});return!0},V$=e=>{let t=e.state.field(S$,!1);if(!t||!t.panel)return!1;let n=Mc(e,P$);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:k$.of(!1)}),!0},F$=[{key:"Mod-f",run:z$,scope:"editor search-panel"},{key:"F3",run:N$,shift:E$,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:N$,shift:E$,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:V$,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new Kj(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(Ln.range(t.value.from,t.value.to))}return t(e.update({selection:Ln.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=Mc(e,t$);if(!t){let n=[n$.of(!0)];null==e.state.field(r$,!1)&&n.push(mr.appendConfig.of([r$,i$])),e.dispatch({effects:n}),t=Mc(e,t$)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=Ln.create(n.ranges.map(t=>e.wordAt(t.head)||Ln.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Kj(e.doc,t,r[r.length-1].to);;){if(i.next(),!i.done){if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(n)return null;i=new Kj(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(Ln.range(i.from,i.to),!1),effects:hl.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class H${constructor(e){this.view=e;let t=this.query=e.state.field(S$).query.spec;function n(e,t,n){return si("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=si("input",{value:t.search,placeholder:q$(e,"Find"),"aria-label":q$(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=si("input",{value:t.replace,placeholder:q$(e,"Replace"),"aria-label":q$(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=si("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=si("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=si("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=si("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>N$(e),[q$(e,"next")]),n("prev",()=>E$(e),[q$(e,"previous")]),n("select",()=>D$(e),[q$(e,"all")]),si("label",null,[this.caseField,q$(e,"match case")]),si("label",null,[this.reField,q$(e,"regexp")]),si("label",null,[this.wordField,q$(e,"by word")]),...e.state.readOnly?[]:[si("br"),this.replaceField,n("replace",()=>I$(e),[q$(e,"replace")]),n("replaceAll",()=>_$(e),[q$(e,"replace all")])],si("button",{name:"close",onclick:()=>V$(e),"aria-label":q$(e,"close"),type:"button"},["×"])])}commit(){let e=new p$({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:x$.of(e)}))}keydown(e){var t,n,r;t=this.view,n=e,r="search-panel",Cl(bl(t.state),n,t,r)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?E$:N$)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),I$(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(x$)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(d$).top}}function q$(e,t){return e.state.phrase(t)}const j$=30,$$=/[\s\.,:;?!]/;function W$(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-j$),s=Math.min(i,n+j$),a=e.state.sliceDoc(o,s);if(o!=r.from)for(let e=0;e<j$;e++)if(!$$.test(a[e+1])&&$$.test(a[e])){a=a.slice(e);break}if(s!=i)for(let e=a.length-1;e>a.length-j$;e--)if(!$$.test(a[e-1])&&$$.test(a[e])){a=a.slice(0,e);break}return hl.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const U$=hl.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),K$=[S$,Zn.low(A$),U$];class G${constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=_h(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Q$(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function J$(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Y$(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=J$(t)+J$(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}class X${constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function Z$(e){return e.selection.main.from}function Q$(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const eW=dr.define();function tW(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:Ln.cursor(a.from+o+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const nW=new WeakMap;function rW(e){if(!Array.isArray(e))return e;let t=nW.get(e);return t||nW.set(e,t=Y$(e)),t}const iW=mr.define(),oW=mr.define();class sW{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=kn(e,t),r=Cn(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(kn(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=kn(e,0),i=Cn(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=kn(e,i);o!=t[l]&&o!=n[l]||(r[l++]=i),i+=Cn(o)}if(l<a)return null}let c=0,h=0,u=!1,d=0,p=-1,f=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&h<a;){let l=kn(e,r);s<0&&(c<a&&l==t[c]&&(i[c++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(p=r),f=r+1,d++):d=0));let y,w=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=Sn(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!r||1==w&&m||0==v&&0!=w)&&(t[h]==l||n[h]==l&&(u=!0)?o[h++]=r:o.length&&(g=!1)),v=w,r+=Cn(l)}return h==a&&0==o[0]&&g?this.result((u?-200:0)-100,o,e):d==a&&0==p?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[p,f]):h==a?this.result((u?-200:0)-100-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?Cn(kn(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class aW{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const lW=Vn.define({combine:e=>Or(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hW,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>cW(e(n),t(n)),optionClass:(e,t)=>n=>cW(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function cW(e,t){return e?t?e+" "+t:e:t}function hW(e,t,n,r,i,o){let s,a,l=e.textDirection==So.RTL,c=l,h=!1,u="top",d=t.left-i.left,p=i.right-t.right,f=r.right-r.left,m=r.bottom-r.top;if(c&&d<Math.min(f,p)?c=!1:!c&&p<Math.min(f,d)&&(c=!0),f<=(c?d:p))s=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,a=Math.min(400,c?d:p);else{h=!0,a=Math.min(400,(l?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${a/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":c?"left":"right")}}function uW(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class dW{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(lW);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=uW(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t,i=n.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]<r.length)return this.applyCompletion(e,r[+t[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(lW).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:oW.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=uW(i.length,o,e.state.facet(lW).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=uW(t.options.length,t.selected,this.view.state.facet(lW).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>rs(this.view.state,e,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):r--;return t&&function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(lW).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=i&&(o>n.from||0==n.from))if(i=e,"string"!=typeof l&&l.header)r.appendChild(l.header(l));else{r.appendChild(document.createElement("completion-section")).textContent=e}}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function pW(e,t){return n=>new dW(n,e,t)}function fW(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class mW{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new mW(this.options,wW(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(lW);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new X$(t,r.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(r.from,r.to),l=s.filterStrict?new aW(a):new sW(a);for(let t of r.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new X$(t,r.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(a,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,c=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):fW(e.completion)>fW(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(lW).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new mW(s,wW(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:OW,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new mW(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new mW(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class gW{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new gW(bW,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(lW),r=(n.override||t.languageDataAt("autocomplete",Z$(t)).map(rW)).map(t=>(this.active.find(e=>e.source==t)||new kW(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(CW));i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=mW.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new kW(e.source,0):e));for(let t of e.effects)t.is(MW)&&(i=i&&i.setSelected(t.value,this.id));return r==this.active&&i==this.open?this:new gW(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vW:yW}}const vW={"aria-autocomplete":"list"},yW={};function wW(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const bW=[];function xW(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(eW);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class kW{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=xW(e,t),r=this;(8&n||16&n&&this.touches(e))&&(r=new kW(r.source,0)),4&n&&0==r.state&&(r=new kW(this.source,1)),r=r.updateFor(e,n);for(let t of e.effects)if(t.is(iW))r=new kW(r.source,1,t.value);else if(t.is(oW))r=new kW(r.source,0);else if(t.is(CW))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Z$(e.state))}}class SW extends kW{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=Z$(e.state);if(s>o||!r||2&t&&(Z$(e.startState)==this.from||s<this.limit))return new kW(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):Q$(e,!0).test(i)}(r.validFor,e.state,i,o)?new SW(this.source,this.explicit,a,r,i,o):r.update&&(r=r.update(r,i,o,new G$(e.state,s,!1)))?new SW(this.source,this.explicit,a,r,r.from,null!==(n=r.to)&&void 0!==n?n:Z$(e.state)):new kW(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new SW(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new kW(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const CW=mr.define({map:(e,t)=>e.map(e=>e.map(t))}),MW=mr.define(),TW=Un.define({create:()=>gW.start(),update:(e,t)=>e.update(t),provide:e=>[mc.from(e,e=>e.tooltip),hl.contentAttributes.from(e,e=>e.attrs)]});function AW(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(TW).active.find(e=>e.source==t.source);return r instanceof SW&&("string"==typeof n?e.dispatch({...tW(e.state,n,r.from,r.to),annotations:eW.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}const OW=pW(TW,AW);function NW(e,t="option"){return n=>{let r=n.state.field(TW,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(lW).interactionDelay)return!1;let i,o=1;"page"==t&&(i=kc(n,r.open.tooltip))&&(o=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,a=r.open.selected>-1?r.open.selected+o*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:MW.of(a)}),!0}}const EW=e=>!!e.state.field(TW,!1)&&(e.dispatch({effects:iW.of(!0)}),!0);class DW{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const IW=ls.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(TW).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(TW),n=e.state.facet(lW);if(!e.selectionSet&&!e.docChanged&&e.startState.field(TW)==t)return;let r=e.transactions.some(e=>{let t=xW(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){rs(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(iW)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(TW);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(lW).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Z$(t),r=new G$(t,n,e.explicit,this.view),i=new DW(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:oW.of(null)}),rs(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(lW).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(lW),r=this.view.state.field(TW);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=Z$(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+(o.active.explicit?0:1)),s=new SW(o.active.source,o.active.explicit,i,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new kW(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:CW.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(TW,!1);if(t&&t.tooltip&&this.view.state.facet(lW).closeOnBlur){let n=t.open&&kc(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:oW.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:iW.of(!1)}),20),this.composing=0}}}),_W="object"==typeof navigator&&/Win/.test(navigator.platform),PW=Zn.highest(hl.domEventHandlers({keydown(e,t){let n=t.state.field(TW,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!_W||!e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&AW(t,r),!1}})),RW=hl.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class LW{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}}class BW{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,Tn.TrackDel),n=e.mapPos(this.to,1,Tn.TrackDel);return null==t||null==n?null:new BW(this.field,t,n)}}class zW{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=o,s=/^\t*/.exec(i)[0].length;for(let t=0;t<s;t++)n+=e.facet(Uh);r.push(t+n.length-s),i=n+i.slice(s)}n.push(i),t+=i.length+1}let s=this.fieldPositions.map(e=>new BW(e.field,r[e.line]+e.from,r[e.line]+e.to));return{text:n,ranges:s}}static parse(e){let t,n=[],r=[],i=[];for(let o of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1,l=s.replace(/\\[{}]/g,e=>e[1]);for(let t=0;t<n.length;t++)(null!=e?n[t].seq==e:l&&n[t].name==l)&&(a=t);if(a<0){let t=0;for(;t<n.length&&(null==e||null!=n[t].seq&&n[t].seq<e);)t++;n.splice(t,0,{seq:e,name:l}),a=t;for(let e of i)e.field>=a&&e.field++}for(let e of i)if(e.line==r.length&&e.from>t.index){let n=t[2]?3+(t[1]||"").length:2;e.from-=n,e.to-=n}i.push(new LW(a,r.length,t.index,t.index+l.length)),o=o.slice(0,t.index)+s+o.slice(t.index+t[0].length)}o=o.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(o)}return new zW(r,i)}}let VW=ho.widget({widget:new class extends lo{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),FW=ho.mark({class:"cm-snippetField"});class HW{constructor(e,t){this.ranges=e,this.active=t,this.deco=ho.set(e.map(e=>(e.from==e.to?VW:FW).range(e.from,e.to)),!0)}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new HW(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}const qW=mr.define({map:(e,t)=>e&&e.map(t)}),jW=mr.define(),$W=Un.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(qW))return n.value;if(n.is(jW)&&e)return new HW(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>hl.decorations.from(e,e=>e?e.deco:ho.none)});function WW(e,t){return Ln.create(e.filter(e=>e.field==t).map(e=>Ln.range(e.from,e.to)))}function UW(e){let t=zW.parse(e);return(e,n,r,i)=>{let{text:o,ranges:s}=t.instantiate(e.state,r),{main:a}=e.state.selection,l={changes:{from:r,to:i==a.from?a.to:i,insert:un.of(o)},scrollIntoView:!0,annotations:n?[eW.of(n),gr.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=WW(s,0)),s.some(e=>e.field>0)){let t=new HW(s,0),n=l.effects=[qW.of(t)];void 0===e.state.field($W,!1)&&n.push(mr.appendConfig.of([$W,YW,XW,RW]))}e.dispatch(e.state.update(l))}}function KW(e){return({state:t,dispatch:n})=>{let r=t.field($W,!1);if(!r||e<0&&0==r.active)return!1;let i=r.active+e,o=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:WW(r.ranges,i),effects:qW.of(o?null:new HW(r.ranges,i)),scrollIntoView:!0})),!0}}const GW=[{key:"Tab",run:KW(1),shift:KW(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field($W,!1)&&(t(e.update({effects:qW.of(null)})),!0)}],JW=Vn.define({combine:e=>e.length?e[0]:GW}),YW=Zn.highest(yl.compute([JW],e=>e.facet(JW)));const XW=hl.domEventHandlers({mousedown(e,t){let n,r=t.state.field($W,!1);if(!r||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let i=r.ranges.find(e=>e.from<=n&&e.to>=n);return!(!i||i.field==r.active)&&(t.dispatch({selection:WW(r.ranges,i.field),effects:qW.of(r.ranges.some(e=>e.field>i.field)?new HW(r.ranges,i.field):null),scrollIntoView:!0}),!0)}}),ZW={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},QW=mr.define({map(e,t){let n=t.mapPos(e,-1,Tn.TrackAfter);return null==n?void 0:n}}),eU=new class extends Nr{};eU.startSide=1,eU.endSide=-1;const tU=Un.define({create:()=>_r.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(QW)&&(e=e.update({add:[eU.range(n.value,n.value+1)]}));return e}});const nU="()[]{}<>«»»«[]{}";function rU(e){for(let t=0;t<16;t+=2)if(nU.charCodeAt(t)==e)return nU.charAt(t+1);return Sn(e<128?e:e+1)}function iU(e,t){return e.languageDataAt("closeBrackets",t)[0]||ZW}const oU="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),sU=hl.inputHandler.of((e,t,n,r)=>{if((oU?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==Cn(kn(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=iU(e,e.selection.main.head),r=n.brackets||ZW.brackets;for(let i of r){let o=rU(kn(i,0));if(t==i)return o==i?dU(e,i,r.indexOf(i+i+i)>-1,n):hU(e,i,o,n.before||ZW.before);if(t==o&&lU(e,e.selection.main.from))return uU(e,i,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),aU=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=iU(e,e.selection.main.head).brackets||ZW.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return Cn(kn(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&cU(e.doc,t.head)==rU(kn(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:Ln.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function lU(e,t){let n=!1;return e.field(tU).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function cU(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Cn(kn(n,0)))}function hU(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:QW.of(o.to+t.length),range:Ln.range(o.anchor+t.length,o.head+t.length)};let s=cU(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:QW.of(o.head+t.length),range:Ln.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function uU(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&cU(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Ln.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function dU(e,t,n,r){let i=r.stringPrefixes||ZW.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:QW.of(r.to+t.length),range:Ln.range(r.anchor+t.length,r.head+t.length)};let s,a=r.head,l=cU(e.doc,a);if(l==t){if(pU(e,a))return{changes:{insert:t+t,from:a},effects:QW.of(a+t.length),range:Ln.cursor(a+t.length)};if(lU(e,a)){let r=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+r.length,insert:r},range:Ln.cursor(a+r.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=fU(e,a-2*t.length,i))>-1&&pU(e,s))return{changes:{insert:t+t+t+t,from:a},effects:QW.of(a+t.length),range:Ln.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=Sr.Word&&fU(e,a,i)>-1&&!function(e,t,n,r){let i=_h(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,a,t,i))return{changes:{insert:t+t,from:a},effects:QW.of(a+t.length),range:Ln.cursor(a+t.length)}}return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function pU(e,t){let n=_h(e).resolveInner(t+1);return n.parent&&n.from==t}function fU(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Sr.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=Sr.Word)return n}return-1}function mU(e={}){return[PW,TW,lW.of(e),IW,vU,RW]}const gU=[{key:"Ctrl-Space",run:EW},{mac:"Alt-`",run:EW},{mac:"Alt-i",run:EW},{key:"Escape",run:e=>{let t=e.state.field(TW,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:oW.of(null)}),!0)}},{key:"ArrowDown",run:NW(!0)},{key:"ArrowUp",run:NW(!1)},{key:"PageDown",run:NW(!0,"page")},{key:"PageUp",run:NW(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(TW,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(lW).interactionDelay)&&AW(e,t.open.options[t.open.selected])}}],vU=Zn.highest(yl.computeN([lW],e=>e.facet(lW).defaultKeymap?[gU]:[]));class yU{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class wU{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(EU).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Pr,s=[],a=0,l=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>h)break;n=r.to,s.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from!=t||!(r.to>r.from||r.to==t)){n=Math.min(r.from,n);break}s.push(r),e++,n=Math.min(r.to,n)}n=Math.min(n,h);let u=!1;if(s.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=FU(s);if(u)o.add(t,t,ho.widget({widget:new PU(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");o.add(t,n,ho.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if(a=n,a==h)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let u=o.finish();return new wU(u,t,bU(u))}}function bU(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(r){if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new yU(r.from,n,r.diagnostic)}else r=new yU(e,n,t||i.diagnostics[0])}),r}const xU=mr.define(),kU=mr.define(),SU=mr.define(),CU=Un.define({create:()=>new wU(ho.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=bU(n,e.selected.diagnostic,i)||bU(n,null,i)}!n.size&&i&&t.state.facet(EU).autoPanel&&(i=null),e=new wU(n,i,r)}for(let n of t.effects)if(n.is(xU)){let r=t.state.facet(EU).autoPanel?n.value.length?LU.open:null:e.panel;e=wU.init(n.value,r,t.state)}else n.is(kU)?e=new wU(e.diagnostics,n.value?LU.open:null,e.selected):n.is(SU)&&(e=new wU(e.diagnostics,e.panel,n.value));return e},provide:e=>[Nc.from(e,e=>e.panel),hl.decorations.from(e,e=>e.diagnostics)]}),MU=ho.mark({class:"cm-lintRange cm-lintRange-active"});function TU(e,t,n){let r,{diagnostics:i}=e.state.field(CU),o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(e,i,{spec:a})=>{if(t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t<i||n<0)))return r=a.diagnostics,o=e,s=i,!1});let a=e.state.facet(EU).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:AU(e,r)})}:null}function AU(e,t){return si("ul",{class:"cm-tooltip-lint"},t.map(t=>_U(e,t,!1)))}const OU=e=>{let t=e.state.field(CU,!1);return!(!t||!t.panel)&&(e.dispatch({effects:kU.of(!1)}),!0)},NU=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(CU,!1);var n,r;t&&t.panel||e.dispatch({effects:(n=e.state,r=[kU.of(!0)],n.field(CU,!1)?r:r.concat(mr.appendConfig.of(HU)))});let i=Mc(e,LU.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(CU,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!(!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],EU=Vn.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...Or(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:DU,tooltipFilter:DU,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function DU(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function IU(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function _U(e,t,n){var r;let i=n?IU(t.actions):[];return si("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},si("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=bU(e.state.field(CU).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,c=l<0?a:[a.slice(0,l),si("u",a.slice(l,l+1)),a.slice(l+1)];return si("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&si("div",{class:"cm-diagnosticSource"},t.source))}class PU extends lo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return si("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class RU{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=_U(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class LU{constructor(e){this.view=e,this.items=[];this.list=si("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)OU(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],r=IU(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=bU(this.view.state.field(CU).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=si("div",{class:"cm-panel-lint"},this.list,si("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>OU(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(CU).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(CU),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new RU(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),i=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new RU(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=bU(this.view.state.field(CU).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:SU.of(t)})}static open(e){return new LU(e)}}function BU(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const zU=hl.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:BU("#d11")},".cm-lintRange-warning":{backgroundImage:BU("orange")},".cm-lintRange-info":{backgroundImage:BU("#999")},".cm-lintRange-hint":{backgroundImage:BU("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function VU(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function FU(e){let t="hint",n=1;for(let r of e){let e=VU(r.severity);e>n&&(n=e,t=r.severity)}return t}const HU=[CU,hl.decorations.compute([CU],e=>{let{selected:t,panel:n}=e.field(CU);return t&&n&&t.from!=t.to?ho.set([MU.range(t.from,t.to)]):ho.none}),xc(TU,{hideOn:function(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(EU).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(xU))&&!e.changes.touchesRange(o.from,Math.max(o.to,r)))}}),zU],qU=(()=>[Yc(),Qc,Gl(),KH(),Au(),Il(),[Vl,Fl],Ar.allowMultipleSelections.of(!0),Ar.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=Jh(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=Gh(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e}),_u(Lu,{fallback:!0}),Wu(),[sU,tU],mU(),hl.mouseSelectionStyle.of((e,t)=>{return(n=t).altKey&&0==n.button?nc(e,t):null;var n}),oc(),Ql,[u$,h$],yl.of([...aU,...aj,...F$,...hq,...yu,...gU,...NU])])();function jU(e){return function(e){return 1===e.nodeType}(e)&&"http://www.w3.org/1999/xhtml"===e.namespaceURI}function $U(e,t){let n,r,i=[];const o=()=>{const t=e.dom.getBoundingClientRect(),o=e.state.doc;return i&&n&&r&&t.width===r.width&&t.height===r.height&&t.x===r.x&&t.y===r.y&&n.eq(o)||(r=t,n=o,i=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){const[r,i]=t.pop();if(r>=0){let t=e.nodeDOM(r);if(t&&jU(t)){let{top:e,bottom:o,left:s,right:a}=t.getBoundingClientRect();n.push([r,[s,e,a,e]],[r+i.nodeSize,[s,o,a,o]])}}if(i.isBlock&&!i.isTextblock){let e=r+1;for(let n of i.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)),i},s=(n,r)=>{if(!e.editable||e.isDestroyed)return;let i=o();i.sort((e,t)=>{const[r,i]=e,[o,s]=t;return UU(n,i)-UU(n,s)||r-o}),i=i.slice(0,8);const s=i.find(n=>!1!==t?.({view:e,pos:n[0],event:r}));return s&&function(e,t){const n=e.dragging;if(!n)return;const{move:r}=n;if(!r)return;const i=e.state.selection;if(!(i instanceof _f))return;const{from:o,to:s}=i;return o<=t&&t<=s}(e,s[0])?void 0:s};let a,l;return(e,t)=>{return a&&(r=e,(n=a)[0]===r[0]&&n[1]===r[1])||(a=e,l=s(e,t)),l;var n,r}}function WU(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function UU(e,t){return Math.min(WU(e,[t[0],t[1]]),WU(e,[t[2],t[3]]))}function KU(e){let t;return new Uf({key:new Jf("prosekit-drop-indicator"),view:n=>(t=$U(n,e.onDrag),function(e,t,n){let r,i,o,s=e.dom,a=!1;const l=()=>{r&&clearTimeout(r),a=!1,r=setTimeout(()=>{a||n.onHide?.()},30)},c=r=>{a=!0;const{clientX:s,clientY:c}=r;if(i===s&&o===c)return;i=s,o=c;let h=t([s,c],r);if(h){const[t,[r,i,o,s]]=h,a={p1:{x:r,y:i},p2:{x:o,y:s}};n.onShow?.({view:e,pos:t,line:a})}else l()};s.addEventListener("dragover",c),s.addEventListener("dragend",l),s.addEventListener("drop",l),s.addEventListener("dragleave",l);return{destroy:()=>{s.removeEventListener("dragover",c),s.removeEventListener("dragend",l),s.removeEventListener("drop",l),s.removeEventListener("dragleave",l)}}}(n,t,e)),props:{handleDrop(e,n,r,i){if(!t)return!1;const o=t([n.clientX,n.clientY],n);if(!o)return!1;n.preventDefault();let s=o[0],a=e.state.tr;if(i){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let l=a.mapping.map(s),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,h=a.doc;if(c?a.replaceRangeWith(l,l,r.content.firstChild):a.replaceRange(l,l,r),a.doc.eq(h))return!0;let u=a.doc.resolve(l);if(c&&_f.isSelectable(r.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new _f(u));else{let t=a.mapping.map(s);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(function(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Df.between(t,n,r)}(e,u,a.doc.resolve(t)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})}class GU extends Af{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return GU.valid(n)?new GU(n):Af.near(n)}content(){return Bd.empty}eq(e){return e instanceof GU&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new GU(e.resolve(t.pos))}getBookmark(){return new JU(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||YU(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||YU(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&GU.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(GU.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!_f.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue e}break}i=o,r+=t;let s=e.doc.resolve(r);if(GU.valid(s))return s}return null}}}GU.prototype.visible=!1,GU.findFrom=GU.findGapCursorFrom,Af.jsonID("gapcursor",GU);class JU{constructor(e){this.pos=e}map(e){return new JU(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return GU.valid(t)?new GU(t):Af.near(t)}}function YU(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const XU=$b({ArrowLeft:ZU("horiz",-1),ArrowRight:ZU("horiz",1),ArrowUp:ZU("vert",-1),ArrowDown:ZU("vert",1)});function ZU(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,a=o.empty;if(o instanceof Df){if(!i.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=GU.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new GU(l))),!0)}}function QU(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!GU.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&_f.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new GU(r))),!0)}function eK(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof GU))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Dd.empty;for(let e=r.length-1;e>=0;e--)i=Dd.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new Bd(i,0,0));return o.setSelection(Df.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function tK(e){if(!(e.selection instanceof GU))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ES.create(e.doc,[AS.widget(e.selection.head,t,{key:"gapcursor"})])}function nK(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}const rK=CM(null,"dropIndicatorState");nK(rK,{displayName:"Ctx<dropIndicatorState>"});const iK=CM({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");nK(iK,{displayName:"Ctx<dropIndicatorConfig>"});const oK=new Jf("MILKDOWN_DROP_INDICATOR_DOM"),sK=xM(e=>new Uf({key:oK,view:t=>{const n=e.get(iK.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(r);const i=e.use(rK.key),o=e=>{!function(e,t,n){if(!t)return void Object.assign(e.style,{display:"none"});const{line:r}=t,{width:i}=n,{p1:{x:o,y:s},p2:{x:a,y:l}}=r;let c,h,u=s,d=o;s===l?(c=a-o,h=i,u-=i/2):(c=i,h=l-s,d-=i/2);u=Math.round(u),d=Math.round(d),Object.assign(e.style,{display:"block",width:`${c}px`,height:`${h}px`,transform:`translate(${d}px, ${u}px)`})}(r,e,n)};return i.on(o),{destroy:()=>{i.off(o),r.remove()}}}}));nK(sK,{displayName:"Prose<dropIndicatorDOM>"});const aK=xM(e=>KU({onShow:t=>{e.set(rK.key,t)},onHide:()=>{e.set(rK.key,null)},onDrag:()=>!0}));nK(aK,{displayName:"Prose<dropIndicator>"});const lK=xM(()=>new Uf({props:{decorations:tK,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&GU.valid(n)?new GU(n):null,handleClick:QU,handleKeyDown:XU,handleDOMEvents:{beforeinput:eK}}}));nK(lK,{displayName:"Prose<gapCursor>"});const cK=[lK,iK,rK,sK,aK].flat();function hK(e){const t=null!=void 0&&undefined;let n="undefined"==typeof document?null:document.createElement("div");return new Uf({key:uK,view:e=>{!0!==t&&function(e,t){for(const[n,r]of Object.entries(e.marks))!1!==r.spec.inclusive||t.includes(n)||console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${n}" mark or adding it to the "skipWarning" option.`)}(e.state.schema,t||[]);const r=e.dom.ownerDocument;n=n||document.createElement("div");const i=n,o=()=>{!function(e,t){if(!e||!e.dom||e.isDestroyed||!t)return;const{state:n,dom:r}=e,{selection:i}=n;if(!pK(i))return;const o=function(e,t){var n;const r=window.getSelection();if(!r||!r.rangeCount)return null;const i=null==(n=null==r?void 0:r.getRangeAt(0))?void 0:n.cloneRange();if(!i)return null;i.collapse(t);const o=i.getClientRects(),s=(null==o?void 0:o.length)?o[o.length-1]:null;return(null==s?void 0:s.height)?s:e.coordsAtPos(e.state.selection.head)}(e,i.$head===i.$from);if(!o)return t;const s=r.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=n.selection.$head,[c,h]=dK(l),u=n.storedMarks||l.marks();i.$cursor&&c&&h&&u&&!Rd.sameSet(c,h)&&(Rd.sameSet(c,u)?a+=" prosemirror-virtual-cursor-left":Rd.sameSet(h,u)&&(a+=" prosemirror-virtual-cursor-right"));t.className=a,function(e,t){e.classList.remove(t),e.offsetWidth,e.classList.add(t)}(t,"prosemirror-virtual-cursor-animation"),t.style.height=o.bottom-o.top+"px",t.style.left=o.left-s.left+"px",t.style.top=o.top-s.top+"px"}(e,i)};let s;return window.ResizeObserver&&(s=new window.ResizeObserver(()=>o()),s.observe(e.dom)),r.addEventListener("selectionchange",o),{update:()=>{o()},destroy:()=>{r.removeEventListener("selectionchange",o),s&&s.unobserve(e.dom)}}},props:{handleKeyDown:(e,t)=>{var n;const{selection:r}=e.state;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.isComposing||!["ArrowLeft","ArrowRight"].includes(t.key)||!pK(r)||!r.empty)return!1;const i=r.$head,[o,s]=dK(i),a=e.state.storedMarks||i.marks();if(o&&s&&!Rd.sameSet(o,s)){if("ArrowLeft"===t.key&&!Rd.sameSet(o,a))return e.dispatch(e.state.tr.setStoredMarks(o)),!0;if("ArrowRight"===t.key&&!Rd.sameSet(s,a))return e.dispatch(e.state.tr.setStoredMarks(s)),!0}return"ArrowLeft"===t.key&&1===i.textOffset?(e.dispatch(e.state.tr.setSelection(Df.create(e.state.doc,i.pos-1)).setStoredMarks(i.marks())),!0):"ArrowRight"===t.key&&i.textOffset+1===(null==(n=i.parent.maybeChild(i.index()))?void 0:n.nodeSize)&&(e.dispatch(e.state.tr.setSelection(Df.create(e.state.doc,i.pos+1)).setStoredMarks(i.marks())),!0)},decorations:e=>{if(n&&pK(e.selection)&&e.selection.empty)return ES.create(e.doc,[AS.widget(0,n,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var uK=new Jf("prosemirror-virtual-cursor");function dK(e){const t=e.index(),n=e.parent.maybeChild(t);let r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[null==r?void 0:r.marks,null==n?void 0:n.marks]}function pK(e){return e&&"object"==typeof e&&"$cursor"in e}var fK=Object.defineProperty,mK=Object.getOwnPropertySymbols,gK=Object.prototype.hasOwnProperty,vK=Object.prototype.propertyIsEnumerable,yK=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wK=(e,t)=>{for(var n in t||(t={}))gK.call(t,n)&&yK(e,n,t[n]);if(mK)for(var n of mK(t))vK.call(t,n)&&yK(e,n,t[n]);return e};function bK(e,t){return Object.assign(e,{meta:wK({package:"@milkdown/components"},t)}),e}const xK=CM({imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");function kK({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}bK(xK,{displayName:"Config<image-inline>",group:"ImageInline"}),kK.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const SK=oB("abcdefg",8),CK=BI({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:s,uploadPlaceholderText:a,className:l}){var c,h;const u=MD(!1),d=MD(),p=MD(null!=(c=t.value)?c:""),f=MD(SK()),m=MD(0!==(null==(h=t.value)?void 0:h.length)),g=e=>{const t=e.target.value;m.value=0!==t.length,p.value=t},v=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=d.value)?void 0:t.value)?r:"")},y=e=>{var t;const i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),m.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>vR("div",{class:ZR("image-edit",l)},vR(kK,{icon:i,class:"image-icon"}),vR("div",{class:ZR("link-importer",u.value&&"focus")},vR("input",{ref:d,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:p.value,onInput:g,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!m.value&&vR("div",{class:"placeholder"},vR("input",{disabled:e.value,class:"hidden",id:f.value,type:"file",accept:"image/*",onChange:y}),vR("label",{class:"uploader",for:f.value},vR(kK,{icon:o})),vR("span",{class:"text",onClick:()=>{var e;return null==(e=d.value)?void 0:e.focus()}},a))),p.value&&vR("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=d.value)?void 0:e.value)?t:"")}},vR(kK,{icon:s})))}}),MK=BI({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t,alt:n,title:r}=e;return()=>{var i;return(null==(i=t.value)?void 0:i.length)?vR("img",{class:"image-inline",src:t.value,alt:n.value,title:r.value}):vR(CK,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),TK=SM(iO.node,e=>(t,n,r)=>{const i=MD(t.attrs.src),o=MD(t.attrs.alt),s=MD(t.attrs.title),a=MD(!1),l=MD(!n.editable),c=e.get(xK.key),h=JR(MK,{src:i,alt:o,title:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?nB.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";const d=__(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;o.value=e.attrs.alt,s.value=e.attrs.title};return f(t),h.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{d(),h.unmount(),u.remove()}}});bK(TK,{displayName:"NodeView<image-inline>",group:"ImageInline"});const AK=[xK,TK];class OK{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new OK(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class NK{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new NK(t,OK.range(this,e))}}class EK{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n,r,i="KaTeX parse error: "+e,o=t&&t.loc;if(o&&o.start<=o.end){var s=o.lexer.input;n=o.start,r=o.end,n===s.length?i+=" at end of input: ":i+=" at position "+(n+1)+": ";var a=s.slice(n,r).replace(/[^]/g,"$&̲");i+=(n>15?"…"+s.slice(n-15,n):s.slice(0,n))+a+(r+15<s.length?s.slice(r,r+15)+"…":s.slice(r))}var l=new Error(i);return l.name="ParseError",l.__proto__=EK.prototype,l.position=n,null!=n&&null!=r&&(l.length=r-n),l.rawMessage=e,l}}EK.prototype.__proto__=Error.prototype;var DK=/([A-Z])/g,IK={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},_K=/[&><"']/g;var PK=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},RK={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(_K,e=>IK[e])},hyphenate:function(e){return e.replace(DK,"-$1").toLowerCase()},getBaseElem:PK,isCharacterBox:function(e){var t=PK(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"}},LK={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function BK(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class zK{constructor(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},LK)if(LK.hasOwnProperty(t)){var n=LK[t];this[t]=void 0!==e[t]?n.processor?n.processor(e[t]):e[t]:BK(n)}}reportNonstrict(e,t,n){var r=this.strict;if("function"==typeof r&&(r=r(e,t,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new EK("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n);"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]")}}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(e){r="error"}return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){if(e.url&&!e.protocol){var t=RK.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}var n="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(n)}}class VK{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return FK[HK[this.id]]}sub(){return FK[qK[this.id]]}fracNum(){return FK[jK[this.id]]}fracDen(){return FK[$K[this.id]]}cramp(){return FK[WK[this.id]]}text(){return FK[UK[this.id]]}isTight(){return this.size>=2}}var FK=[new VK(0,0,!1),new VK(1,0,!0),new VK(2,1,!1),new VK(3,1,!0),new VK(4,2,!1),new VK(5,2,!0),new VK(6,3,!1),new VK(7,3,!0)],HK=[4,5,4,5,6,7,6,7],qK=[5,5,5,5,7,7,7,7],jK=[2,3,4,5,6,7,6,7],$K=[3,3,5,5,7,7,7,7],WK=[1,1,3,3,5,5,7,7],UK=[0,1,2,3,2,3,2,3],KK={DISPLAY:FK[0],TEXT:FK[2],SCRIPT:FK[4],SCRIPTSCRIPT:FK[6]},GK=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var JK=[];function YK(e){for(var t=0;t<JK.length;t+=2)if(e>=JK[t]&&e<=JK[t+1])return!0;return!1}GK.forEach(e=>e.blocks.forEach(e=>JK.push(...e)));var XK=80,ZK={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};class QK{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>e.toText()).join("")}}var eG={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},tG={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},nG={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function rG(e,t,n){if(!eG[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),i=eG[t][r];if(!i&&e[0]in nG&&(r=nG[e[0]].charCodeAt(0),i=eG[t][r]),i||"text"!==n||YK(r)&&(i=eG[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var iG={};var oG=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sG=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],aG=function(e,t){return t.size<2?e:oG[e-1][t.size-1]};class lG{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||lG.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sG[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new lG(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:aG(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sG[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=aG(lG.BASESIZE,e);return this.size===t&&this.textSize===lG.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==lG.BASESIZE?["sizing","reset-size"+this.size,"size"+lG.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!iG[t=e>=5?0:e>=3?1:2]){var n=iG[t]={cssEmPerMu:tG.quad[t]/18};for(var r in tG)tG.hasOwnProperty(r)&&(n[r]=tG[r][t])}return iG[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}lG.BASESIZE=6;var cG={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},hG={ex:!0,em:!0,mu:!0},uG=function(e){return"string"!=typeof e&&(e=e.unit),e in cG||e in hG||"ex"===e},dG=function(e,t){var n;if(e.unit in cG)n=cG[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)n=t.fontMetrics().cssEmPerMu;else{var r;if(r=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)n=r.fontMetrics().xHeight;else{if("em"!==e.unit)throw new EK("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},pG=function(e){return+e.toFixed(4)+"em"},fG=function(e){return e.filter(e=>e).join(" ")},mG=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},gG=function(e){var t=document.createElement(e);for(var n in t.className=fG(this.classes),this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var r in this.attributes)this.attributes.hasOwnProperty(r)&&t.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t},vG=/[\s"'>/=\x00-\x1f]/,yG=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+RK.escape(fG(this.classes))+'"');var n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=RK.hyphenate(r)+":"+this.style[r]+";");for(var i in n&&(t+=' style="'+RK.escape(n)+'"'),this.attributes)if(this.attributes.hasOwnProperty(i)){if(vG.test(i))throw new EK("Invalid attribute name '"+i+"'");t+=" "+i+'="'+RK.escape(this.attributes[i])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">"};class wG{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,mG.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return gG.call(this,"span")}toMarkup(){return yG.call(this,"span")}}class bG{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,mG.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return gG.call(this,"a")}toMarkup(){return yG.call(this,"a")}}class xG{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+RK.escape(this.src)+'" alt="'+RK.escape(this.alt)+'"',t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=RK.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+RK.escape(t)+'"'),e+="'/>"}}var kG={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class SG{constructor(e,t,n,r,i,o,s,a){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=s||[],this.style=a||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<GK.length;t++)for(var n=GK[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=kG[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;for(var n in this.italic>0&&((t=document.createElement("span")).style.marginRight=pG(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=fG(this.classes)),this.style)this.style.hasOwnProperty(n)&&((t=t||document.createElement("span")).style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=RK.escape(fG(this.classes)),t+='"');var n="";for(var r in this.italic>0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=RK.hyphenate(r)+":"+this.style[r]+";");n&&(e=!0,t+=' style="'+RK.escape(n)+'"');var i=RK.escape(this.text);return e?(t+=">",t+=i,t+="</span>"):i}}class CG{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+RK.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class MG{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",ZK[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+RK.escape(this.alternate)+'"/>':'<path d="'+RK.escape(ZK[this.pathName])+'"/>'}}class TG{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+RK.escape(this.attributes[t])+'"');return e+="/>"}}function AG(e){if(e instanceof SG)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var OG={bin:1,close:1,inner:1,open:1,punct:1,rel:1},NG={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},EG={math:{},text:{}};function DG(e,t,n,r,i,o){EG[e][i]={font:t,group:n,replace:r},o&&r&&(EG[e][r]=EG[e][i])}var IG="math",_G="text",PG="main",RG="ams",LG="accent-token",BG="bin",zG="close",VG="inner",FG="mathord",HG="op-token",qG="open",jG="punct",$G="rel",WG="spacing",UG="textord";DG(IG,PG,$G,"≡","\\equiv",!0),DG(IG,PG,$G,"≺","\\prec",!0),DG(IG,PG,$G,"≻","\\succ",!0),DG(IG,PG,$G,"∼","\\sim",!0),DG(IG,PG,$G,"⊥","\\perp"),DG(IG,PG,$G,"⪯","\\preceq",!0),DG(IG,PG,$G,"⪰","\\succeq",!0),DG(IG,PG,$G,"≃","\\simeq",!0),DG(IG,PG,$G,"∣","\\mid",!0),DG(IG,PG,$G,"≪","\\ll",!0),DG(IG,PG,$G,"≫","\\gg",!0),DG(IG,PG,$G,"≍","\\asymp",!0),DG(IG,PG,$G,"∥","\\parallel"),DG(IG,PG,$G,"⋈","\\bowtie",!0),DG(IG,PG,$G,"⌣","\\smile",!0),DG(IG,PG,$G,"⊑","\\sqsubseteq",!0),DG(IG,PG,$G,"⊒","\\sqsupseteq",!0),DG(IG,PG,$G,"≐","\\doteq",!0),DG(IG,PG,$G,"⌢","\\frown",!0),DG(IG,PG,$G,"∋","\\ni",!0),DG(IG,PG,$G,"∝","\\propto",!0),DG(IG,PG,$G,"⊢","\\vdash",!0),DG(IG,PG,$G,"⊣","\\dashv",!0),DG(IG,PG,$G,"∋","\\owns"),DG(IG,PG,jG,".","\\ldotp"),DG(IG,PG,jG,"⋅","\\cdotp"),DG(IG,PG,UG,"#","\\#"),DG(_G,PG,UG,"#","\\#"),DG(IG,PG,UG,"&","\\&"),DG(_G,PG,UG,"&","\\&"),DG(IG,PG,UG,"ℵ","\\aleph",!0),DG(IG,PG,UG,"∀","\\forall",!0),DG(IG,PG,UG,"ℏ","\\hbar",!0),DG(IG,PG,UG,"∃","\\exists",!0),DG(IG,PG,UG,"∇","\\nabla",!0),DG(IG,PG,UG,"♭","\\flat",!0),DG(IG,PG,UG,"ℓ","\\ell",!0),DG(IG,PG,UG,"♮","\\natural",!0),DG(IG,PG,UG,"♣","\\clubsuit",!0),DG(IG,PG,UG,"℘","\\wp",!0),DG(IG,PG,UG,"♯","\\sharp",!0),DG(IG,PG,UG,"♢","\\diamondsuit",!0),DG(IG,PG,UG,"ℜ","\\Re",!0),DG(IG,PG,UG,"♡","\\heartsuit",!0),DG(IG,PG,UG,"ℑ","\\Im",!0),DG(IG,PG,UG,"♠","\\spadesuit",!0),DG(IG,PG,UG,"§","\\S",!0),DG(_G,PG,UG,"§","\\S"),DG(IG,PG,UG,"¶","\\P",!0),DG(_G,PG,UG,"¶","\\P"),DG(IG,PG,UG,"†","\\dag"),DG(_G,PG,UG,"†","\\dag"),DG(_G,PG,UG,"†","\\textdagger"),DG(IG,PG,UG,"‡","\\ddag"),DG(_G,PG,UG,"‡","\\ddag"),DG(_G,PG,UG,"‡","\\textdaggerdbl"),DG(IG,PG,zG,"⎱","\\rmoustache",!0),DG(IG,PG,qG,"⎰","\\lmoustache",!0),DG(IG,PG,zG,"⟯","\\rgroup",!0),DG(IG,PG,qG,"⟮","\\lgroup",!0),DG(IG,PG,BG,"∓","\\mp",!0),DG(IG,PG,BG,"⊖","\\ominus",!0),DG(IG,PG,BG,"⊎","\\uplus",!0),DG(IG,PG,BG,"⊓","\\sqcap",!0),DG(IG,PG,BG,"∗","\\ast"),DG(IG,PG,BG,"⊔","\\sqcup",!0),DG(IG,PG,BG,"◯","\\bigcirc",!0),DG(IG,PG,BG,"∙","\\bullet",!0),DG(IG,PG,BG,"‡","\\ddagger"),DG(IG,PG,BG,"≀","\\wr",!0),DG(IG,PG,BG,"⨿","\\amalg"),DG(IG,PG,BG,"&","\\And"),DG(IG,PG,$G,"⟵","\\longleftarrow",!0),DG(IG,PG,$G,"⇐","\\Leftarrow",!0),DG(IG,PG,$G,"⟸","\\Longleftarrow",!0),DG(IG,PG,$G,"⟶","\\longrightarrow",!0),DG(IG,PG,$G,"⇒","\\Rightarrow",!0),DG(IG,PG,$G,"⟹","\\Longrightarrow",!0),DG(IG,PG,$G,"↔","\\leftrightarrow",!0),DG(IG,PG,$G,"⟷","\\longleftrightarrow",!0),DG(IG,PG,$G,"⇔","\\Leftrightarrow",!0),DG(IG,PG,$G,"⟺","\\Longleftrightarrow",!0),DG(IG,PG,$G,"↦","\\mapsto",!0),DG(IG,PG,$G,"⟼","\\longmapsto",!0),DG(IG,PG,$G,"↗","\\nearrow",!0),DG(IG,PG,$G,"↩","\\hookleftarrow",!0),DG(IG,PG,$G,"↪","\\hookrightarrow",!0),DG(IG,PG,$G,"↘","\\searrow",!0),DG(IG,PG,$G,"↼","\\leftharpoonup",!0),DG(IG,PG,$G,"⇀","\\rightharpoonup",!0),DG(IG,PG,$G,"↙","\\swarrow",!0),DG(IG,PG,$G,"↽","\\leftharpoondown",!0),DG(IG,PG,$G,"⇁","\\rightharpoondown",!0),DG(IG,PG,$G,"↖","\\nwarrow",!0),DG(IG,PG,$G,"⇌","\\rightleftharpoons",!0),DG(IG,RG,$G,"≮","\\nless",!0),DG(IG,RG,$G,"","\\@nleqslant"),DG(IG,RG,$G,"","\\@nleqq"),DG(IG,RG,$G,"⪇","\\lneq",!0),DG(IG,RG,$G,"≨","\\lneqq",!0),DG(IG,RG,$G,"","\\@lvertneqq"),DG(IG,RG,$G,"⋦","\\lnsim",!0),DG(IG,RG,$G,"⪉","\\lnapprox",!0),DG(IG,RG,$G,"⊀","\\nprec",!0),DG(IG,RG,$G,"⋠","\\npreceq",!0),DG(IG,RG,$G,"⋨","\\precnsim",!0),DG(IG,RG,$G,"⪹","\\precnapprox",!0),DG(IG,RG,$G,"≁","\\nsim",!0),DG(IG,RG,$G,"","\\@nshortmid"),DG(IG,RG,$G,"∤","\\nmid",!0),DG(IG,RG,$G,"⊬","\\nvdash",!0),DG(IG,RG,$G,"⊭","\\nvDash",!0),DG(IG,RG,$G,"⋪","\\ntriangleleft"),DG(IG,RG,$G,"⋬","\\ntrianglelefteq",!0),DG(IG,RG,$G,"⊊","\\subsetneq",!0),DG(IG,RG,$G,"","\\@varsubsetneq"),DG(IG,RG,$G,"⫋","\\subsetneqq",!0),DG(IG,RG,$G,"","\\@varsubsetneqq"),DG(IG,RG,$G,"≯","\\ngtr",!0),DG(IG,RG,$G,"","\\@ngeqslant"),DG(IG,RG,$G,"","\\@ngeqq"),DG(IG,RG,$G,"⪈","\\gneq",!0),DG(IG,RG,$G,"≩","\\gneqq",!0),DG(IG,RG,$G,"","\\@gvertneqq"),DG(IG,RG,$G,"⋧","\\gnsim",!0),DG(IG,RG,$G,"⪊","\\gnapprox",!0),DG(IG,RG,$G,"⊁","\\nsucc",!0),DG(IG,RG,$G,"⋡","\\nsucceq",!0),DG(IG,RG,$G,"⋩","\\succnsim",!0),DG(IG,RG,$G,"⪺","\\succnapprox",!0),DG(IG,RG,$G,"≆","\\ncong",!0),DG(IG,RG,$G,"","\\@nshortparallel"),DG(IG,RG,$G,"∦","\\nparallel",!0),DG(IG,RG,$G,"⊯","\\nVDash",!0),DG(IG,RG,$G,"⋫","\\ntriangleright"),DG(IG,RG,$G,"⋭","\\ntrianglerighteq",!0),DG(IG,RG,$G,"","\\@nsupseteqq"),DG(IG,RG,$G,"⊋","\\supsetneq",!0),DG(IG,RG,$G,"","\\@varsupsetneq"),DG(IG,RG,$G,"⫌","\\supsetneqq",!0),DG(IG,RG,$G,"","\\@varsupsetneqq"),DG(IG,RG,$G,"⊮","\\nVdash",!0),DG(IG,RG,$G,"⪵","\\precneqq",!0),DG(IG,RG,$G,"⪶","\\succneqq",!0),DG(IG,RG,$G,"","\\@nsubseteqq"),DG(IG,RG,BG,"⊴","\\unlhd"),DG(IG,RG,BG,"⊵","\\unrhd"),DG(IG,RG,$G,"↚","\\nleftarrow",!0),DG(IG,RG,$G,"↛","\\nrightarrow",!0),DG(IG,RG,$G,"⇍","\\nLeftarrow",!0),DG(IG,RG,$G,"⇏","\\nRightarrow",!0),DG(IG,RG,$G,"↮","\\nleftrightarrow",!0),DG(IG,RG,$G,"⇎","\\nLeftrightarrow",!0),DG(IG,RG,$G,"△","\\vartriangle"),DG(IG,RG,UG,"ℏ","\\hslash"),DG(IG,RG,UG,"▽","\\triangledown"),DG(IG,RG,UG,"◊","\\lozenge"),DG(IG,RG,UG,"Ⓢ","\\circledS"),DG(IG,RG,UG,"®","\\circledR"),DG(_G,RG,UG,"®","\\circledR"),DG(IG,RG,UG,"∡","\\measuredangle",!0),DG(IG,RG,UG,"∄","\\nexists"),DG(IG,RG,UG,"℧","\\mho"),DG(IG,RG,UG,"Ⅎ","\\Finv",!0),DG(IG,RG,UG,"⅁","\\Game",!0),DG(IG,RG,UG,"‵","\\backprime"),DG(IG,RG,UG,"▲","\\blacktriangle"),DG(IG,RG,UG,"▼","\\blacktriangledown"),DG(IG,RG,UG,"■","\\blacksquare"),DG(IG,RG,UG,"⧫","\\blacklozenge"),DG(IG,RG,UG,"★","\\bigstar"),DG(IG,RG,UG,"∢","\\sphericalangle",!0),DG(IG,RG,UG,"∁","\\complement",!0),DG(IG,RG,UG,"ð","\\eth",!0),DG(_G,PG,UG,"ð","ð"),DG(IG,RG,UG,"╱","\\diagup"),DG(IG,RG,UG,"╲","\\diagdown"),DG(IG,RG,UG,"□","\\square"),DG(IG,RG,UG,"□","\\Box"),DG(IG,RG,UG,"◊","\\Diamond"),DG(IG,RG,UG,"¥","\\yen",!0),DG(_G,RG,UG,"¥","\\yen",!0),DG(IG,RG,UG,"✓","\\checkmark",!0),DG(_G,RG,UG,"✓","\\checkmark"),DG(IG,RG,UG,"ℶ","\\beth",!0),DG(IG,RG,UG,"ℸ","\\daleth",!0),DG(IG,RG,UG,"ℷ","\\gimel",!0),DG(IG,RG,UG,"ϝ","\\digamma",!0),DG(IG,RG,UG,"ϰ","\\varkappa"),DG(IG,RG,qG,"┌","\\@ulcorner",!0),DG(IG,RG,zG,"┐","\\@urcorner",!0),DG(IG,RG,qG,"└","\\@llcorner",!0),DG(IG,RG,zG,"┘","\\@lrcorner",!0),DG(IG,RG,$G,"≦","\\leqq",!0),DG(IG,RG,$G,"⩽","\\leqslant",!0),DG(IG,RG,$G,"⪕","\\eqslantless",!0),DG(IG,RG,$G,"≲","\\lesssim",!0),DG(IG,RG,$G,"⪅","\\lessapprox",!0),DG(IG,RG,$G,"≊","\\approxeq",!0),DG(IG,RG,BG,"⋖","\\lessdot"),DG(IG,RG,$G,"⋘","\\lll",!0),DG(IG,RG,$G,"≶","\\lessgtr",!0),DG(IG,RG,$G,"⋚","\\lesseqgtr",!0),DG(IG,RG,$G,"⪋","\\lesseqqgtr",!0),DG(IG,RG,$G,"≑","\\doteqdot"),DG(IG,RG,$G,"≓","\\risingdotseq",!0),DG(IG,RG,$G,"≒","\\fallingdotseq",!0),DG(IG,RG,$G,"∽","\\backsim",!0),DG(IG,RG,$G,"⋍","\\backsimeq",!0),DG(IG,RG,$G,"⫅","\\subseteqq",!0),DG(IG,RG,$G,"⋐","\\Subset",!0),DG(IG,RG,$G,"⊏","\\sqsubset",!0),DG(IG,RG,$G,"≼","\\preccurlyeq",!0),DG(IG,RG,$G,"⋞","\\curlyeqprec",!0),DG(IG,RG,$G,"≾","\\precsim",!0),DG(IG,RG,$G,"⪷","\\precapprox",!0),DG(IG,RG,$G,"⊲","\\vartriangleleft"),DG(IG,RG,$G,"⊴","\\trianglelefteq"),DG(IG,RG,$G,"⊨","\\vDash",!0),DG(IG,RG,$G,"⊪","\\Vvdash",!0),DG(IG,RG,$G,"⌣","\\smallsmile"),DG(IG,RG,$G,"⌢","\\smallfrown"),DG(IG,RG,$G,"≏","\\bumpeq",!0),DG(IG,RG,$G,"≎","\\Bumpeq",!0),DG(IG,RG,$G,"≧","\\geqq",!0),DG(IG,RG,$G,"⩾","\\geqslant",!0),DG(IG,RG,$G,"⪖","\\eqslantgtr",!0),DG(IG,RG,$G,"≳","\\gtrsim",!0),DG(IG,RG,$G,"⪆","\\gtrapprox",!0),DG(IG,RG,BG,"⋗","\\gtrdot"),DG(IG,RG,$G,"⋙","\\ggg",!0),DG(IG,RG,$G,"≷","\\gtrless",!0),DG(IG,RG,$G,"⋛","\\gtreqless",!0),DG(IG,RG,$G,"⪌","\\gtreqqless",!0),DG(IG,RG,$G,"≖","\\eqcirc",!0),DG(IG,RG,$G,"≗","\\circeq",!0),DG(IG,RG,$G,"≜","\\triangleq",!0),DG(IG,RG,$G,"∼","\\thicksim"),DG(IG,RG,$G,"≈","\\thickapprox"),DG(IG,RG,$G,"⫆","\\supseteqq",!0),DG(IG,RG,$G,"⋑","\\Supset",!0),DG(IG,RG,$G,"⊐","\\sqsupset",!0),DG(IG,RG,$G,"≽","\\succcurlyeq",!0),DG(IG,RG,$G,"⋟","\\curlyeqsucc",!0),DG(IG,RG,$G,"≿","\\succsim",!0),DG(IG,RG,$G,"⪸","\\succapprox",!0),DG(IG,RG,$G,"⊳","\\vartriangleright"),DG(IG,RG,$G,"⊵","\\trianglerighteq"),DG(IG,RG,$G,"⊩","\\Vdash",!0),DG(IG,RG,$G,"∣","\\shortmid"),DG(IG,RG,$G,"∥","\\shortparallel"),DG(IG,RG,$G,"≬","\\between",!0),DG(IG,RG,$G,"⋔","\\pitchfork",!0),DG(IG,RG,$G,"∝","\\varpropto"),DG(IG,RG,$G,"◀","\\blacktriangleleft"),DG(IG,RG,$G,"∴","\\therefore",!0),DG(IG,RG,$G,"∍","\\backepsilon"),DG(IG,RG,$G,"▶","\\blacktriangleright"),DG(IG,RG,$G,"∵","\\because",!0),DG(IG,RG,$G,"⋘","\\llless"),DG(IG,RG,$G,"⋙","\\gggtr"),DG(IG,RG,BG,"⊲","\\lhd"),DG(IG,RG,BG,"⊳","\\rhd"),DG(IG,RG,$G,"≂","\\eqsim",!0),DG(IG,PG,$G,"⋈","\\Join"),DG(IG,RG,$G,"≑","\\Doteq",!0),DG(IG,RG,BG,"∔","\\dotplus",!0),DG(IG,RG,BG,"∖","\\smallsetminus"),DG(IG,RG,BG,"⋒","\\Cap",!0),DG(IG,RG,BG,"⋓","\\Cup",!0),DG(IG,RG,BG,"⩞","\\doublebarwedge",!0),DG(IG,RG,BG,"⊟","\\boxminus",!0),DG(IG,RG,BG,"⊞","\\boxplus",!0),DG(IG,RG,BG,"⋇","\\divideontimes",!0),DG(IG,RG,BG,"⋉","\\ltimes",!0),DG(IG,RG,BG,"⋊","\\rtimes",!0),DG(IG,RG,BG,"⋋","\\leftthreetimes",!0),DG(IG,RG,BG,"⋌","\\rightthreetimes",!0),DG(IG,RG,BG,"⋏","\\curlywedge",!0),DG(IG,RG,BG,"⋎","\\curlyvee",!0),DG(IG,RG,BG,"⊝","\\circleddash",!0),DG(IG,RG,BG,"⊛","\\circledast",!0),DG(IG,RG,BG,"⋅","\\centerdot"),DG(IG,RG,BG,"⊺","\\intercal",!0),DG(IG,RG,BG,"⋒","\\doublecap"),DG(IG,RG,BG,"⋓","\\doublecup"),DG(IG,RG,BG,"⊠","\\boxtimes",!0),DG(IG,RG,$G,"⇢","\\dashrightarrow",!0),DG(IG,RG,$G,"⇠","\\dashleftarrow",!0),DG(IG,RG,$G,"⇇","\\leftleftarrows",!0),DG(IG,RG,$G,"⇆","\\leftrightarrows",!0),DG(IG,RG,$G,"⇚","\\Lleftarrow",!0),DG(IG,RG,$G,"↞","\\twoheadleftarrow",!0),DG(IG,RG,$G,"↢","\\leftarrowtail",!0),DG(IG,RG,$G,"↫","\\looparrowleft",!0),DG(IG,RG,$G,"⇋","\\leftrightharpoons",!0),DG(IG,RG,$G,"↶","\\curvearrowleft",!0),DG(IG,RG,$G,"↺","\\circlearrowleft",!0),DG(IG,RG,$G,"↰","\\Lsh",!0),DG(IG,RG,$G,"⇈","\\upuparrows",!0),DG(IG,RG,$G,"↿","\\upharpoonleft",!0),DG(IG,RG,$G,"⇃","\\downharpoonleft",!0),DG(IG,PG,$G,"⊶","\\origof",!0),DG(IG,PG,$G,"⊷","\\imageof",!0),DG(IG,RG,$G,"⊸","\\multimap",!0),DG(IG,RG,$G,"↭","\\leftrightsquigarrow",!0),DG(IG,RG,$G,"⇉","\\rightrightarrows",!0),DG(IG,RG,$G,"⇄","\\rightleftarrows",!0),DG(IG,RG,$G,"↠","\\twoheadrightarrow",!0),DG(IG,RG,$G,"↣","\\rightarrowtail",!0),DG(IG,RG,$G,"↬","\\looparrowright",!0),DG(IG,RG,$G,"↷","\\curvearrowright",!0),DG(IG,RG,$G,"↻","\\circlearrowright",!0),DG(IG,RG,$G,"↱","\\Rsh",!0),DG(IG,RG,$G,"⇊","\\downdownarrows",!0),DG(IG,RG,$G,"↾","\\upharpoonright",!0),DG(IG,RG,$G,"⇂","\\downharpoonright",!0),DG(IG,RG,$G,"⇝","\\rightsquigarrow",!0),DG(IG,RG,$G,"⇝","\\leadsto"),DG(IG,RG,$G,"⇛","\\Rrightarrow",!0),DG(IG,RG,$G,"↾","\\restriction"),DG(IG,PG,UG,"‘","`"),DG(IG,PG,UG,"$","\\$"),DG(_G,PG,UG,"$","\\$"),DG(_G,PG,UG,"$","\\textdollar"),DG(IG,PG,UG,"%","\\%"),DG(_G,PG,UG,"%","\\%"),DG(IG,PG,UG,"_","\\_"),DG(_G,PG,UG,"_","\\_"),DG(_G,PG,UG,"_","\\textunderscore"),DG(IG,PG,UG,"∠","\\angle",!0),DG(IG,PG,UG,"∞","\\infty",!0),DG(IG,PG,UG,"′","\\prime"),DG(IG,PG,UG,"△","\\triangle"),DG(IG,PG,UG,"Γ","\\Gamma",!0),DG(IG,PG,UG,"Δ","\\Delta",!0),DG(IG,PG,UG,"Θ","\\Theta",!0),DG(IG,PG,UG,"Λ","\\Lambda",!0),DG(IG,PG,UG,"Ξ","\\Xi",!0),DG(IG,PG,UG,"Π","\\Pi",!0),DG(IG,PG,UG,"Σ","\\Sigma",!0),DG(IG,PG,UG,"Υ","\\Upsilon",!0),DG(IG,PG,UG,"Φ","\\Phi",!0),DG(IG,PG,UG,"Ψ","\\Psi",!0),DG(IG,PG,UG,"Ω","\\Omega",!0),DG(IG,PG,UG,"A","Α"),DG(IG,PG,UG,"B","Β"),DG(IG,PG,UG,"E","Ε"),DG(IG,PG,UG,"Z","Ζ"),DG(IG,PG,UG,"H","Η"),DG(IG,PG,UG,"I","Ι"),DG(IG,PG,UG,"K","Κ"),DG(IG,PG,UG,"M","Μ"),DG(IG,PG,UG,"N","Ν"),DG(IG,PG,UG,"O","Ο"),DG(IG,PG,UG,"P","Ρ"),DG(IG,PG,UG,"T","Τ"),DG(IG,PG,UG,"X","Χ"),DG(IG,PG,UG,"¬","\\neg",!0),DG(IG,PG,UG,"¬","\\lnot"),DG(IG,PG,UG,"⊤","\\top"),DG(IG,PG,UG,"⊥","\\bot"),DG(IG,PG,UG,"∅","\\emptyset"),DG(IG,RG,UG,"∅","\\varnothing"),DG(IG,PG,FG,"α","\\alpha",!0),DG(IG,PG,FG,"β","\\beta",!0),DG(IG,PG,FG,"γ","\\gamma",!0),DG(IG,PG,FG,"δ","\\delta",!0),DG(IG,PG,FG,"ϵ","\\epsilon",!0),DG(IG,PG,FG,"ζ","\\zeta",!0),DG(IG,PG,FG,"η","\\eta",!0),DG(IG,PG,FG,"θ","\\theta",!0),DG(IG,PG,FG,"ι","\\iota",!0),DG(IG,PG,FG,"κ","\\kappa",!0),DG(IG,PG,FG,"λ","\\lambda",!0),DG(IG,PG,FG,"μ","\\mu",!0),DG(IG,PG,FG,"ν","\\nu",!0),DG(IG,PG,FG,"ξ","\\xi",!0),DG(IG,PG,FG,"ο","\\omicron",!0),DG(IG,PG,FG,"π","\\pi",!0),DG(IG,PG,FG,"ρ","\\rho",!0),DG(IG,PG,FG,"σ","\\sigma",!0),DG(IG,PG,FG,"τ","\\tau",!0),DG(IG,PG,FG,"υ","\\upsilon",!0),DG(IG,PG,FG,"ϕ","\\phi",!0),DG(IG,PG,FG,"χ","\\chi",!0),DG(IG,PG,FG,"ψ","\\psi",!0),DG(IG,PG,FG,"ω","\\omega",!0),DG(IG,PG,FG,"ε","\\varepsilon",!0),DG(IG,PG,FG,"ϑ","\\vartheta",!0),DG(IG,PG,FG,"ϖ","\\varpi",!0),DG(IG,PG,FG,"ϱ","\\varrho",!0),DG(IG,PG,FG,"ς","\\varsigma",!0),DG(IG,PG,FG,"φ","\\varphi",!0),DG(IG,PG,BG,"∗","*",!0),DG(IG,PG,BG,"+","+"),DG(IG,PG,BG,"−","-",!0),DG(IG,PG,BG,"⋅","\\cdot",!0),DG(IG,PG,BG,"∘","\\circ",!0),DG(IG,PG,BG,"÷","\\div",!0),DG(IG,PG,BG,"±","\\pm",!0),DG(IG,PG,BG,"×","\\times",!0),DG(IG,PG,BG,"∩","\\cap",!0),DG(IG,PG,BG,"∪","\\cup",!0),DG(IG,PG,BG,"∖","\\setminus",!0),DG(IG,PG,BG,"∧","\\land"),DG(IG,PG,BG,"∨","\\lor"),DG(IG,PG,BG,"∧","\\wedge",!0),DG(IG,PG,BG,"∨","\\vee",!0),DG(IG,PG,UG,"√","\\surd"),DG(IG,PG,qG,"⟨","\\langle",!0),DG(IG,PG,qG,"∣","\\lvert"),DG(IG,PG,qG,"∥","\\lVert"),DG(IG,PG,zG,"?","?"),DG(IG,PG,zG,"!","!"),DG(IG,PG,zG,"⟩","\\rangle",!0),DG(IG,PG,zG,"∣","\\rvert"),DG(IG,PG,zG,"∥","\\rVert"),DG(IG,PG,$G,"=","="),DG(IG,PG,$G,":",":"),DG(IG,PG,$G,"≈","\\approx",!0),DG(IG,PG,$G,"≅","\\cong",!0),DG(IG,PG,$G,"≥","\\ge"),DG(IG,PG,$G,"≥","\\geq",!0),DG(IG,PG,$G,"←","\\gets"),DG(IG,PG,$G,">","\\gt",!0),DG(IG,PG,$G,"∈","\\in",!0),DG(IG,PG,$G,"","\\@not"),DG(IG,PG,$G,"⊂","\\subset",!0),DG(IG,PG,$G,"⊃","\\supset",!0),DG(IG,PG,$G,"⊆","\\subseteq",!0),DG(IG,PG,$G,"⊇","\\supseteq",!0),DG(IG,RG,$G,"⊈","\\nsubseteq",!0),DG(IG,RG,$G,"⊉","\\nsupseteq",!0),DG(IG,PG,$G,"⊨","\\models"),DG(IG,PG,$G,"←","\\leftarrow",!0),DG(IG,PG,$G,"≤","\\le"),DG(IG,PG,$G,"≤","\\leq",!0),DG(IG,PG,$G,"<","\\lt",!0),DG(IG,PG,$G,"→","\\rightarrow",!0),DG(IG,PG,$G,"→","\\to"),DG(IG,RG,$G,"≱","\\ngeq",!0),DG(IG,RG,$G,"≰","\\nleq",!0),DG(IG,PG,WG," ","\\ "),DG(IG,PG,WG," ","\\space"),DG(IG,PG,WG," ","\\nobreakspace"),DG(_G,PG,WG," ","\\ "),DG(_G,PG,WG," "," "),DG(_G,PG,WG," ","\\space"),DG(_G,PG,WG," ","\\nobreakspace"),DG(IG,PG,WG,null,"\\nobreak"),DG(IG,PG,WG,null,"\\allowbreak"),DG(IG,PG,jG,",",","),DG(IG,PG,jG,";",";"),DG(IG,RG,BG,"⊼","\\barwedge",!0),DG(IG,RG,BG,"⊻","\\veebar",!0),DG(IG,PG,BG,"⊙","\\odot",!0),DG(IG,PG,BG,"⊕","\\oplus",!0),DG(IG,PG,BG,"⊗","\\otimes",!0),DG(IG,PG,UG,"∂","\\partial",!0),DG(IG,PG,BG,"⊘","\\oslash",!0),DG(IG,RG,BG,"⊚","\\circledcirc",!0),DG(IG,RG,BG,"⊡","\\boxdot",!0),DG(IG,PG,BG,"△","\\bigtriangleup"),DG(IG,PG,BG,"▽","\\bigtriangledown"),DG(IG,PG,BG,"†","\\dagger"),DG(IG,PG,BG,"⋄","\\diamond"),DG(IG,PG,BG,"⋆","\\star"),DG(IG,PG,BG,"◃","\\triangleleft"),DG(IG,PG,BG,"▹","\\triangleright"),DG(IG,PG,qG,"{","\\{"),DG(_G,PG,UG,"{","\\{"),DG(_G,PG,UG,"{","\\textbraceleft"),DG(IG,PG,zG,"}","\\}"),DG(_G,PG,UG,"}","\\}"),DG(_G,PG,UG,"}","\\textbraceright"),DG(IG,PG,qG,"{","\\lbrace"),DG(IG,PG,zG,"}","\\rbrace"),DG(IG,PG,qG,"[","\\lbrack",!0),DG(_G,PG,UG,"[","\\lbrack",!0),DG(IG,PG,zG,"]","\\rbrack",!0),DG(_G,PG,UG,"]","\\rbrack",!0),DG(IG,PG,qG,"(","\\lparen",!0),DG(IG,PG,zG,")","\\rparen",!0),DG(_G,PG,UG,"<","\\textless",!0),DG(_G,PG,UG,">","\\textgreater",!0),DG(IG,PG,qG,"⌊","\\lfloor",!0),DG(IG,PG,zG,"⌋","\\rfloor",!0),DG(IG,PG,qG,"⌈","\\lceil",!0),DG(IG,PG,zG,"⌉","\\rceil",!0),DG(IG,PG,UG,"\\","\\backslash"),DG(IG,PG,UG,"∣","|"),DG(IG,PG,UG,"∣","\\vert"),DG(_G,PG,UG,"|","\\textbar",!0),DG(IG,PG,UG,"∥","\\|"),DG(IG,PG,UG,"∥","\\Vert"),DG(_G,PG,UG,"∥","\\textbardbl"),DG(_G,PG,UG,"~","\\textasciitilde"),DG(_G,PG,UG,"\\","\\textbackslash"),DG(_G,PG,UG,"^","\\textasciicircum"),DG(IG,PG,$G,"↑","\\uparrow",!0),DG(IG,PG,$G,"⇑","\\Uparrow",!0),DG(IG,PG,$G,"↓","\\downarrow",!0),DG(IG,PG,$G,"⇓","\\Downarrow",!0),DG(IG,PG,$G,"↕","\\updownarrow",!0),DG(IG,PG,$G,"⇕","\\Updownarrow",!0),DG(IG,PG,HG,"∐","\\coprod"),DG(IG,PG,HG,"⋁","\\bigvee"),DG(IG,PG,HG,"⋀","\\bigwedge"),DG(IG,PG,HG,"⨄","\\biguplus"),DG(IG,PG,HG,"⋂","\\bigcap"),DG(IG,PG,HG,"⋃","\\bigcup"),DG(IG,PG,HG,"∫","\\int"),DG(IG,PG,HG,"∫","\\intop"),DG(IG,PG,HG,"∬","\\iint"),DG(IG,PG,HG,"∭","\\iiint"),DG(IG,PG,HG,"∏","\\prod"),DG(IG,PG,HG,"∑","\\sum"),DG(IG,PG,HG,"⨂","\\bigotimes"),DG(IG,PG,HG,"⨁","\\bigoplus"),DG(IG,PG,HG,"⨀","\\bigodot"),DG(IG,PG,HG,"∮","\\oint"),DG(IG,PG,HG,"∯","\\oiint"),DG(IG,PG,HG,"∰","\\oiiint"),DG(IG,PG,HG,"⨆","\\bigsqcup"),DG(IG,PG,HG,"∫","\\smallint"),DG(_G,PG,VG,"…","\\textellipsis"),DG(IG,PG,VG,"…","\\mathellipsis"),DG(_G,PG,VG,"…","\\ldots",!0),DG(IG,PG,VG,"…","\\ldots",!0),DG(IG,PG,VG,"⋯","\\@cdots",!0),DG(IG,PG,VG,"⋱","\\ddots",!0),DG(IG,PG,UG,"⋮","\\varvdots"),DG(_G,PG,UG,"⋮","\\varvdots"),DG(IG,PG,LG,"ˊ","\\acute"),DG(IG,PG,LG,"ˋ","\\grave"),DG(IG,PG,LG,"¨","\\ddot"),DG(IG,PG,LG,"~","\\tilde"),DG(IG,PG,LG,"ˉ","\\bar"),DG(IG,PG,LG,"˘","\\breve"),DG(IG,PG,LG,"ˇ","\\check"),DG(IG,PG,LG,"^","\\hat"),DG(IG,PG,LG,"⃗","\\vec"),DG(IG,PG,LG,"˙","\\dot"),DG(IG,PG,LG,"˚","\\mathring"),DG(IG,PG,FG,"","\\@imath"),DG(IG,PG,FG,"","\\@jmath"),DG(IG,PG,UG,"ı","ı"),DG(IG,PG,UG,"ȷ","ȷ"),DG(_G,PG,UG,"ı","\\i",!0),DG(_G,PG,UG,"ȷ","\\j",!0),DG(_G,PG,UG,"ß","\\ss",!0),DG(_G,PG,UG,"æ","\\ae",!0),DG(_G,PG,UG,"œ","\\oe",!0),DG(_G,PG,UG,"ø","\\o",!0),DG(_G,PG,UG,"Æ","\\AE",!0),DG(_G,PG,UG,"Œ","\\OE",!0),DG(_G,PG,UG,"Ø","\\O",!0),DG(_G,PG,LG,"ˊ","\\'"),DG(_G,PG,LG,"ˋ","\\`"),DG(_G,PG,LG,"ˆ","\\^"),DG(_G,PG,LG,"˜","\\~"),DG(_G,PG,LG,"ˉ","\\="),DG(_G,PG,LG,"˘","\\u"),DG(_G,PG,LG,"˙","\\."),DG(_G,PG,LG,"¸","\\c"),DG(_G,PG,LG,"˚","\\r"),DG(_G,PG,LG,"ˇ","\\v"),DG(_G,PG,LG,"¨",'\\"'),DG(_G,PG,LG,"˝","\\H"),DG(_G,PG,LG,"◯","\\textcircled");var KG={"--":!0,"---":!0,"``":!0,"''":!0};DG(_G,PG,UG,"–","--",!0),DG(_G,PG,UG,"–","\\textendash"),DG(_G,PG,UG,"—","---",!0),DG(_G,PG,UG,"—","\\textemdash"),DG(_G,PG,UG,"‘","`",!0),DG(_G,PG,UG,"‘","\\textquoteleft"),DG(_G,PG,UG,"’","'",!0),DG(_G,PG,UG,"’","\\textquoteright"),DG(_G,PG,UG,"“","``",!0),DG(_G,PG,UG,"“","\\textquotedblleft"),DG(_G,PG,UG,"”","''",!0),DG(_G,PG,UG,"”","\\textquotedblright"),DG(IG,PG,UG,"°","\\degree",!0),DG(_G,PG,UG,"°","\\degree"),DG(_G,PG,UG,"°","\\textdegree",!0),DG(IG,PG,UG,"£","\\pounds"),DG(IG,PG,UG,"£","\\mathsterling",!0),DG(_G,PG,UG,"£","\\pounds"),DG(_G,PG,UG,"£","\\textsterling",!0),DG(IG,RG,UG,"✠","\\maltese"),DG(_G,RG,UG,"✠","\\maltese");for(var GG='0123456789/@."',JG=0;JG<14;JG++){var YG=GG.charAt(JG);DG(IG,PG,UG,YG,YG)}for(var XG='0123456789!@*()-=+";:?/.,',ZG=0;ZG<25;ZG++){var QG=XG.charAt(ZG);DG(_G,PG,UG,QG,QG)}for(var eJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",tJ=0;tJ<52;tJ++){var nJ=eJ.charAt(tJ);DG(IG,PG,FG,nJ,nJ),DG(_G,PG,UG,nJ,nJ)}DG(IG,RG,UG,"C","ℂ"),DG(_G,RG,UG,"C","ℂ"),DG(IG,RG,UG,"H","ℍ"),DG(_G,RG,UG,"H","ℍ"),DG(IG,RG,UG,"N","ℕ"),DG(_G,RG,UG,"N","ℕ"),DG(IG,RG,UG,"P","ℙ"),DG(_G,RG,UG,"P","ℙ"),DG(IG,RG,UG,"Q","ℚ"),DG(_G,RG,UG,"Q","ℚ"),DG(IG,RG,UG,"R","ℝ"),DG(_G,RG,UG,"R","ℝ"),DG(IG,RG,UG,"Z","ℤ"),DG(_G,RG,UG,"Z","ℤ"),DG(IG,PG,FG,"h","ℎ"),DG(_G,PG,FG,"h","ℎ");for(var rJ="",iJ=0;iJ<52;iJ++){var oJ=eJ.charAt(iJ);DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56320+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56372+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56424+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56580+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56684+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56736+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56788+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56840+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56944+iJ)),DG(_G,PG,UG,oJ,rJ),iJ<26&&(DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56632+iJ)),DG(_G,PG,UG,oJ,rJ),DG(IG,PG,FG,oJ,rJ=String.fromCharCode(55349,56476+iJ)),DG(_G,PG,UG,oJ,rJ))}DG(IG,PG,FG,"k",rJ=String.fromCharCode(55349,56668)),DG(_G,PG,UG,"k",rJ);for(var sJ=0;sJ<10;sJ++){var aJ=sJ.toString();DG(IG,PG,FG,aJ,rJ=String.fromCharCode(55349,57294+sJ)),DG(_G,PG,UG,aJ,rJ),DG(IG,PG,FG,aJ,rJ=String.fromCharCode(55349,57314+sJ)),DG(_G,PG,UG,aJ,rJ),DG(IG,PG,FG,aJ,rJ=String.fromCharCode(55349,57324+sJ)),DG(_G,PG,UG,aJ,rJ),DG(IG,PG,FG,aJ,rJ=String.fromCharCode(55349,57334+sJ)),DG(_G,PG,UG,aJ,rJ)}for(var lJ="ÐÞþ",cJ=0;cJ<3;cJ++){var hJ=lJ.charAt(cJ);DG(IG,PG,FG,hJ,hJ),DG(_G,PG,UG,hJ,hJ)}var uJ=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],dJ=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],pJ=function(e,t,n){return EG[n][e]&&EG[n][e].replace&&(e=EG[n][e].replace),{value:e,metrics:rG(e,t,n)}},fJ=function(e,t,n,r,i){var o,s=pJ(e,t,n),a=s.metrics;if(e=s.value,a){var l=a.italic;("text"===n||r&&"mathit"===r.font)&&(l=0),o=new SG(e,a.height,a.depth,l,a.skew,a.width,i)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"' and mode '"+n+"'"),o=new SG(e,0,0,0,0,0,i);if(r){o.maxFontSize=r.sizeMultiplier,r.style.isTight()&&o.classes.push("mtight");var c=r.getColor();c&&(o.style.color=c)}return o},mJ=(e,t)=>{if(fG(e.classes)!==fG(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(1===e.classes.length){var n=e.classes[0];if("mbin"===n||"mord"===n)return!1}for(var r in e.style)if(e.style.hasOwnProperty(r)&&e.style[r]!==t.style[r])return!1;for(var i in t.style)if(t.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;return!0},gJ=function(e){for(var t=0,n=0,r=0,i=0;i<e.children.length;i++){var o=e.children[i];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},vJ=function(e,t,n,r){var i=new wG(e,t,n,r);return gJ(i),i},yJ=(e,t,n,r)=>new wG(e,t,n,r),wJ=function(e){var t=new QK(e);return gJ(t),t},bJ=function(e,t,n){var r="";switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return r+"-"+("textbf"===t&&"textit"===n?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},xJ={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},kJ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},SJ={fontMap:xJ,makeSymbol:fJ,mathsym:function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&pJ(e,"Main-Bold",t).metrics?fJ(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===EG[t][e].font?fJ(e,"Main-Regular",t,n,r):fJ(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},makeSpan:vJ,makeSvgSpan:yJ,makeLineSpan:function(e,t,n){var r=vJ([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=pG(r.height),r.maxFontSize=1,r},makeAnchor:function(e,t,n,r){var i=new bG(e,t,n,r);return gJ(i),i},makeFragment:wJ,wrapFragment:function(e,t){return e instanceof QK?vJ([],[e],t):e},makeVList:function(e,t){for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,i=r,o=1;o<t.length;o++){var s=-t[o].shift-i-t[o].elem.depth,a=s-(t[o-1].elem.height+t[o-1].elem.depth);i+=s,n.push({type:"kern",size:a}),n.push(t[o])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,h=0;h<e.children.length;h++){var u=e.children[h];c-="kern"===u.type?u.size:u.elem.height+u.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var d=e.children[0];if("elem"!==d.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-d.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-d.elem.depth}}return{children:e.children,depth:l}}(e),i=0,o=0;o<n.length;o++){var s=n[o];if("elem"===s.type){var a=s.elem;i=Math.max(i,a.maxFontSize,a.height)}}i+=2;var l=vJ(["pstrut"],[]);l.style.height=pG(i);for(var c=[],h=r,u=r,d=r,p=0;p<n.length;p++){var f=n[p];if("kern"===f.type)d+=f.size;else{var m=f.elem,g=f.wrapperClasses||[],v=f.wrapperStyle||{},y=vJ(g,[l,m],void 0,v);y.style.top=pG(-i-d-m.depth),f.marginLeft&&(y.style.marginLeft=f.marginLeft),f.marginRight&&(y.style.marginRight=f.marginRight),c.push(y),d+=m.height+m.depth}h=Math.min(h,d),u=Math.max(u,d)}var w,b=vJ(["vlist"],c);if(b.style.height=pG(u),h<0){var x=vJ([],[]),k=vJ(["vlist"],[x]);k.style.height=pG(-h);var S=vJ(["vlist-s"],[new SG("​")]);w=[vJ(["vlist-r"],[b,S]),vJ(["vlist-r"],[k])]}else w=[vJ(["vlist-r"],[b])];var C=vJ(["vlist-t"],w);return 2===w.length&&C.classes.push("vlist-t2"),C.height=u,C.depth=-h,C},makeOrd:function(e,t,n){var r=e.mode,i=e.text,o=["mord"],s="math"===r||"text"===r&&t.font,a=s?t.font:t.fontFamily,l="",c="";if(55349===i.charCodeAt(0)&&([l,c]=function(e,t){var n=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536,r="math"===t?0:1;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return[uJ[i][2],uJ[i][r]]}if(120782<=n&&n<=120831){var o=Math.floor((n-120782)/10);return[dJ[o][2],dJ[o][r]]}if(120485===n||120486===n)return[uJ[0][2],uJ[0][r]];if(120486<n&&n<120782)return["",""];throw new EK("Unsupported character: "+e)}(i,r)),l.length>0)return fJ(i,l,r,t,o.concat(c));if(a){var h,u;if("boldsymbol"===a){var d=function(e,t,n,r,i){return"textord"!==i&&pJ(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(i,r,0,0,n);h=d.fontName,u=[d.fontClass]}else s?(h=xJ[a].fontName,u=[a]):(h=bJ(a,t.fontWeight,t.fontShape),u=[a,t.fontWeight,t.fontShape]);if(pJ(i,h,r).metrics)return fJ(i,h,r,t,o.concat(u));if(KG.hasOwnProperty(i)&&"Typewriter"===h.slice(0,10)){for(var p=[],f=0;f<i.length;f++)p.push(fJ(i[f],h,r,t,o.concat(u)));return wJ(p)}}if("mathord"===n)return fJ(i,"Math-Italic",r,t,o.concat(["mathnormal"]));if("textord"===n){var m=EG[r][i]&&EG[r][i].font;if("ams"===m){var g=bJ("amsrm",t.fontWeight,t.fontShape);return fJ(i,g,r,t,o.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==m&&m){var v=bJ(m,t.fontWeight,t.fontShape);return fJ(i,v,r,t,o.concat(v,t.fontWeight,t.fontShape))}var y=bJ("textrm",t.fontWeight,t.fontShape);return fJ(i,y,r,t,o.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+n+" in makeOrd")},makeGlue:(e,t)=>{var n=vJ(["mspace"],[],t),r=dG(e,t);return n.style.marginRight=pG(r),n},staticSvg:function(e,t){var[n,r,i]=kJ[e],o=new MG(n),s=new CG([o],{width:pG(r),height:pG(i),style:"width:"+pG(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),a=yJ(["overlay"],[s],t);return a.height=i,a.style.height=pG(i),a.style.width=pG(r),a},svgData:kJ,tryCombineChars:e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof SG&&r instanceof SG&&mJ(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e}},CJ={number:3,unit:"mu"},MJ={number:4,unit:"mu"},TJ={number:5,unit:"mu"},AJ={mord:{mop:CJ,mbin:MJ,mrel:TJ,minner:CJ},mop:{mord:CJ,mop:CJ,mrel:TJ,minner:CJ},mbin:{mord:MJ,mop:MJ,mopen:MJ,minner:MJ},mrel:{mord:TJ,mop:TJ,mopen:TJ,minner:TJ},mopen:{},mclose:{mop:CJ,mbin:MJ,mrel:TJ,minner:CJ},mpunct:{mord:CJ,mop:CJ,mrel:TJ,mopen:CJ,mclose:CJ,mpunct:CJ,minner:CJ},minner:{mord:CJ,mop:CJ,mbin:MJ,mrel:TJ,mopen:CJ,mpunct:CJ,minner:CJ}},OJ={mord:{mop:CJ},mop:{mord:CJ,mop:CJ},mbin:{},mrel:{},mopen:{},mclose:{mop:CJ},mpunct:{},minner:{mop:CJ}},NJ={},EJ={},DJ={};function IJ(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:o,mathmlBuilder:s}=e,a={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},l=0;l<n.length;++l)NJ[n[l]]=a;t&&(o&&(EJ[t]=o),s&&(DJ[t]=s))}function _J(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;IJ({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var PJ=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},RJ=function(e){return"ordgroup"===e.type?e.body:[e]},LJ=SJ.makeSpan,BJ=["leftmost","mbin","mopen","mrel","mop","mpunct"],zJ=["rightmost","mrel","mclose","mpunct"],VJ={display:KK.DISPLAY,text:KK.TEXT,script:KK.SCRIPT,scriptscript:KK.SCRIPTSCRIPT},FJ={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},HJ=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var i=[],o=0;o<e.length;o++){var s=KJ(e[o],t);if(s instanceof QK){var a=s.children;i.push(...a)}else i.push(s)}if(SJ.tryCombineChars(i),!n)return i;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(VJ[c.style]))}var h=LJ([r[0]||"leftmost"],[],t),u=LJ([r[1]||"rightmost"],[],t),d="root"===n;return qJ(i,(e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&zJ.includes(r)?t.classes[0]="mord":"mbin"===r&&BJ.includes(n)&&(e.classes[0]="mord")},{node:h},u,d),qJ(i,(e,t)=>{var n=WJ(t),r=WJ(e),i=n&&r?e.hasClass("mtight")?OJ[n][r]:AJ[n][r]:null;if(i)return SJ.makeGlue(i,l)},{node:h},u,d),i},qJ=function e(t,n,r,i,o){i&&t.push(i);for(var s=0;s<t.length;s++){var a=t[s],l=jJ(a);if(l)e(l.children,n,r,null,o);else{var c=!a.hasClass("mspace");if(c){var h=n(a,r.node);h&&(r.insertAfter?r.insertAfter(h):(t.unshift(h),s++))}c?r.node=a:o&&a.hasClass("newline")&&(r.node=LJ(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),s++})(s)}}i&&t.pop()},jJ=function(e){return e instanceof QK||e instanceof bG||e instanceof wG&&e.hasClass("enclosing")?e:null},$J=function e(t,n){var r=jJ(t);if(r){var i=r.children;if(i.length){if("right"===n)return e(i[i.length-1],"right");if("left"===n)return e(i[0],"left")}}return t},WJ=function(e,t){return e?(t&&(e=$J(e,t)),FJ[e.classes[0]]||null):null},UJ=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return LJ(t.concat(n))},KJ=function(e,t,n){if(!e)return LJ();if(EJ[e.type]){var r=EJ[e.type](e,t);if(n&&t.size!==n.size){r=LJ(t.sizingClasses(n),[r],t);var i=t.sizeMultiplier/n.sizeMultiplier;r.height*=i,r.depth*=i}return r}throw new EK("Got group of unknown type: '"+e.type+"'")};function GJ(e,t){var n=LJ(["base"],e,t),r=LJ(["strut"]);return r.style.height=pG(n.height+n.depth),n.depth&&(r.style.verticalAlign=pG(-n.depth)),n.children.unshift(r),n}function JJ(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,i=HJ(e,t,"root");2===i.length&&i[1].hasClass("tag")&&(r=i.pop());for(var o,s=[],a=[],l=0;l<i.length;l++)if(a.push(i[l]),i[l].hasClass("mbin")||i[l].hasClass("mrel")||i[l].hasClass("allowbreak")){for(var c=!1;l<i.length-1&&i[l+1].hasClass("mspace")&&!i[l+1].hasClass("newline");)l++,a.push(i[l]),i[l].hasClass("nobreak")&&(c=!0);c||(s.push(GJ(a,t)),a=[])}else i[l].hasClass("newline")&&(a.pop(),a.length>0&&(s.push(GJ(a,t)),a=[]),s.push(i[l]));a.length>0&&s.push(GJ(a,t)),n?((o=GJ(HJ(n,t,!0))).classes=["tag"],s.push(o)):r&&s.push(r);var h=LJ(["katex-html"],s);if(h.setAttribute("aria-hidden","true"),o){var u=o.children[0];u.style.height=pG(h.height+h.depth),h.depth&&(u.style.verticalAlign=pG(-h.depth))}return h}function YJ(e){return new QK(e)}class XJ{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=fG(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof ZJ&&this.children[n+1]instanceof ZJ){for(var r=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof ZJ;)r+=this.children[++n].toText();e.appendChild(new ZJ(r).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=RK.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+RK.escape(fG(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map(e=>e.toText()).join("")}}class ZJ{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return RK.escape(this.toText())}toText(){return this.text}}var QJ={MathNode:XJ,TextNode:ZJ,SpaceNode:class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?"  ":e>=-.05556&&e<=-.05555?" ⁣":e>=-.1667&&e<=-.1666?" ⁣":e>=-.2223&&e<=-.2222?" ⁣":e>=-.2778&&e<=-.2777?" ⁣":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",pG(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+pG(this.width)+'"/>'}toText(){return this.character?this.character:" "}},newDocumentFragment:YJ},eY=function(e,t,n){return!EG[t][e]||!EG[t][e].replace||55349===e.charCodeAt(0)||KG.hasOwnProperty(e)&&n&&(n.fontFamily&&"tt"===n.fontFamily.slice(4,6)||n.font&&"tt"===n.font.slice(4,6))||(e=EG[t][e].replace),new QJ.TextNode(e)},tY=function(e){return 1===e.length?e[0]:new QJ.MathNode("mrow",e)},nY=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathsfit"===n)return"sans-serif-italic";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var i=e.text;return["\\imath","\\jmath"].includes(i)?null:(EG[r][i]&&EG[r][i].replace&&(i=EG[r][i].replace),rG(i,SJ.fontMap[n].fontName,r)?SJ.fontMap[n].variant:null)};function rY(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){var t=e.children[0];return t instanceof ZJ&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var n=e.children[0];return n instanceof ZJ&&","===n.text}return!1}var iY=function(e,t,n){if(1===e.length){var r=sY(e[0],t);return n&&r instanceof XJ&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i,o=[],s=0;s<e.length;s++){var a=sY(e[s],t);if(a instanceof XJ&&i instanceof XJ){if("mtext"===a.type&&"mtext"===i.type&&a.getAttribute("mathvariant")===i.getAttribute("mathvariant")){i.children.push(...a.children);continue}if("mn"===a.type&&"mn"===i.type){i.children.push(...a.children);continue}if(rY(a)&&"mn"===i.type){i.children.push(...a.children);continue}if("mn"===a.type&&rY(i))a.children=[...i.children,...a.children],o.pop();else if(("msup"===a.type||"msub"===a.type)&&a.children.length>=1&&("mn"===i.type||rY(i))){var l=a.children[0];l instanceof XJ&&"mn"===l.type&&(l.children=[...i.children,...l.children],o.pop())}else if("mi"===i.type&&1===i.children.length){var c=i.children[0];if(c instanceof ZJ&&"̸"===c.text&&("mo"===a.type||"mi"===a.type||"mn"===a.type)){var h=a.children[0];h instanceof ZJ&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),o.pop())}}}o.push(a),i=a}return o},oY=function(e,t,n){return tY(iY(e,t,n))},sY=function(e,t){if(!e)return new QJ.MathNode("mrow");if(DJ[e.type])return DJ[e.type](e,t);throw new EK("Got group of unknown type: '"+e.type+"'")};function aY(e,t,n,r,i){var o,s=iY(e,n);o=1===s.length&&s[0]instanceof XJ&&["mrow","mtable"].includes(s[0].type)?s[0]:new QJ.MathNode("mrow",s);var a=new QJ.MathNode("annotation",[new QJ.TextNode(t)]);a.setAttribute("encoding","application/x-tex");var l=new QJ.MathNode("semantics",[o,a]),c=new QJ.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var h=i?"katex":"katex-mathml";return SJ.makeSpan([h],[c])}var lY=function(e){return new lG({style:e.displayMode?KK.DISPLAY:KK.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},cY=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=SJ.makeSpan(n,[e])}return e},hY={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},uY={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},dY=function(e,t,n,r,i){var o,s=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(o=SJ.makeSpan(["stretchy",t],[],i),"fbox"===t){var a=i.color&&i.getColor();a&&(o.style.borderColor=a)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new TG({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new TG({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new CG(l,{width:"100%",height:pG(s)});o=SJ.makeSvgSpan([],[c],i)}return o.height=s,o.style.height=pG(s),o},pY=function(e){var t=new QJ.MathNode("mo",[new QJ.TextNode(hY[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},fY=function(e,t){var{span:n,minWidth:r,height:i}=function(){var n=4e5,r=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(r)){var i,o,s,a="ordgroup"===(p=e.base).type?p.body.length:1;if(a>5)"widehat"===r||"widecheck"===r?(i=420,n=2364,s=.42,o=r+"4"):(i=312,n=2340,s=.34,o="tilde4");else{var l=[1,1,2,2,3,3][a];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],i=[0,239,300,360,420][l],s=[0,.24,.3,.3,.36,.42][l],o=r+l):(n=[0,600,1033,2339,2340][l],i=[0,260,286,306,312][l],s=[0,.26,.286,.3,.306,.34][l],o="tilde"+l)}var c=new MG(o),h=new CG([c],{width:"100%",height:pG(s),viewBox:"0 0 "+n+" "+i,preserveAspectRatio:"none"});return{span:SJ.makeSvgSpan([],[h],t),minWidth:0,height:s}}var u,d,p,f=[],m=uY[r],[g,v,y]=m,w=y/1e3,b=g.length;if(1===b)u=["hide-tail"],d=[m[3]];else if(2===b)u=["halfarrow-left","halfarrow-right"],d=["xMinYMin","xMaxYMin"];else{if(3!==b)throw new Error("Correct katexImagesData or update code here to support\n "+b+" children.");u=["brace-left","brace-center","brace-right"],d=["xMinYMin","xMidYMin","xMaxYMin"]}for(var x=0;x<b;x++){var k=new MG(g[x]),S=new CG([k],{width:"400em",height:pG(w),viewBox:"0 0 "+n+" "+y,preserveAspectRatio:d[x]+" slice"}),C=SJ.makeSvgSpan([u[x]],[S],t);if(1===b)return{span:C,minWidth:v,height:w};C.style.height=pG(w),f.push(C)}return{span:SJ.makeSpan(["stretchy"],f,t),minWidth:v,height:w}}();return n.height=i,n.style.height=pG(i),r>0&&(n.style.minWidth=pG(r)),n};function mY(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function gY(e){var t=vY(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function vY(e){return e&&("atom"===e.type||NG.hasOwnProperty(e.type))?e:null}var yY=(e,t)=>{var n,r,i;e&&"supsub"===e.type?(n=(r=mY(e.base,"accent")).base,e.base=n,i=function(e){if(e instanceof wG)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(KJ(e,t)),e.base=r):n=(r=mY(e,"accent")).base;var o=KJ(n,t.havingCrampedStyle()),s=0;if(r.isShifty&&RK.isCharacterBox(n)){var a=RK.getBaseElem(n);s=AG(KJ(a,t.havingCrampedStyle())).skew}var l,c="\\c"===r.label,h=c?o.height+o.depth:Math.min(o.height,t.fontMetrics().xHeight);if(r.isStretchy)l=fY(r,t),l=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+pG(2*s)+")",marginLeft:pG(2*s)}:void 0}]},t);else{var u,d;"\\vec"===r.label?(u=SJ.staticSvg("vec",t),d=SJ.svgData.vec[1]):((u=AG(u=SJ.makeOrd({mode:r.mode,text:r.label},t,"textord"))).italic=0,d=u.width,c&&(h+=u.depth)),l=SJ.makeSpan(["accent-body"],[u]);var p="\\textcircled"===r.label;p&&(l.classes.push("accent-full"),h=o.height);var f=s;p||(f-=d/2),l.style.left=pG(f),"\\textcircled"===r.label&&(l.style.top=".2em"),l=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-h},{type:"elem",elem:l}]},t)}var m=SJ.makeSpan(["mord","accent"],[l],t);return i?(i.children[0]=m,i.height=Math.max(m.height,i.height),i.classes[0]="mord",i):m},wY=(e,t)=>{var n=e.isStretchy?pY(e.label):new QJ.MathNode("mo",[eY(e.label,e.mode)]),r=new QJ.MathNode("mover",[sY(e.base,t),n]);return r.setAttribute("accent","true"),r},bY=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));IJ({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=PJ(t[0]),r=!bY.test(e.funcName),i=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:yY,mathmlBuilder:wY}),IJ({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:yY,mathmlBuilder:wY}),IJ({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=KJ(e.base,t),r=fY(e,t),i="\\utilde"===e.label?.12:0,o=SJ.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]},t);return SJ.makeSpan(["mord","accentunder"],[o],t)},mathmlBuilder:(e,t)=>{var n=pY(e.label),r=new QJ.MathNode("munder",[sY(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var xY=e=>{var t=new QJ.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};IJ({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:i}=e;return{type:"xArrow",mode:r.mode,label:i,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,i=t.havingStyle(r.sup()),o=SJ.wrapFragment(KJ(e.body,i,t),t),s="\\x"===e.label.slice(0,2)?"x":"cd";o.classes.push(s+"-arrow-pad"),e.below&&(i=t.havingStyle(r.sub()),(n=SJ.wrapFragment(KJ(e.below,i,t),t)).classes.push(s+"-arrow-pad"));var a,l=fY(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,h=-t.fontMetrics().axisHeight-.5*l.height-.111;if((o.depth>.25||"\\xleftequilibrium"===e.label)&&(h-=o.depth),n){var u=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;a=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:h},{type:"elem",elem:l,shift:c},{type:"elem",elem:n,shift:u}]},t)}else a=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:h},{type:"elem",elem:l,shift:c}]},t);return a.children[0].children[0].children[1].classes.push("svg-align"),SJ.makeSpan(["mrel","x-arrow"],[a],t)},mathmlBuilder(e,t){var n,r=pY(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var i=xY(sY(e.body,t));if(e.below){var o=xY(sY(e.below,t));n=new QJ.MathNode("munderover",[r,o,i])}else n=new QJ.MathNode("mover",[r,i])}else if(e.below){var s=xY(sY(e.below,t));n=new QJ.MathNode("munder",[r,s])}else n=xY(),n=new QJ.MathNode("mover",[r,n]);return n}});var kY=SJ.makeSpan;function SY(e,t){var n=HJ(e.body,t,!0);return kY([e.mclass],n,t)}function CY(e,t){var n,r=iY(e.body,t);return"minner"===e.mclass?n=new QJ.MathNode("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new QJ.MathNode("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new QJ.MathNode("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"===e.mclass||"mclose"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0em"):"minner"===e.mclass&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}IJ({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:RJ(i),isCharacterBox:RK.isCharacterBox(i)}},htmlBuilder:SY,mathmlBuilder:CY});var MY=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};IJ({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:MY(t[0]),body:RJ(t[1]),isCharacterBox:RK.isCharacterBox(t[1])}}}),IJ({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:i}=e,o=t[1],s=t[0];n="\\stackrel"!==i?MY(o):"mrel";var a={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==i,body:RJ(o)},l={type:"supsub",mode:s.mode,base:a,sup:"\\underset"===i?null:s,sub:"\\underset"===i?s:null};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:RK.isCharacterBox(l)}},htmlBuilder:SY,mathmlBuilder:CY}),IJ({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:MY(t[0]),body:RJ(t[0])}},htmlBuilder(e,t){var n=HJ(e.body,t,!0),r=SJ.makeSpan([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=iY(e.body,t),r=new QJ.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var TY={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},AY=()=>({type:"styling",body:[],mode:"math",style:"display"}),OY=e=>"textord"===e.type&&"@"===e.text,NY=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function EY(e,t,n){var r=TY[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var i={type:"atom",text:r,mode:"math",family:"rel"},o={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[i],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[o],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}IJ({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=SJ.wrapFragment(KJ(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=pG(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new QJ.MathNode("mrow",[sY(e.label,t)]);return(n=new QJ.MathNode("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new QJ.MathNode("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),IJ({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=SJ.wrapFragment(KJ(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new QJ.MathNode("mrow",[sY(e.fragment,t)])}),IJ({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=mY(t[0],"ordgroup").body,i="",o=0;o<r.length;o++){i+=mY(r[o],"textord").text}var s,a=parseInt(i);if(isNaN(a))throw new EK("\\@char has non-numeric argument "+i);if(a<0||a>=1114111)throw new EK("\\@char with invalid code point "+i);return a<=65535?s=String.fromCharCode(a):(a-=65536,s=String.fromCharCode(55296+(a>>10),56320+(1023&a))),{type:"textord",mode:n.mode,text:s}}});var DY=(e,t)=>{var n=HJ(e.body,t.withColor(e.color),!1);return SJ.makeFragment(n)},IY=(e,t)=>{var n=iY(e.body,t.withColor(e.color)),r=new QJ.MathNode("mstyle",n);return r.setAttribute("mathcolor",e.color),r};IJ({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=mY(t[0],"color-token").color,i=t[1];return{type:"color",mode:n.mode,color:r,body:RJ(i)}},htmlBuilder:DY,mathmlBuilder:IY}),IJ({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,i=mY(t[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var o=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:o}},htmlBuilder:DY,mathmlBuilder:IY}),IJ({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,i="["===r.gullet.future().text?r.parseSizeGroup(!0):null,o=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:o,size:i&&mY(i,"size").value}},htmlBuilder(e,t){var n=SJ.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=pG(dG(e.size,t)))),n},mathmlBuilder(e,t){var n=new QJ.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",pG(dG(e.size,t)))),n}});var _Y={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},PY=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new EK("Expected a control sequence",e);return t},RY=(e,t,n,r)=>{var i=e.gullet.macros.get(n.text);null==i&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};IJ({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(_Y[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=_Y[r.text]),mY(t.parseFunction(),"internal");throw new EK("Invalid token after macro prefix",r)}}),IJ({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new EK("Expected a control sequence",r);for(var o,s=0,a=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){o=t.gullet.future(),a[s].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new EK('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new EK('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if("EOF"===r.text)throw new EK("Expected a macro definition");a[s].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),"\\edef"!==n&&"\\xdef"!==n||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},n===_Y[n]),{type:"internal",mode:t.mode}}}),IJ({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=PY(t.gullet.popToken());t.gullet.consumeSpaces();var i=(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t);return RY(t,r,i,"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),IJ({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=PY(t.gullet.popToken()),i=t.gullet.popToken(),o=t.gullet.popToken();return RY(t,r,o,"\\\\globalfuture"===n),t.gullet.pushToken(o),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var LY=function(e,t,n){var r=rG(EG.math[e]&&EG.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},BY=function(e,t,n,r){var i=n.havingBaseStyle(t),o=SJ.makeSpan(r.concat(i.sizingClasses(n)),[e],n),s=i.sizeMultiplier/n.sizeMultiplier;return o.height*=s,o.depth*=s,o.maxFontSize=i.sizeMultiplier,o},zY=function(e,t,n){var r=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=pG(i),e.height-=i,e.depth+=i},VY=function(e,t,n,r,i,o){var s=function(e,t,n,r){return SJ.makeSymbol(e,"Size"+t+"-Regular",n,r)}(e,t,i,r),a=BY(SJ.makeSpan(["delimsizing","size"+t],[s],r),KK.TEXT,r,o);return n&&zY(a,r,KK.TEXT),a},FY=function(e,t,n){var r;return r="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:SJ.makeSpan(["delimsizinginner",r],[SJ.makeSpan([],[SJ.makeSymbol(e,t,n)])])}},HY=function(e,t,n){var r=eG["Size4-Regular"][e.charCodeAt(0)]?eG["Size4-Regular"][e.charCodeAt(0)][4]:eG["Size1-Regular"][e.charCodeAt(0)][4],i=new MG("inner",function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145zM367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z";case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),o=new CG([i],{width:pG(r),height:pG(t),style:"width:"+pG(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),s=SJ.makeSvgSpan([],[o],n);return s.height=t,s.style.height=pG(t),s.style.width=pG(r),{type:"elem",elem:s}},qY={type:"kern",size:-.008},jY=["|","\\lvert","\\rvert","\\vert"],$Y=["\\|","\\lVert","\\rVert","\\Vert"],WY=function(e,t,n,r,i,o){var s,a,l,c,h="",u=0;s=l=c=e,a=null;var d="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?s=l="⏐":"\\Downarrow"===e?s=l="‖":"\\updownarrow"===e?(s="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(s="\\Uparrow",l="‖",c="\\Downarrow"):jY.includes(e)?(l="∣",h="vert",u=333):$Y.includes(e)?(l="∥",h="doublevert",u=556):"["===e||"\\lbrack"===e?(s="⎡",l="⎢",c="⎣",d="Size4-Regular",h="lbrack",u=667):"]"===e||"\\rbrack"===e?(s="⎤",l="⎥",c="⎦",d="Size4-Regular",h="rbrack",u=667):"\\lfloor"===e||"⌊"===e?(l=s="⎢",c="⎣",d="Size4-Regular",h="lfloor",u=667):"\\lceil"===e||"⌈"===e?(s="⎡",l=c="⎢",d="Size4-Regular",h="lceil",u=667):"\\rfloor"===e||"⌋"===e?(l=s="⎥",c="⎦",d="Size4-Regular",h="rfloor",u=667):"\\rceil"===e||"⌉"===e?(s="⎤",l=c="⎥",d="Size4-Regular",h="rceil",u=667):"("===e||"\\lparen"===e?(s="⎛",l="⎜",c="⎝",d="Size4-Regular",h="lparen",u=875):")"===e||"\\rparen"===e?(s="⎞",l="⎟",c="⎠",d="Size4-Regular",h="rparen",u=875):"\\{"===e||"\\lbrace"===e?(s="⎧",a="⎨",c="⎩",l="⎪",d="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(s="⎫",a="⎬",c="⎭",l="⎪",d="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(s="⎧",c="⎩",l="⎪",d="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(s="⎫",c="⎭",l="⎪",d="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(s="⎧",c="⎭",l="⎪",d="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(s="⎫",c="⎩",l="⎪",d="Size4-Regular");var p=LY(s,d,i),f=p.height+p.depth,m=LY(l,d,i),g=m.height+m.depth,v=LY(c,d,i),y=v.height+v.depth,w=0,b=1;if(null!==a){var x=LY(a,d,i);w=x.height+x.depth,b=2}var k=f+y+w,S=k+Math.max(0,Math.ceil((t-k)/(b*g)))*b*g,C=r.fontMetrics().axisHeight;n&&(C*=r.sizeMultiplier);var M=S/2-C,T=[];if(h.length>0){var A=S-f-y,O=Math.round(1e3*S),N=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(h,Math.round(1e3*A)),E=new MG(h,N),D=(u/1e3).toFixed(3)+"em",I=(O/1e3).toFixed(3)+"em",_=new CG([E],{width:D,height:I,viewBox:"0 0 "+u+" "+O}),P=SJ.makeSvgSpan([],[_],r);P.height=O/1e3,P.style.width=D,P.style.height=I,T.push({type:"elem",elem:P})}else{if(T.push(FY(c,d,i)),T.push(qY),null===a){var R=S-f-y+.016;T.push(HY(l,R,r))}else{var L=(S-f-y-w)/2+.016;T.push(HY(l,L,r)),T.push(qY),T.push(FY(a,d,i)),T.push(qY),T.push(HY(l,L,r))}T.push(qY),T.push(FY(s,d,i))}var B=r.havingBaseStyle(KK.TEXT),z=SJ.makeVList({positionType:"bottom",positionData:M,children:T},B);return BY(SJ.makeSpan(["delimsizing","mult"],[z],B),KK.TEXT,r,o)},UY=.08,KY=function(e,t,n,r,i){var o=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,XK);break;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,XK);break;case"sqrtSize2":r=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,XK);break;case"sqrtSize3":r=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,XK);break;case"sqrtSize4":r=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,XK);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,XK,n)}return r}(e,r,n),s=new MG(e,o),a=new CG([s],{width:"400em",height:pG(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return SJ.makeSvgSpan(["hide-tail"],[a],i)},GY=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],JY=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],YY=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],XY=[0,1.2,1.8,2.4,3],ZY=[{type:"small",style:KK.SCRIPTSCRIPT},{type:"small",style:KK.SCRIPT},{type:"small",style:KK.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],QY=[{type:"small",style:KK.SCRIPTSCRIPT},{type:"small",style:KK.SCRIPT},{type:"small",style:KK.TEXT},{type:"stack"}],eX=[{type:"small",style:KK.SCRIPTSCRIPT},{type:"small",style:KK.SCRIPT},{type:"small",style:KK.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],tX=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},nX=function(e,t,n,r){for(var i=Math.min(2,3-r.style.size);i<n.length&&"stack"!==n[i].type;i++){var o=LY(e,tX(n[i]),"math"),s=o.height+o.depth;if("small"===n[i].type&&(s*=r.havingBaseStyle(n[i].style).sizeMultiplier),s>t)return n[i]}return n[n.length-1]},rX=function(e,t,n,r,i,o){var s;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),s=YY.includes(e)?ZY:GY.includes(e)?eX:QY;var a=nX(e,t,s,r);return"small"===a.type?function(e,t,n,r,i,o){var s=SJ.makeSymbol(e,"Main-Regular",i,r),a=BY(s,t,r,o);return n&&zY(a,r,t),a}(e,a.style,n,r,i,o):"large"===a.type?VY(e,a.size,n,r,i,o):WY(e,t,n,r,i,o)},iX={sqrtImage:function(e,t){var n,r,i=t.havingBaseSizing(),o=nX("\\surd",e*i.sizeMultiplier,eX,i),s=i.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,c=0,h=0;return"small"===o.type?(e<1?s=1:e<1.4&&(s=.7),c=(1+a)/s,(n=KY("sqrtMain",l=(1+a+UY)/s,h=1e3+1e3*a+80,a,t)).style.minWidth="0.853em",r=.833/s):"large"===o.type?(h=1080*XY[o.size],c=(XY[o.size]+a)/s,l=(XY[o.size]+a+UY)/s,(n=KY("sqrtSize"+o.size,l,h,a,t)).style.minWidth="1.02em",r=1/s):(l=e+a+UY,c=e+a,h=Math.floor(1e3*e+a)+80,(n=KY("sqrtTall",l,h,a,t)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=pG(l),{span:n,advanceWidth:r,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*s}},sizedDelim:function(e,t,n,r,i){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),GY.includes(e)||YY.includes(e))return VY(e,t,!1,n,r,i);if(JY.includes(e))return WY(e,XY[t],!1,n,r,i);throw new EK("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:XY,customSizedDelim:rX,leftRightDelim:function(e,t,n,r,i,o){var s=r.fontMetrics().axisHeight*r.sizeMultiplier,a=5/r.fontMetrics().ptPerEm,l=Math.max(t-s,n+s),c=Math.max(l/500*901,2*l-a);return rX(e,c,!0,r,i,o)}},oX={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},sX=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function aX(e,t){var n=vY(e);if(n&&sX.includes(n.text))return n;throw new EK(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function lX(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}IJ({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=aX(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:oX[e.funcName].size,mclass:oX[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?SJ.makeSpan([e.mclass]):iX.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(eY(e.delim,e.mode));var n=new QJ.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=pG(iX.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),IJ({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new EK("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:aX(t[0],e).text,color:n}}}),IJ({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=aX(t[0],e),r=e.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var o=mY(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{lX(e);for(var n,r,i=HJ(e.body,t,!0,["mopen","mclose"]),o=0,s=0,a=!1,l=0;l<i.length;l++)i[l].isMiddle?a=!0:(o=Math.max(i[l].height,o),s=Math.max(i[l].depth,s));if(o*=t.sizeMultiplier,s*=t.sizeMultiplier,n="."===e.left?UJ(t,["mopen"]):iX.leftRightDelim(e.left,o,s,t,e.mode,["mopen"]),i.unshift(n),a)for(var c=1;c<i.length;c++){var h=i[c].isMiddle;h&&(i[c]=iX.leftRightDelim(h.delim,o,s,h.options,e.mode,[]))}if("."===e.right)r=UJ(t,["mclose"]);else{var u=e.rightColor?t.withColor(e.rightColor):t;r=iX.leftRightDelim(e.right,o,s,u,e.mode,["mclose"])}return i.push(r),SJ.makeSpan(["minner"],i,t)},mathmlBuilder:(e,t)=>{lX(e);var n=iY(e.body,t);if("."!==e.left){var r=new QJ.MathNode("mo",[eY(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var i=new QJ.MathNode("mo",[eY(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),n.push(i)}return tY(n)}}),IJ({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=aX(t[0],e);if(!e.parser.leftrightDepth)throw new EK("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=UJ(t,[]);else{n=iX.sizedDelim(e.delim,1,t,e.mode,[]);var r={delim:e.delim,options:t};n.isMiddle=r}return n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?eY("|","text"):eY(e.delim,e.mode),r=new QJ.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var cX=(e,t)=>{var n,r,i,o=SJ.wrapFragment(KJ(e.body,t),t),s=e.label.slice(1),a=t.sizeMultiplier,l=0,c=RK.isCharacterBox(e.body);if("sout"===s)(n=SJ.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/a,l=-.5*t.fontMetrics().xHeight;else if("phase"===s){var h=dG({number:.6,unit:"pt"},t),u=dG({number:.35,unit:"ex"},t);a/=t.havingBaseSizing().sizeMultiplier;var d=o.height+o.depth+h+u;o.style.paddingLeft=pG(d/2+h);var p=Math.floor(1e3*d*a),f="M400000 "+(r=p)+" H0 L"+r/2+" 0 l65 45 L145 "+(r-80)+" H400000z",m=new CG([new MG("phase",f)],{width:"400em",height:pG(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});(n=SJ.makeSvgSpan(["hide-tail"],[m],t)).style.height=pG(d),l=o.depth+h+u}else{/cancel/.test(s)?c||o.classes.push("cancel-pad"):"angl"===s?o.classes.push("anglpad"):o.classes.push("boxpad");var g=0,v=0,y=0;/box/.test(s)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),v=g=t.fontMetrics().fboxsep+("colorbox"===s?0:y)):"angl"===s?(g=4*(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),v=Math.max(0,.25-o.depth)):v=g=c?.2:0,n=dY(o,s,g,v,t),/fbox|boxed|fcolorbox/.test(s)?(n.style.borderStyle="solid",n.style.borderWidth=pG(y)):"angl"===s&&.049!==y&&(n.style.borderTopWidth=pG(y),n.style.borderRightWidth=pG(y)),l=o.depth+v,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)i=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:l},{type:"elem",elem:o,shift:0}]},t);else{var w=/cancel|phase/.test(s)?["svg-align"]:[];i=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:n,shift:l,wrapperClasses:w}]},t)}return/cancel/.test(s)&&(i.height=o.height,i.depth=o.depth),/cancel/.test(s)&&!c?SJ.makeSpan(["mord","cancel-lap"],[i],t):SJ.makeSpan(["mord"],[i],t)},hX=(e,t)=>{var n=0,r=new QJ.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[sY(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(e.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};IJ({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:r,funcName:i}=e,o=mY(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,body:s}},htmlBuilder:cX,mathmlBuilder:hX}),IJ({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:i}=e,o=mY(t[0],"color-token").color,s=mY(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,borderColor:o,body:a}},htmlBuilder:cX,mathmlBuilder:hX}),IJ({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}}),IJ({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:cX,mathmlBuilder:hX}),IJ({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var uX={};function dX(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:o,mathmlBuilder:s}=e,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)uX[n[l]]=a;o&&(EJ[t]=o),s&&(DJ[t]=s)}var pX={};function fX(e,t){pX[e]=t}function mX(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for("\\relax"===n&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var gX=e=>{if(!e.parser.settings.displayMode)throw new EK("{"+e.envName+"} can be used only in display mode.")};function vX(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function yX(e,t,n){var{hskipBeforeAndAfter:r,addJot:i,cols:o,arraystretch:s,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:h,maxNumCols:u,leqno:d}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)s=1;else if(!(s=parseFloat(p))||s<0)throw new EK("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var f=[],m=[f],g=[],v=[],y=null!=l?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new NK("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(w(),v.push(mX(e));;){var x=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),x={type:"ordgroup",mode:e.mode,body:x},n&&(x={type:"styling",mode:e.mode,style:n,body:[x]}),f.push(x);var k=e.fetch().text;if("&"===k){if(u&&f.length===u){if(c||a)throw new EK("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===k){b(),1===f.length&&"styling"===x.type&&0===x.body[0].body.length&&(m.length>1||!h)&&m.pop(),v.length<m.length+1&&v.push([]);break}if("\\\\"!==k)throw new EK("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var S=void 0;" "!==e.gullet.future().text&&(S=e.parseSizeGroup(!0)),g.push(S?S.value:null),b(),v.push(mX(e)),f=[],m.push(f),w()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:m,cols:o,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:a,tags:y,leqno:d}}function wX(e){return"d"===e.slice(0,1)?"display":"text"}var bX=function(e,t){var n,r,i=e.body.length,o=e.hLinesBeforeRow,s=0,a=new Array(i),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),h=1/t.fontMetrics().ptPerEm,u=5*h;e.colSeparationType&&"small"===e.colSeparationType&&(u=t.havingStyle(KK.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?dG({number:3,unit:"ex"},t):12*h,p=3*h,f=e.arraystretch*d,m=.7*f,g=.3*f,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(o[0]),n=0;n<e.body.length;++n){var w=e.body[n],b=m,x=g;s<w.length&&(s=w.length);var k=new Array(w.length);for(r=0;r<w.length;++r){var S=KJ(w[r],t);x<S.depth&&(x=S.depth),b<S.height&&(b=S.height),k[r]=S}var C=e.rowGaps[n],M=0;C&&(M=dG(C,t))>0&&(x<(M+=g)&&(x=M),M=0),e.addJot&&(x+=p),k.height=b,k.depth=x,v+=b,k.pos=v,v+=x+M,a[n]=k,y(o[n+1])}var T,A,O=v/2+t.fontMetrics().axisHeight,N=e.cols||[],E=[],D=[];if(e.tags&&e.tags.some(e=>e))for(n=0;n<i;++n){var I=a[n],_=I.pos-O,P=e.tags[n],R=void 0;(R=!0===P?SJ.makeSpan(["eqn-num"],[],t):!1===P?SJ.makeSpan([],[],t):SJ.makeSpan([],HJ(P,t,!0),t)).depth=I.depth,R.height=I.height,D.push({type:"elem",elem:R,shift:_})}for(r=0,A=0;r<s||A<N.length;++r,++A){for(var L=N[A]||{},B=!0;"separator"===L.type;){if(B||((T=SJ.makeSpan(["arraycolsep"],[])).style.width=pG(t.fontMetrics().doubleRuleSep),E.push(T)),"|"!==L.separator&&":"!==L.separator)throw new EK("Invalid separator type: "+L.separator);var z="|"===L.separator?"solid":"dashed",V=SJ.makeSpan(["vertical-separator"],[],t);V.style.height=pG(v),V.style.borderRightWidth=pG(c),V.style.borderRightStyle=z,V.style.margin="0 "+pG(-c/2);var F=v-O;F&&(V.style.verticalAlign=pG(-F)),E.push(V),L=N[++A]||{},B=!1}if(!(r>=s)){var H=void 0;(r>0||e.hskipBeforeAndAfter)&&0!==(H=RK.deflt(L.pregap,u))&&((T=SJ.makeSpan(["arraycolsep"],[])).style.width=pG(H),E.push(T));var q=[];for(n=0;n<i;++n){var j=a[n],$=j[r];if($){var W=j.pos-O;$.depth=j.depth,$.height=j.height,q.push({type:"elem",elem:$,shift:W})}}q=SJ.makeVList({positionType:"individualShift",children:q},t),q=SJ.makeSpan(["col-align-"+(L.align||"c")],[q]),E.push(q),(r<s-1||e.hskipBeforeAndAfter)&&0!==(H=RK.deflt(L.postgap,u))&&((T=SJ.makeSpan(["arraycolsep"],[])).style.width=pG(H),E.push(T))}}if(a=SJ.makeSpan(["mtable"],E),l.length>0){for(var U=SJ.makeLineSpan("hline",t,c),K=SJ.makeLineSpan("hdashline",t,c),G=[{type:"elem",elem:a,shift:0}];l.length>0;){var J=l.pop(),Y=J.pos-O;J.isDashed?G.push({type:"elem",elem:K,shift:Y}):G.push({type:"elem",elem:U,shift:Y})}a=SJ.makeVList({positionType:"individualShift",children:G},t)}if(0===D.length)return SJ.makeSpan(["mord"],[a],t);var X=SJ.makeVList({positionType:"individualShift",children:D},t);return X=SJ.makeSpan(["tag"],[X],t),SJ.makeFragment([a,X])},xX={c:"center ",l:"left ",r:"right "},kX=function(e,t){for(var n=[],r=new QJ.MathNode("mtd",[],["mtr-glue"]),i=new QJ.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var s=e.body[o],a=[],l=0;l<s.length;l++)a.push(new QJ.MathNode("mtd",[sY(s[l],t)]));e.tags&&e.tags[o]&&(a.unshift(r),a.push(r),e.leqno?a.unshift(i):a.push(i)),n.push(new QJ.MathNode("mtr",a))}var c=new QJ.MathNode("mtable",n),h=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",pG(h));var u="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,f="",m=!1,g=0,v=p.length;"separator"===p[0].type&&(u+="top ",g=1),"separator"===p[p.length-1].type&&(u+="bottom ",v-=1);for(var y=g;y<v;y++)"align"===p[y].type?(d+=xX[p[y].align],m&&(f+="none "),m=!0):"separator"===p[y].type&&m&&(f+="|"===p[y].separator?"solid ":"dashed ",m=!1);c.setAttribute("columnalign",d.trim()),/[sd]/.test(f)&&c.setAttribute("columnlines",f.trim())}if("align"===e.colSeparationType){for(var w=e.cols||[],b="",x=1;x<w.length;x++)b+=x%2?"0em ":"1em ";c.setAttribute("columnspacing",b.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var k="",S=e.hLinesBeforeRow;u+=S[0].length>0?"left ":"",u+=S[S.length-1].length>0?"right ":"";for(var C=1;C<S.length-1;C++)k+=0===S[C].length?"none ":S[C][0]?"dashed ":"solid ";return/[sd]/.test(k)&&c.setAttribute("rowlines",k.trim()),""!==u&&(c=new QJ.MathNode("menclose",[c])).setAttribute("notation",u.trim()),e.arraystretch&&e.arraystretch<1&&(c=new QJ.MathNode("mstyle",[c])).setAttribute("scriptlevel","1"),c},SX=function(e,t){-1===e.envName.indexOf("ed")&&gX(e);var n,r=[],i=e.envName.indexOf("at")>-1?"alignat":"align",o="split"===e.envName,s=yX(e.parser,{cols:r,addJot:!0,autoTag:o?void 0:vX(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),a=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",h=0;h<t[0].body.length;h++){c+=mY(t[0].body[h],"textord").text}n=Number(c),a=2*n}var u=!a;s.body.forEach(function(e){for(var t=1;t<e.length;t+=2){var r=mY(e[t],"styling");mY(r.body[0],"ordgroup").body.unshift(l)}if(u)a<e.length&&(a=e.length);else{var i=e.length/2;if(n<i)throw new EK("Too many math in a row: expected "+n+", but got "+i,e[0])}});for(var d=0;d<a;++d){var p="r",f=0;d%2==1?p="l":d>0&&u&&(f=1),r[d]={type:"align",align:p,pregap:f,postgap:0}}return s.colSeparationType=u?"align":"alignat",s};dX({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(vY(t[0])?[t[0]]:mY(t[0],"ordgroup").body).map(function(e){var t=gY(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new EK("Unknown column alignment: "+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return yX(e.parser,r,wX(e.envName))},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if("*"===e.envName.charAt(e.envName.length-1)){var i=e.parser;if(i.consumeSpaces(),"["===i.fetch().text){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,-1==="lcr".indexOf(n))throw new EK("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var o=yX(e.parser,r,wX(e.envName)),s=Math.max(0,...o.body.map(e=>e.length));return o.cols=new Array(s).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=yX(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(vY(t[0])?[t[0]]:mY(t[0],"ordgroup").body).map(function(e){var t=gY(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new EK("Unknown column alignment: "+t,e)});if(n.length>1)throw new EK("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=yX(e.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new EK("{subarray} can contain only one column");return r},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=yX(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},wX(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:SX,htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&gX(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:vX(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return yX(e.parser,t,"display")},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:SX,htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){gX(e);var t={autoTag:vX(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return yX(e.parser,t,"display")},htmlBuilder:bX,mathmlBuilder:kX}),dX({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(gX(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===t[t.length-1].length&&t.pop();break}throw new EK("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var r=[],i=[r],o=0;o<t.length;o++){for(var s=t[o],a=AY(),l=0;l<s.length;l++)if(OY(s[l])){r.push(a);var c=gY(s[l+=1]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(c)>-1);else{if(!("<>AV".indexOf(c)>-1))throw new EK('Expected one of "<>AV=|." after @',s[l]);for(var u=0;u<2;u++){for(var d=!0,p=l+1;p<s.length;p++){if(NY(s[p],c)){d=!1,l=p;break}if(OY(s[p]))throw new EK("Missing a "+c+" character to complete a CD arrow.",s[p]);h[u].body.push(s[p])}if(d)throw new EK("Missing a "+c+" character to complete a CD arrow.",s[l])}}var f={type:"styling",body:[EY(c,h,e)],mode:"math",style:"display"};r.push(f),a=AY()}else a.body.push(s[l]);o%2==0?r.push(a):r.shift(),r=[],i.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}(e.parser)),htmlBuilder:bX,mathmlBuilder:kX}),fX("\\nonumber","\\gdef\\@eqnsw{0}"),fX("\\notag","\\nonumber"),IJ({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new EK(e.funcName+" valid only within array environment")}});var CX=uX;IJ({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];if("ordgroup"!==i.type)throw new EK("Invalid environment name",i);for(var o="",s=0;s<i.body.length;++s)o+=mY(i.body[s],"textord").text;if("\\begin"===r){if(!CX.hasOwnProperty(o))throw new EK("No such environment: "+o,i);var a=CX[o],{args:l,optArgs:c}=n.parseArguments("\\begin{"+o+"}",a),h={mode:n.mode,envName:o,parser:n},u=a.handler(h,l,c);n.expect("\\end",!1);var d=n.nextToken,p=mY(n.parseFunction(),"environment");if(p.name!==o)throw new EK("Mismatch: \\begin{"+o+"} matched by \\end{"+p.name+"}",d);return u}return{type:"environment",mode:n.mode,name:o,nameGroup:i}}});var MX=(e,t)=>{var n=e.font,r=t.withFont(n);return KJ(e.body,r)},TX=(e,t)=>{var n=e.font,r=t.withFont(n);return sY(e.body,r)},AX={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};IJ({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=PJ(t[0]),o=r;return o in AX&&(o=AX[o]),{type:"font",mode:n.mode,font:o.slice(1),body:i}},htmlBuilder:MX,mathmlBuilder:TX}),IJ({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],i=RK.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:MY(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:i}}}),IJ({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:i}=e,{mode:o}=n,s=n.parseExpression(!0,i);return{type:"font",mode:o,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:s}}},htmlBuilder:MX,mathmlBuilder:TX});var OX=(e,t)=>{var n=t;return"display"===e?n=n.id>=KK.SCRIPT.id?n.text():KK.DISPLAY:"text"===e&&n.size===KK.DISPLAY.size?n=KK.TEXT:"script"===e?n=KK.SCRIPT:"scriptscript"===e&&(n=KK.SCRIPTSCRIPT),n},NX=(e,t)=>{var n,r=OX(e.size,t.style),i=r.fracNum(),o=r.fracDen();n=t.havingStyle(i);var s=KJ(e.numer,n,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<a?a:s.height,s.depth=s.depth<l?l:s.depth}n=t.havingStyle(o);var c,h,u,d,p,f,m,g,v,y,w=KJ(e.denom,n,t);if(e.hasBarLine?(e.barSize?(h=dG(e.barSize,t),c=SJ.makeLineSpan("frac-line",t,h)):c=SJ.makeLineSpan("frac-line",t),h=c.height,u=c.height):(c=null,h=0,u=t.fontMetrics().defaultRuleThickness),r.size===KK.DISPLAY.size||"display"===e.size?(d=t.fontMetrics().num1,p=h>0?3*u:7*u,f=t.fontMetrics().denom1):(h>0?(d=t.fontMetrics().num2,p=u):(d=t.fontMetrics().num3,p=3*u),f=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;d-s.depth-(b+.5*h)<p&&(d+=p-(d-s.depth-(b+.5*h))),b-.5*h-(w.height-f)<p&&(f+=p-(b-.5*h-(w.height-f)));var x=-(b-.5*h);m=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:c,shift:x},{type:"elem",elem:s,shift:-d}]},t)}else{var k=d-s.depth-(w.height-f);k<p&&(d+=.5*(p-k),f+=.5*(p-k)),m=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:s,shift:-d}]},t)}return n=t.havingStyle(r),m.height*=n.sizeMultiplier/t.sizeMultiplier,m.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===KK.DISPLAY.size?t.fontMetrics().delim1:r.size===KK.SCRIPTSCRIPT.size?t.havingStyle(KK.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?UJ(t,["mopen"]):iX.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),y=e.continued?SJ.makeSpan([]):null==e.rightDelim?UJ(t,["mclose"]):iX.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),SJ.makeSpan(["mord"].concat(n.sizingClasses(t)),[v,SJ.makeSpan(["mfrac"],[m]),y],t)},EX=(e,t)=>{var n=new QJ.MathNode("mfrac",[sY(e.numer,t),sY(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=dG(e.barSize,t);n.setAttribute("linethickness",pG(r))}}else n.setAttribute("linethickness","0px");var i=OX(e.size,t.style);if(i.size!==t.style.size){n=new QJ.MathNode("mstyle",[n]);var o=i.size===KK.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",o),n.setAttribute("scriptlevel","0")}if(null!=e.leftDelim||null!=e.rightDelim){var s=[];if(null!=e.leftDelim){var a=new QJ.MathNode("mo",[new QJ.TextNode(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),s.push(a)}if(s.push(n),null!=e.rightDelim){var l=new QJ.MathNode("mo",[new QJ.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),s.push(l)}return tY(s)}return n};IJ({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var n,{parser:r,funcName:i}=e,o=t[0],s=t[1],a=null,l=null,c="auto";switch(i){case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,a="(",l=")";break;case"\\\\bracefrac":n=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(i){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text"}return{type:"genfrac",mode:r.mode,continued:!1,numer:o,denom:s,hasBarLine:n,leftDelim:a,rightDelim:l,size:c,barSize:null}},htmlBuilder:NX,mathmlBuilder:EX}),IJ({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],o=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:i,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),IJ({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var t,{parser:n,funcName:r,token:i}=e;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:i}}});var DX=["display","text","script","scriptscript"],IX=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};IJ({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var n,{parser:r}=e,i=t[4],o=t[5],s=PJ(t[0]),a="atom"===s.type&&"open"===s.family?IX(s.text):null,l=PJ(t[1]),c="atom"===l.type&&"close"===l.family?IX(l.text):null,h=mY(t[2],"size"),u=null;n=!!h.isBlank||(u=h.value).number>0;var d="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var f=mY(p.body[0],"textord");d=DX[Number(f.text)]}}else p=mY(p,"textord"),d=DX[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:i,denom:o,continued:!1,hasBarLine:n,barSize:u,leftDelim:a,rightDelim:c,size:d}},htmlBuilder:NX,mathmlBuilder:EX}),IJ({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:i}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:mY(t[0],"size").value,token:i}}}),IJ({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],o=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(mY(t[1],"infix").size),s=t[2],a=o.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:s,continued:!1,hasBarLine:a,barSize:o,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:NX,mathmlBuilder:EX});var _X=(e,t)=>{var n,r,i=t.style;"supsub"===e.type?(n=e.sup?KJ(e.sup,t.havingStyle(i.sup()),t):KJ(e.sub,t.havingStyle(i.sub()),t),r=mY(e.base,"horizBrace")):r=mY(e,"horizBrace");var o,s=KJ(r.base,t.havingBaseStyle(KK.DISPLAY)),a=fY(r,t);if(r.isOver?(o=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(o=SJ.makeVList({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[0].classes.push("svg-align"),n){var l=SJ.makeSpan(["mord",r.isOver?"mover":"munder"],[o],t);o=r.isOver?SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},t):SJ.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return SJ.makeSpan(["mord",r.isOver?"mover":"munder"],[o],t)};IJ({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:t[0]}},htmlBuilder:_X,mathmlBuilder:(e,t)=>{var n=pY(e.label);return new QJ.MathNode(e.isOver?"mover":"munder",[sY(e.base,t),n])}}),IJ({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],i=mY(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:RJ(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=HJ(e.body,t,!1);return SJ.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=oY(e.body,t);return n instanceof XJ||(n=new XJ("mrow",[n])),n.setAttribute("href",e.href),n}}),IJ({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=mY(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],o=0;o<r.length;o++){var s=r[o];"~"===s&&(s="\\textasciitilde"),i.push({type:"textord",mode:"text",text:s})}var a={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:RJ(a)}}}),IJ({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:RJ(t[0])}},htmlBuilder(e,t){var n=HJ(e.body,t,!1);return SJ.makeFragment(n)},mathmlBuilder:(e,t)=>new QJ.MathNode("mrow",iY(e.body,t))}),IJ({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var n,{parser:r,funcName:i,token:o}=e,s=mY(t[0],"raw").string,a=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(i){case"\\htmlClass":l.class=s,n={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,n={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,n={command:"\\htmlStyle",style:s};break;case"\\htmlData":for(var c=s.split(","),h=0;h<c.length;h++){var u=c[h].split("=");if(2!==u.length)throw new EK("Error parsing key-value for \\htmlData");l["data-"+u[0].trim()]=u[1].trim()}n={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:RJ(a)}:r.formatUnsupportedCmd(i)},htmlBuilder:(e,t)=>{var n=HJ(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var i=SJ.makeSpan(r,n,t);for(var o in e.attributes)"class"!==o&&e.attributes.hasOwnProperty(o)&&i.setAttribute(o,e.attributes[o]);return i},mathmlBuilder:(e,t)=>oY(e.body,t)}),IJ({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:RJ(t[0]),mathml:RJ(t[1])}},htmlBuilder:(e,t)=>{var n=HJ(e.html,t,!1);return SJ.makeFragment(n)},mathmlBuilder:(e,t)=>oY(e.mathml,t)});var PX=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new EK("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!uG(n))throw new EK("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};IJ({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,i={number:0,unit:"em"},o={number:.9,unit:"em"},s={number:0,unit:"em"},a="";if(n[0])for(var l=mY(n[0],"raw").string.split(","),c=0;c<l.length;c++){var h=l[c].split("=");if(2===h.length){var u=h[1].trim();switch(h[0].trim()){case"alt":a=u;break;case"width":i=PX(u);break;case"height":o=PX(u);break;case"totalheight":s=PX(u);break;default:throw new EK("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var d=mY(t[0],"url").url;return""===a&&(a=(a=(a=d).replace(/^.*[\\/]/,"")).substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:o,totalheight:s,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=dG(e.height,t),r=0;e.totalheight.number>0&&(r=dG(e.totalheight,t)-n);var i=0;e.width.number>0&&(i=dG(e.width,t));var o={height:pG(n+r)};i>0&&(o.width=pG(i)),r>0&&(o.verticalAlign=pG(-r));var s=new xG(e.src,e.alt,o);return s.height=n,s.depth=r,s},mathmlBuilder:(e,t)=>{var n=new QJ.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var r=dG(e.height,t),i=0;if(e.totalheight.number>0&&(i=dG(e.totalheight,t)-r,n.setAttribute("valign",pG(-i))),n.setAttribute("height",pG(r+i)),e.width.number>0){var o=dG(e.width,t);n.setAttribute("width",pG(o))}return n.setAttribute("src",e.src),n}}),IJ({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=mY(t[0],"size");if(n.settings.strict){var o="m"===r[1],s="mu"===i.value.unit;o?(s||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+i.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):s&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder:(e,t)=>SJ.makeGlue(e.dimension,t),mathmlBuilder(e,t){var n=dG(e.dimension,t);return new QJ.SpaceNode(n)}}),IJ({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=SJ.makeSpan([],[KJ(e.body,t)]),n=SJ.makeSpan(["inner"],[n],t)):n=SJ.makeSpan(["inner"],[KJ(e.body,t)]);var r=SJ.makeSpan(["fix"],[]),i=SJ.makeSpan([e.alignment],[n,r],t),o=SJ.makeSpan(["strut"]);return o.style.height=pG(i.height+i.depth),i.depth&&(o.style.verticalAlign=pG(-i.depth)),i.children.unshift(o),i=SJ.makeSpan(["thinbox"],[i],t),SJ.makeSpan(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var n=new QJ.MathNode("mpadded",[sY(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),IJ({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,i=r.mode;r.switchMode("math");var o="\\("===n?"\\)":"$",s=r.parseExpression(!1,o);return r.expect(o),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:s}}}),IJ({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new EK("Mismatched "+e.funcName)}});var RX=(e,t)=>{switch(t.style.size){case KK.DISPLAY.size:return e.display;case KK.TEXT.size:return e.text;case KK.SCRIPT.size:return e.script;case KK.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};IJ({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:RJ(t[0]),text:RJ(t[1]),script:RJ(t[2]),scriptscript:RJ(t[3])}},htmlBuilder:(e,t)=>{var n=RX(e,t),r=HJ(n,t,!1);return SJ.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=RX(e,t);return oY(n,t)}});var LX=(e,t,n,r,i,o,s)=>{e=SJ.makeSpan([],[e]);var a,l,c,h=n&&RK.isCharacterBox(n);if(t){var u=KJ(t,r.havingStyle(i.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=KJ(n,r.havingStyle(i.sub()),r);a={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}if(l&&a){var p=r.fontMetrics().bigOpSpacing5+a.elem.height+a.elem.depth+a.kern+e.depth+s;c=SJ.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:pG(-o)},{type:"kern",size:a.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:pG(o)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(a){var f=e.height-s;c=SJ.makeVList({positionType:"top",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:pG(-o)},{type:"kern",size:a.kern},{type:"elem",elem:e}]},r)}else{if(!l)return e;var m=e.depth+s;c=SJ.makeVList({positionType:"bottom",positionData:m,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:pG(o)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}var g=[c];if(a&&0!==o&&!h){var v=SJ.makeSpan(["mspace"],[],r);v.style.marginRight=pG(o),g.unshift(v)}return SJ.makeSpan(["mop","op-limits"],g,r)},BX=["\\smallint"],zX=(e,t)=>{var n,r,i,o=!1;"supsub"===e.type?(n=e.sup,r=e.sub,i=mY(e.base,"op"),o=!0):i=mY(e,"op");var s,a=t.style,l=!1;if(a.size===KK.DISPLAY.size&&i.symbol&&!BX.includes(i.name)&&(l=!0),i.symbol){var c=l?"Size2-Regular":"Size1-Regular",h="";if("\\oiint"!==i.name&&"\\oiiint"!==i.name||(h=i.name.slice(1),i.name="oiint"===h?"\\iint":"\\iiint"),s=SJ.makeSymbol(i.name,c,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),h.length>0){var u=s.italic,d=SJ.staticSvg(h+"Size"+(l?"2":"1"),t);s=SJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:d,shift:l?.08:0}]},t),i.name="\\"+h,s.classes.unshift("mop"),s.italic=u}}else if(i.body){var p=HJ(i.body,t,!0);1===p.length&&p[0]instanceof SG?(s=p[0]).classes[0]="mop":s=SJ.makeSpan(["mop"],p,t)}else{for(var f=[],m=1;m<i.name.length;m++)f.push(SJ.mathsym(i.name[m],i.mode,t));s=SJ.makeSpan(["mop"],f,t)}var g=0,v=0;return(s instanceof SG||"\\oiint"===i.name||"\\oiiint"===i.name)&&!i.suppressBaseShift&&(g=(s.height-s.depth)/2-t.fontMetrics().axisHeight,v=s.italic),o?LX(s,n,r,t,a,v,g):(g&&(s.style.position="relative",s.style.top=pG(g)),s)},VX=(e,t)=>{var n;if(e.symbol)n=new XJ("mo",[eY(e.name,e.mode)]),BX.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new XJ("mo",iY(e.body,t));else{n=new XJ("mi",[new ZJ(e.name.slice(1))]);var r=new XJ("mo",[eY("⁡","text")]);n=e.parentIsSupSub?new XJ("mrow",[n,r]):YJ([n,r])}return n},FX={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};IJ({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=r;return 1===i.length&&(i=FX[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:zX,mathmlBuilder:VX}),IJ({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:RJ(r)}},htmlBuilder:zX,mathmlBuilder:VX});var HX={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};IJ({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zX,mathmlBuilder:VX}),IJ({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zX,mathmlBuilder:VX}),IJ({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,r=n;return 1===r.length&&(r=HX[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zX,mathmlBuilder:VX});var qX=(e,t)=>{var n,r,i,o,s=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,i=mY(e.base,"operatorname"),s=!0):i=mY(e,"operatorname"),i.body.length>0){for(var a=i.body.map(e=>{var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e}),l=HJ(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var h=l[c];h instanceof SG&&(h.text=h.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=SJ.makeSpan(["mop"],l,t)}else o=SJ.makeSpan(["mop"],[],t);return s?LX(o,n,r,t,t.style,0,0):o};function jX(e,t,n){for(var r=HJ(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,o=0;o<r.length;o++){var s=r[o].classes.indexOf("sizing");s<0?Array.prototype.push.apply(r[o].classes,t.sizingClasses(n)):r[o].classes[s+1]==="reset-size"+t.size&&(r[o].classes[s+1]="reset-size"+n.size),r[o].height*=i,r[o].depth*=i}return SJ.makeFragment(r)}IJ({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"operatorname",mode:n.mode,body:RJ(i),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:qX,mathmlBuilder:(e,t)=>{for(var n=iY(e.body,t.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var o=n[i];if(o instanceof QJ.SpaceNode);else if(o instanceof QJ.MathNode)switch(o.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":var s=o.children[0];1===o.children.length&&s instanceof QJ.TextNode?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var a=n.map(e=>e.toText()).join("");n=[new QJ.TextNode(a)]}var l=new QJ.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new QJ.MathNode("mo",[eY("⁡","text")]);return e.parentIsSupSub?new QJ.MathNode("mrow",[l,c]):QJ.newDocumentFragment([l,c])}}),fX("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),_J({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?SJ.makeFragment(HJ(e.body,t,!1)):SJ.makeSpan(["mord"],HJ(e.body,t,!0),t),mathmlBuilder:(e,t)=>oY(e.body,t,!0)}),IJ({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=KJ(e.body,t.havingCrampedStyle()),r=SJ.makeLineSpan("overline-line",t),i=t.fontMetrics().defaultRuleThickness,o=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]},t);return SJ.makeSpan(["mord","overline"],[o],t)},mathmlBuilder(e,t){var n=new QJ.MathNode("mo",[new QJ.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new QJ.MathNode("mover",[sY(e.body,t),n]);return r.setAttribute("accent","true"),r}}),IJ({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:RJ(r)}},htmlBuilder:(e,t)=>{var n=HJ(e.body,t.withPhantom(),!1);return SJ.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=iY(e.body,t);return new QJ.MathNode("mphantom",n)}}),IJ({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=SJ.makeSpan([],[KJ(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),SJ.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=iY(RJ(e.body),t),r=new QJ.MathNode("mphantom",n),i=new QJ.MathNode("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),IJ({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=SJ.makeSpan(["inner"],[KJ(e.body,t.withPhantom())]),r=SJ.makeSpan(["fix"],[]);return SJ.makeSpan(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=iY(RJ(e.body),t),r=new QJ.MathNode("mphantom",n),i=new QJ.MathNode("mpadded",[r]);return i.setAttribute("width","0px"),i}}),IJ({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=mY(t[0],"size").value,i=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(e,t){var n=KJ(e.body,t),r=dG(e.dy,t);return SJ.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new QJ.MathNode("mpadded",[sY(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),IJ({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),IJ({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,i=n[0],o=mY(t[0],"size"),s=mY(t[1],"size");return{type:"rule",mode:r.mode,shift:i&&mY(i,"size").value,width:o.value,height:s.value}},htmlBuilder(e,t){var n=SJ.makeSpan(["mord","rule"],[],t),r=dG(e.width,t),i=dG(e.height,t),o=e.shift?dG(e.shift,t):0;return n.style.borderRightWidth=pG(r),n.style.borderTopWidth=pG(i),n.style.bottom=pG(o),n.width=r,n.height=i+o,n.depth=-o,n.maxFontSize=1.125*i*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=dG(e.width,t),r=dG(e.height,t),i=e.shift?dG(e.shift,t):0,o=t.color&&t.getColor()||"black",s=new QJ.MathNode("mspace");s.setAttribute("mathbackground",o),s.setAttribute("width",pG(n)),s.setAttribute("height",pG(r));var a=new QJ.MathNode("mpadded",[s]);return i>=0?a.setAttribute("height",pG(i)):(a.setAttribute("height",pG(i)),a.setAttribute("depth",pG(-i))),a.setAttribute("voffset",pG(i)),a}});var $X=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];IJ({type:"sizing",names:$X,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:i}=e,o=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:$X.indexOf(r)+1,body:o}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return jX(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=iY(e.body,n),i=new QJ.MathNode("mstyle",r);return i.setAttribute("mathsize",pG(n.sizeMultiplier)),i}}),IJ({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,i=!1,o=!1,s=n[0]&&mY(n[0],"ordgroup");if(s)for(var a="",l=0;l<s.body.length;++l){if("t"===(a=s.body[l].text))i=!0;else{if("b"!==a){i=!1,o=!1;break}o=!0}}else i=!0,o=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:i,smashDepth:o}},htmlBuilder:(e,t)=>{var n=SJ.makeSpan([],[KJ(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(e.smashDepth&&(n.depth=0,n.children))for(var i=0;i<n.children.length;i++)n.children[i].depth=0;var o=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t);return SJ.makeSpan(["mord"],[o],t)},mathmlBuilder:(e,t)=>{var n=new QJ.MathNode("mpadded",[sY(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),IJ({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,i=n[0],o=t[0];return{type:"sqrt",mode:r.mode,body:o,index:i}},htmlBuilder(e,t){var n=KJ(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=SJ.wrapFragment(n,t);var r=t.fontMetrics().defaultRuleThickness,i=r;t.style.id<KK.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,s=n.height+n.depth+o+r,{span:a,ruleWidth:l,advanceWidth:c}=iX.sqrtImage(s,t),h=a.height-l;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var u=a.height-n.height-o-l;n.style.paddingLeft=pG(c);var d=SJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+u)},{type:"elem",elem:a},{type:"kern",size:l}]},t);if(e.index){var p=t.havingStyle(KK.SCRIPTSCRIPT),f=KJ(e.index,p,t),m=.6*(d.height-d.depth),g=SJ.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:f}]},t),v=SJ.makeSpan(["root"],[g]);return SJ.makeSpan(["mord","sqrt"],[v,d],t)}return SJ.makeSpan(["mord","sqrt"],[d],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new QJ.MathNode("mroot",[sY(n,t),sY(r,t)]):new QJ.MathNode("msqrt",[sY(n,t)])}});var WX={display:KK.DISPLAY,text:KK.TEXT,script:KK.SCRIPT,scriptscript:KK.SCRIPTSCRIPT};IJ({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:i}=e,o=i.parseExpression(!0,n),s=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:s,body:o}},htmlBuilder(e,t){var n=WX[e.style],r=t.havingStyle(n).withFont("");return jX(e.body,r,t)},mathmlBuilder(e,t){var n=WX[e.style],r=t.havingStyle(n),i=iY(e.body,r),o=new QJ.MathNode("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return o.setAttribute("scriptlevel",s[0]),o.setAttribute("displaystyle",s[1]),o}});_J({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base;return n?"op"===n.type?n.limits&&(t.style.size===KK.DISPLAY.size||n.alwaysHandleSupSub)?zX:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===KK.DISPLAY.size||n.limits)?qX:null:"accent"===n.type?RK.isCharacterBox(n.base)?yY:null:"horizBrace"===n.type&&!e.sub===n.isOver?_X:null:null}(e,t);if(n)return n(e,t);var r,i,o,{base:s,sup:a,sub:l}=e,c=KJ(s,t),h=t.fontMetrics(),u=0,d=0,p=s&&RK.isCharacterBox(s);if(a){var f=t.havingStyle(t.style.sup());r=KJ(a,f,t),p||(u=c.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(l){var m=t.havingStyle(t.style.sub());i=KJ(l,m,t),p||(d=c.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}o=t.style===KK.DISPLAY?h.sup1:t.style.cramped?h.sup3:h.sup2;var g,v=t.sizeMultiplier,y=pG(.5/h.ptPerEm/v),w=null;if(i){var b=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof SG||b)&&(w=pG(-c.italic))}if(r&&i){u=Math.max(u,o,r.depth+.25*h.xHeight),d=Math.max(d,h.sub2);var x=4*h.defaultRuleThickness;if(u-r.depth-(i.height-d)<x){d=x-(u-r.depth)+i.height;var k=.8*h.xHeight-(u-r.depth);k>0&&(u+=k,d-=k)}var S=[{type:"elem",elem:i,shift:d,marginRight:y,marginLeft:w},{type:"elem",elem:r,shift:-u,marginRight:y}];g=SJ.makeVList({positionType:"individualShift",children:S},t)}else if(i){d=Math.max(d,h.sub1,i.height-.8*h.xHeight);var C=[{type:"elem",elem:i,marginLeft:w,marginRight:y}];g=SJ.makeVList({positionType:"shift",positionData:d,children:C},t)}else{if(!r)throw new Error("supsub must have either sup or sub.");u=Math.max(u,o,r.depth+.25*h.xHeight),g=SJ.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:r,marginRight:y}]},t)}var M=WJ(c,"right")||"mord";return SJ.makeSpan([M],[c,SJ.makeSpan(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var i,o=[sY(e.base,t)];if(e.sub&&o.push(sY(e.sub,t)),e.sup&&o.push(sY(e.sup,t)),r)i=n?"mover":"munder";else if(e.sub)if(e.sup){var s=e.base;i=s&&"op"===s.type&&s.limits&&t.style===KK.DISPLAY||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(t.style===KK.DISPLAY||s.limits)?"munderover":"msubsup"}else{var a=e.base;i=a&&"op"===a.type&&a.limits&&(t.style===KK.DISPLAY||a.alwaysHandleSupSub)||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(a.limits||t.style===KK.DISPLAY)?"munder":"msub"}else{var l=e.base;i=l&&"op"===l.type&&l.limits&&(t.style===KK.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===KK.DISPLAY)?"mover":"msup"}return new QJ.MathNode(i,o)}}),_J({type:"atom",htmlBuilder:(e,t)=>SJ.mathsym(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new QJ.MathNode("mo",[eY(e.text,e.mode)]);if("bin"===e.family){var r=nY(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var UX={mi:"italic",mn:"normal",mtext:"normal"};_J({type:"mathord",htmlBuilder:(e,t)=>SJ.makeOrd(e,t,"mathord"),mathmlBuilder(e,t){var n=new QJ.MathNode("mi",[eY(e.text,e.mode,t)]),r=nY(e,t)||"italic";return r!==UX[n.type]&&n.setAttribute("mathvariant",r),n}}),_J({type:"textord",htmlBuilder:(e,t)=>SJ.makeOrd(e,t,"textord"),mathmlBuilder(e,t){var n,r=eY(e.text,e.mode,t),i=nY(e,t)||"normal";return n="text"===e.mode?new QJ.MathNode("mtext",[r]):/[0-9]/.test(e.text)?new QJ.MathNode("mn",[r]):"\\prime"===e.text?new QJ.MathNode("mo",[r]):new QJ.MathNode("mi",[r]),i!==UX[n.type]&&n.setAttribute("mathvariant",i),n}});var KX={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},GX={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};_J({type:"spacing",htmlBuilder(e,t){if(GX.hasOwnProperty(e.text)){var n=GX[e.text].className||"";if("text"===e.mode){var r=SJ.makeOrd(e,t,"textord");return r.classes.push(n),r}return SJ.makeSpan(["mspace",n],[SJ.mathsym(e.text,e.mode,t)],t)}if(KX.hasOwnProperty(e.text))return SJ.makeSpan(["mspace",KX[e.text]],[],t);throw new EK('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!GX.hasOwnProperty(e.text)){if(KX.hasOwnProperty(e.text))return new QJ.MathNode("mspace");throw new EK('Unknown type of space "'+e.text+'"')}return new QJ.MathNode("mtext",[new QJ.TextNode(" ")])}});var JX=()=>{var e=new QJ.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};_J({type:"tag",mathmlBuilder(e,t){var n=new QJ.MathNode("mtable",[new QJ.MathNode("mtr",[JX(),new QJ.MathNode("mtd",[oY(e.body,t)]),JX(),new QJ.MathNode("mtd",[oY(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var YX={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},XX={"\\textbf":"textbf","\\textmd":"textmd"},ZX={"\\textit":"textit","\\textup":"textup"},QX=(e,t)=>{var n=e.font;return n?YX[n]?t.withTextFontFamily(YX[n]):XX[n]?t.withTextFontWeight(XX[n]):"\\emph"===n?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(ZX[n]):t};IJ({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"text",mode:n.mode,body:RJ(i),font:r}},htmlBuilder(e,t){var n=QX(e,t),r=HJ(e.body,n,!0);return SJ.makeSpan(["mord","text"],r,n)},mathmlBuilder(e,t){var n=QX(e,t);return oY(e.body,n)}}),IJ({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=KJ(e.body,t),r=SJ.makeLineSpan("underline-line",t),i=t.fontMetrics().defaultRuleThickness,o=SJ.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]},t);return SJ.makeSpan(["mord","underline"],[o],t)},mathmlBuilder(e,t){var n=new QJ.MathNode("mo",[new QJ.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new QJ.MathNode("munder",[sY(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),IJ({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=KJ(e.body,t),r=t.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return SJ.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]},t)},mathmlBuilder:(e,t)=>new QJ.MathNode("mpadded",[sY(e.body,t)],["vcenter"])}),IJ({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new EK("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=eZ(e),r=[],i=t.havingStyle(t.style.text()),o=0;o<n.length;o++){var s=n[o];"~"===s&&(s="\\textasciitilde"),r.push(SJ.makeSymbol(s,"Typewriter-Regular",e.mode,i,["mord","texttt"]))}return SJ.makeSpan(["mord","text"].concat(i.sizingClasses(t)),SJ.tryCombineChars(r),i)},mathmlBuilder(e,t){var n=new QJ.TextNode(eZ(e)),r=new QJ.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var eZ=e=>e.body.replace(/ /g,e.star?"␣":" "),tZ=NJ,nZ="[ \r\n\t]",rZ="(\\\\[a-zA-Z@]+)"+nZ+"*",iZ="[̀-ͯ]",oZ=new RegExp(iZ+"+$"),sZ="("+nZ+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧‪-퟿豈-￿]"+iZ+"*|[\ud800-\udbff][\udc00-\udfff]"+iZ+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+rZ+"|\\\\[^\ud800-\udfff])";class aZ{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(sZ,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new NK("EOF",new OK(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new EK("Unexpected character: '"+e[t]+"'",new NK(e[t],new OK(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[r]){var i=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===i?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new NK(r,new OK(this,t,this.tokenRegex.lastIndex))}}class lZ{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new EK("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t}}var cZ=pX;fX("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),fX("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),fX("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),fX("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),fX("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),fX("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),fX("\\TextOrMath",function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var hZ={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};fX("\\char",function(e){var t,n=e.popToken(),r="";if("'"===n.text)t=8,n=e.popToken();else if('"'===n.text)t=16,n=e.popToken();else if("`"===n.text)if("\\"===(n=e.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new EK("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(null==(r=hZ[n.text])||r>=t)throw new EK("Invalid base-"+t+" digit "+n.text);for(var i;null!=(i=hZ[e.future().text])&&i<t;)r*=t,r+=i,e.popToken()}return"\\@char{"+r+"}"});var uZ=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(1!==i.length)throw new EK("\\newcommand's first argument must be a macro name");var o=i[0].text,s=e.isDefined(o);if(s&&!t)throw new EK("\\newcommand{"+o+"} attempting to redefine "+o+"; use \\renewcommand");if(!s&&!n)throw new EK("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var a=0;if(1===(i=e.consumeArg().tokens).length&&"["===i[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new EK("Invalid number of arguments: "+l);a=parseInt(l),i=e.consumeArg().tokens}return s&&r||e.macros.set(o,{tokens:i,numArgs:a}),""};fX("\\newcommand",e=>uZ(e,!1,!0,!1)),fX("\\renewcommand",e=>uZ(e,!0,!1,!1)),fX("\\providecommand",e=>uZ(e,!0,!0,!0)),fX("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join("")),""}),fX("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join("")),""}),fX("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),tZ[n],EG.math[n],EG.text[n]),""}),fX("\\bgroup","{"),fX("\\egroup","}"),fX("~","\\nobreakspace"),fX("\\lq","`"),fX("\\rq","'"),fX("\\aa","\\r a"),fX("\\AA","\\r A"),fX("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),fX("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),fX("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),fX("ℬ","\\mathscr{B}"),fX("ℰ","\\mathscr{E}"),fX("ℱ","\\mathscr{F}"),fX("ℋ","\\mathscr{H}"),fX("ℐ","\\mathscr{I}"),fX("ℒ","\\mathscr{L}"),fX("ℳ","\\mathscr{M}"),fX("ℛ","\\mathscr{R}"),fX("ℭ","\\mathfrak{C}"),fX("ℌ","\\mathfrak{H}"),fX("ℨ","\\mathfrak{Z}"),fX("\\Bbbk","\\Bbb{k}"),fX("·","\\cdotp"),fX("\\llap","\\mathllap{\\textrm{#1}}"),fX("\\rlap","\\mathrlap{\\textrm{#1}}"),fX("\\clap","\\mathclap{\\textrm{#1}}"),fX("\\mathstrut","\\vphantom{(}"),fX("\\underbar","\\underline{\\text{#1}}"),fX("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),fX("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),fX("\\ne","\\neq"),fX("≠","\\neq"),fX("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),fX("∉","\\notin"),fX("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),fX("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),fX("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),fX("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),fX("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),fX("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),fX("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),fX("⟂","\\perp"),fX("‼","\\mathclose{!\\mkern-0.8mu!}"),fX("∌","\\notni"),fX("⌜","\\ulcorner"),fX("⌝","\\urcorner"),fX("⌞","\\llcorner"),fX("⌟","\\lrcorner"),fX("©","\\copyright"),fX("®","\\textregistered"),fX("️","\\textregistered"),fX("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),fX("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),fX("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),fX("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),fX("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),fX("⋮","\\vdots"),fX("\\varGamma","\\mathit{\\Gamma}"),fX("\\varDelta","\\mathit{\\Delta}"),fX("\\varTheta","\\mathit{\\Theta}"),fX("\\varLambda","\\mathit{\\Lambda}"),fX("\\varXi","\\mathit{\\Xi}"),fX("\\varPi","\\mathit{\\Pi}"),fX("\\varSigma","\\mathit{\\Sigma}"),fX("\\varUpsilon","\\mathit{\\Upsilon}"),fX("\\varPhi","\\mathit{\\Phi}"),fX("\\varPsi","\\mathit{\\Psi}"),fX("\\varOmega","\\mathit{\\Omega}"),fX("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),fX("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),fX("\\boxed","\\fbox{$\\displaystyle{#1}$}"),fX("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),fX("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),fX("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),fX("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),fX("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var dZ={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};fX("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in dZ?t=dZ[n]:("\\not"===n.slice(0,4)||n in EG.math&&["bin","rel"].includes(EG.math[n].group))&&(t="\\dotsb"),t});var pZ={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};fX("\\dotso",function(e){return e.future().text in pZ?"\\ldots\\,":"\\ldots"}),fX("\\dotsc",function(e){var t=e.future().text;return t in pZ&&","!==t?"\\ldots\\,":"\\ldots"}),fX("\\cdots",function(e){return e.future().text in pZ?"\\@cdots\\,":"\\@cdots"}),fX("\\dotsb","\\cdots"),fX("\\dotsm","\\cdots"),fX("\\dotsi","\\!\\cdots"),fX("\\dotsx","\\ldots\\,"),fX("\\DOTSI","\\relax"),fX("\\DOTSB","\\relax"),fX("\\DOTSX","\\relax"),fX("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),fX("\\,","\\tmspace+{3mu}{.1667em}"),fX("\\thinspace","\\,"),fX("\\>","\\mskip{4mu}"),fX("\\:","\\tmspace+{4mu}{.2222em}"),fX("\\medspace","\\:"),fX("\\;","\\tmspace+{5mu}{.2777em}"),fX("\\thickspace","\\;"),fX("\\!","\\tmspace-{3mu}{.1667em}"),fX("\\negthinspace","\\!"),fX("\\negmedspace","\\tmspace-{4mu}{.2222em}"),fX("\\negthickspace","\\tmspace-{5mu}{.277em}"),fX("\\enspace","\\kern.5em "),fX("\\enskip","\\hskip.5em\\relax"),fX("\\quad","\\hskip1em\\relax"),fX("\\qquad","\\hskip2em\\relax"),fX("\\tag","\\@ifstar\\tag@literal\\tag@paren"),fX("\\tag@paren","\\tag@literal{({#1})}"),fX("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new EK("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),fX("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),fX("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),fX("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),fX("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),fX("\\newline","\\\\\\relax"),fX("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var fZ=pG(eG["Main-Regular"]["T".charCodeAt(0)][1]-.7*eG["Main-Regular"]["A".charCodeAt(0)][1]);fX("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+fZ+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),fX("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+fZ+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),fX("\\hspace","\\@ifstar\\@hspacer\\@hspace"),fX("\\@hspace","\\hskip #1\\relax"),fX("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),fX("\\ordinarycolon",":"),fX("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),fX("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),fX("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),fX("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),fX("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),fX("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),fX("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),fX("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),fX("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),fX("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),fX("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),fX("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),fX("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),fX("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),fX("∷","\\dblcolon"),fX("∹","\\eqcolon"),fX("≔","\\coloneqq"),fX("≕","\\eqqcolon"),fX("⩴","\\Coloneqq"),fX("\\ratio","\\vcentcolon"),fX("\\coloncolon","\\dblcolon"),fX("\\colonequals","\\coloneqq"),fX("\\coloncolonequals","\\Coloneqq"),fX("\\equalscolon","\\eqqcolon"),fX("\\equalscoloncolon","\\Eqqcolon"),fX("\\colonminus","\\coloneq"),fX("\\coloncolonminus","\\Coloneq"),fX("\\minuscolon","\\eqcolon"),fX("\\minuscoloncolon","\\Eqcolon"),fX("\\coloncolonapprox","\\Colonapprox"),fX("\\coloncolonsim","\\Colonsim"),fX("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),fX("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),fX("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),fX("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),fX("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),fX("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),fX("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),fX("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),fX("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),fX("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),fX("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),fX("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),fX("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),fX("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),fX("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),fX("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),fX("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),fX("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),fX("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),fX("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),fX("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),fX("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),fX("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),fX("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),fX("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),fX("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),fX("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),fX("\\imath","\\html@mathml{\\@imath}{ı}"),fX("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),fX("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),fX("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),fX("⟦","\\llbracket"),fX("⟧","\\rrbracket"),fX("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),fX("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),fX("⦃","\\lBrace"),fX("⦄","\\rBrace"),fX("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),fX("⦵","\\minuso"),fX("\\darr","\\downarrow"),fX("\\dArr","\\Downarrow"),fX("\\Darr","\\Downarrow"),fX("\\lang","\\langle"),fX("\\rang","\\rangle"),fX("\\uarr","\\uparrow"),fX("\\uArr","\\Uparrow"),fX("\\Uarr","\\Uparrow"),fX("\\N","\\mathbb{N}"),fX("\\R","\\mathbb{R}"),fX("\\Z","\\mathbb{Z}"),fX("\\alef","\\aleph"),fX("\\alefsym","\\aleph"),fX("\\Alpha","\\mathrm{A}"),fX("\\Beta","\\mathrm{B}"),fX("\\bull","\\bullet"),fX("\\Chi","\\mathrm{X}"),fX("\\clubs","\\clubsuit"),fX("\\cnums","\\mathbb{C}"),fX("\\Complex","\\mathbb{C}"),fX("\\Dagger","\\ddagger"),fX("\\diamonds","\\diamondsuit"),fX("\\empty","\\emptyset"),fX("\\Epsilon","\\mathrm{E}"),fX("\\Eta","\\mathrm{H}"),fX("\\exist","\\exists"),fX("\\harr","\\leftrightarrow"),fX("\\hArr","\\Leftrightarrow"),fX("\\Harr","\\Leftrightarrow"),fX("\\hearts","\\heartsuit"),fX("\\image","\\Im"),fX("\\infin","\\infty"),fX("\\Iota","\\mathrm{I}"),fX("\\isin","\\in"),fX("\\Kappa","\\mathrm{K}"),fX("\\larr","\\leftarrow"),fX("\\lArr","\\Leftarrow"),fX("\\Larr","\\Leftarrow"),fX("\\lrarr","\\leftrightarrow"),fX("\\lrArr","\\Leftrightarrow"),fX("\\Lrarr","\\Leftrightarrow"),fX("\\Mu","\\mathrm{M}"),fX("\\natnums","\\mathbb{N}"),fX("\\Nu","\\mathrm{N}"),fX("\\Omicron","\\mathrm{O}"),fX("\\plusmn","\\pm"),fX("\\rarr","\\rightarrow"),fX("\\rArr","\\Rightarrow"),fX("\\Rarr","\\Rightarrow"),fX("\\real","\\Re"),fX("\\reals","\\mathbb{R}"),fX("\\Reals","\\mathbb{R}"),fX("\\Rho","\\mathrm{P}"),fX("\\sdot","\\cdot"),fX("\\sect","\\S"),fX("\\spades","\\spadesuit"),fX("\\sub","\\subset"),fX("\\sube","\\subseteq"),fX("\\supe","\\supseteq"),fX("\\Tau","\\mathrm{T}"),fX("\\thetasym","\\vartheta"),fX("\\weierp","\\wp"),fX("\\Zeta","\\mathrm{Z}"),fX("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),fX("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),fX("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),fX("\\bra","\\mathinner{\\langle{#1}|}"),fX("\\ket","\\mathinner{|{#1}\\rangle}"),fX("\\braket","\\mathinner{\\langle{#1}\\rangle}"),fX("\\Bra","\\left\\langle#1\\right|"),fX("\\Ket","\\left|#1\\right\\rangle");var mZ=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.consumeArg().tokens,s=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=t=>n=>{e&&(n.macros.set("|",s),i.length&&n.macros.set("\\|",a));var o=t;!t&&i.length&&("|"===n.future().text&&(n.popToken(),o=!0));return{tokens:o?i:r,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,h=t.expandTokens([...o,...c,...n]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};fX("\\bra@ket",mZ(!1)),fX("\\bra@set",mZ(!0)),fX("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),fX("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),fX("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),fX("\\angln","{\\angl n}"),fX("\\blue","\\textcolor{##6495ed}{#1}"),fX("\\orange","\\textcolor{##ffa500}{#1}"),fX("\\pink","\\textcolor{##ff00af}{#1}"),fX("\\red","\\textcolor{##df0030}{#1}"),fX("\\green","\\textcolor{##28ae7b}{#1}"),fX("\\gray","\\textcolor{gray}{#1}"),fX("\\purple","\\textcolor{##9d38bd}{#1}"),fX("\\blueA","\\textcolor{##ccfaff}{#1}"),fX("\\blueB","\\textcolor{##80f6ff}{#1}"),fX("\\blueC","\\textcolor{##63d9ea}{#1}"),fX("\\blueD","\\textcolor{##11accd}{#1}"),fX("\\blueE","\\textcolor{##0c7f99}{#1}"),fX("\\tealA","\\textcolor{##94fff5}{#1}"),fX("\\tealB","\\textcolor{##26edd5}{#1}"),fX("\\tealC","\\textcolor{##01d1c1}{#1}"),fX("\\tealD","\\textcolor{##01a995}{#1}"),fX("\\tealE","\\textcolor{##208170}{#1}"),fX("\\greenA","\\textcolor{##b6ffb0}{#1}"),fX("\\greenB","\\textcolor{##8af281}{#1}"),fX("\\greenC","\\textcolor{##74cf70}{#1}"),fX("\\greenD","\\textcolor{##1fab54}{#1}"),fX("\\greenE","\\textcolor{##0d923f}{#1}"),fX("\\goldA","\\textcolor{##ffd0a9}{#1}"),fX("\\goldB","\\textcolor{##ffbb71}{#1}"),fX("\\goldC","\\textcolor{##ff9c39}{#1}"),fX("\\goldD","\\textcolor{##e07d10}{#1}"),fX("\\goldE","\\textcolor{##a75a05}{#1}"),fX("\\redA","\\textcolor{##fca9a9}{#1}"),fX("\\redB","\\textcolor{##ff8482}{#1}"),fX("\\redC","\\textcolor{##f9685d}{#1}"),fX("\\redD","\\textcolor{##e84d39}{#1}"),fX("\\redE","\\textcolor{##bc2612}{#1}"),fX("\\maroonA","\\textcolor{##ffbde0}{#1}"),fX("\\maroonB","\\textcolor{##ff92c6}{#1}"),fX("\\maroonC","\\textcolor{##ed5fa6}{#1}"),fX("\\maroonD","\\textcolor{##ca337c}{#1}"),fX("\\maroonE","\\textcolor{##9e034e}{#1}"),fX("\\purpleA","\\textcolor{##ddd7ff}{#1}"),fX("\\purpleB","\\textcolor{##c6b9fc}{#1}"),fX("\\purpleC","\\textcolor{##aa87ff}{#1}"),fX("\\purpleD","\\textcolor{##7854ab}{#1}"),fX("\\purpleE","\\textcolor{##543b78}{#1}"),fX("\\mintA","\\textcolor{##f5f9e8}{#1}"),fX("\\mintB","\\textcolor{##edf2df}{#1}"),fX("\\mintC","\\textcolor{##e0e5cc}{#1}"),fX("\\grayA","\\textcolor{##f6f7f7}{#1}"),fX("\\grayB","\\textcolor{##f0f1f2}{#1}"),fX("\\grayC","\\textcolor{##e3e5e6}{#1}"),fX("\\grayD","\\textcolor{##d6d8da}{#1}"),fX("\\grayE","\\textcolor{##babec2}{#1}"),fX("\\grayF","\\textcolor{##888d93}{#1}"),fX("\\grayG","\\textcolor{##626569}{#1}"),fX("\\grayH","\\textcolor{##3b3e40}{#1}"),fX("\\grayI","\\textcolor{##21242c}{#1}"),fX("\\kaBlue","\\textcolor{##314453}{#1}"),fX("\\kaGreen","\\textcolor{##71B307}{#1}");var gZ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class vZ{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new lZ(cZ,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new aZ(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:r,end:n}=this.consumeArg(["]"]))}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new NK("EOF",n.loc)),this.pushTokens(r),new NK("",OK.range(t,n))}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r,i=this.future(),o=0,s=0;do{if(r=this.popToken(),t.push(r),"{"===r.text)++o;else if("}"===r.text){if(-1===--o)throw new EK("Extra }",r)}else if("EOF"===r.text)throw new EK("Unexpected end of input in a macro argument, expected '"+(e&&n?e[s]:"}")+"'",r);if(e&&n)if((0===o||1===o&&"{"===e[s])&&r.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==o||n);return"{"===i.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:r}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new EK("The length of delimiters doesn't match the number of args!");for(var n=t[0],r=0;r<n.length;r++){var i=this.popToken();if(n[r]!==i.text)throw new EK("Use of the macro doesn't match its definition",i)}}for(var o=[],s=0;s<e;s++)o.push(this.consumeArg(t&&t[s+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new EK("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new EK("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs)for(var s=(i=i.slice()).length-1;s>=0;--s){var a=i[s];if("#"===a.text){if(0===s)throw new EK("Incomplete placeholder at end of macro body",a);if("#"===(a=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(a.text))throw new EK("Not a valid argument number",a);i.splice(s,2,...o[+a.text-1])}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new NK(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(!1===this.expandOnce(!0)){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var i=0;if(-1!==r.indexOf("#"))for(var o=r.replace(/##/g,"");-1!==o.indexOf("#"+(i+1));)++i;for(var s=new aZ(r,this.settings),a=[],l=s.lex();"EOF"!==l.text;)a.push(l),l=s.lex();return a.reverse(),{tokens:a,numArgs:i}}return r}isDefined(e){return this.macros.has(e)||tZ.hasOwnProperty(e)||EG.math.hasOwnProperty(e)||EG.text.hasOwnProperty(e)||gZ.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:tZ.hasOwnProperty(e)&&!tZ[e].primitive}}var yZ=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,wZ=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),bZ={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},xZ={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class kZ{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new vZ(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new EK("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new NK("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var r=this.fetch();if(-1!==kZ.endOfExpression.indexOf(r.text))break;if(t&&r.text===t)break;if(e&&tZ[r.text]&&tZ[r.text].infix)break;var i=this.parseAtom(t);if(!i)break;"internal"!==i.type&&n.push(i)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t,n=-1,r=0;r<e.length;r++)if("infix"===e[r].type){if(-1!==n)throw new EK("only one infix operator per group",e[r].token);n=r,t=e[r].replaceWith}if(-1!==n&&t){var i,o,s=e.slice(0,n),a=e.slice(n+1);return i=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},o=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},["\\\\abovefrac"===t?this.callFunction(t,[i,e[n],o],[]):this.callFunction(t,[i,o],[])]}return e}handleSupSubscript(e){var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var i;t=this.parseGroup(e)}while("internal"===(null==(i=t)?void 0:i.type));if(!t)throw new EK("Expected group after '"+r+"'",n);return t}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t,n,r=this.parseGroup("atom",e);if("internal"===(null==r?void 0:r.type))return r;if("text"===this.mode)return r;for(;;){this.consumeSpaces();var i=this.fetch();if("\\limits"===i.text||"\\nolimits"===i.text){if(r&&"op"===r.type){var o="\\limits"===i.text;r.limits=o,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new EK("Limit controls must follow a math operator",i);r.alwaysHandleSupSub&&(r.limits="\\limits"===i.text)}this.consume()}else if("^"===i.text){if(t)throw new EK("Double superscript",i);t=this.handleSupSubscript("superscript")}else if("_"===i.text){if(n)throw new EK("Double subscript",i);n=this.handleSupSubscript("subscript")}else if("'"===i.text){if(t)throw new EK("Double superscript",i);var s={type:"textord",mode:this.mode,text:"\\prime"},a=[s];for(this.consume();"'"===this.fetch().text;)a.push(s),this.consume();"^"===this.fetch().text&&a.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:a}}else{if(!wZ[i.text])break;var l=yZ.test(i.text),c=[];for(c.push(new NK(wZ[i.text])),this.consume();;){var h=this.fetch().text;if(!wZ[h])break;if(yZ.test(h)!==l)break;c.unshift(new NK(wZ[h])),this.consume()}var u=this.subparse(c);l?n={type:"ordgroup",mode:"math",body:u}:t={type:"ordgroup",mode:"math",body:u}}}return t||n?{type:"supsub",mode:this.mode,base:r,sup:t,sub:n}:r}parseFunction(e,t){var n=this.fetch(),r=n.text,i=tZ[r];if(!i)return null;if(this.consume(),t&&"atom"!==t&&!i.allowedInArgument)throw new EK("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n);if("text"===this.mode&&!i.allowedInText)throw new EK("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===i.allowedInMath)throw new EK("Can't use function '"+r+"' in math mode",n);var{args:o,optArgs:s}=this.parseArguments(r,i);return this.callFunction(r,o,s,n,e)}callFunction(e,t,n,r,i){var o={funcName:e,parser:this,token:r,breakOnTokenText:i},s=tZ[e];if(s&&s.handler)return s.handler(o,t,n);throw new EK("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<n;o++){var s=t.argTypes&&t.argTypes[o],a=o<t.numOptionalArgs;(t.primitive&&null==s||"sqrt"===t.type&&1===o&&null==i[0])&&(s="primitive");var l=this.parseGroupOfType("argument to '"+e+"'",s,a);if(a)i.push(l);else{if(null==l)throw new EK("Null argument, please report this as a bug");r.push(l)}}return{args:r,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text"}:null;case"raw":var i=this.parseStringGroup("raw",n);return null!=i?{type:"raw",mode:"text",string:i.text}:null;case"primitive":if(n)throw new EK("A primitive argument cannot be optional");var o=this.parseGroup(e);if(null==o)throw new EK("Expected group as "+e,this.fetch());return o;case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new EK("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(null==n)return null;for(var r,i="";"EOF"!==(r=this.fetch()).text;)i+=r.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n,r=this.fetch(),i=r,o="";"EOF"!==(n=this.fetch()).text&&e.test(o+n.text);)o+=(i=n).text,this.consume();if(""===o)throw new EK("Invalid "+t+": '"+r.text+"'",r);return r.range(i,o)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(null==t)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new EK("Invalid color: '"+t.text+"'",t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup("size",e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new EK("Invalid size: '"+t.text+"'",t);var i={number:+(r[1]+r[2]),unit:r[3]};if(!uG(i))throw new EK("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(r),o}parseGroup(e,t){var n,r=this.fetch(),i=r.text;if("{"===i||"\\begingroup"===i){this.consume();var o="{"===i?"}":"\\endgroup";this.gullet.beginGroup();var s=this.parseExpression(!1,o),a=this.fetch();this.expect(o),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:OK.range(r,a),body:s,semisimple:"\\begingroup"===i||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===i[0]&&!gZ.hasOwnProperty(i)){if(this.settings.throwOnError)throw new EK("Undefined control sequence: "+i,r);n=this.formatUnsupportedCmd(i),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n],i=r.text;"-"===i&&"-"===e[n+1].text&&(n+1<t&&"-"===e[n+2].text?(e.splice(n,3,{type:"textord",mode:"text",loc:OK.range(r,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:OK.range(r,e[n+1]),text:"--"}),t-=1)),"'"!==i&&"`"!==i||e[n+1].text!==i||(e.splice(n,2,{type:"textord",mode:"text",loc:OK.range(r,e[n+1]),text:i+i}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new EK("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}xZ.hasOwnProperty(t[0])&&!EG[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=xZ[t[0]]+t.slice(1));var i,o=oZ.exec(t);if(o&&("i"===(t=t.substring(0,o.index))?t="ı":"j"===t&&(t="ȷ")),EG[this.mode][t]){this.settings.strict&&"math"===this.mode&&lJ.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s,a=EG[this.mode][t].group,l=OK.range(e);if(OG.hasOwnProperty(a)){var c=a;s={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else s={type:a,mode:this.mode,loc:l,text:t};i=s}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(YK(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),i={type:"textord",mode:"text",loc:OK.range(e),text:t}}if(this.consume(),o)for(var h=0;h<o[0].length;h++){var u=o[0][h];if(!bZ[u])throw new EK("Unknown accent ' "+u+"'",e);var d=bZ[u][this.mode]||bZ[u].text;if(!d)throw new EK("Accent "+u+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:OK.range(e),label:d,isStretchy:!1,isShifty:!0,base:i}}return i}}kZ.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var SZ=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new kZ(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new EK("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new NK("\\df@tag")])}]}return r},CZ=function(e,t,n){t.textContent="";var r=TZ(e,n).toNode();t.appendChild(r)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),CZ=function(){throw new EK("KaTeX doesn't work in quirks mode.")});var MZ=function(e,t,n){if(n.throwOnError||!(e instanceof EK))throw e;var r=SJ.makeSpan(["katex-error"],[new SG(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},TZ=function(e,t){var n=new zK(t);try{return function(e,t,n){var r,i=lY(n);if("mathml"===n.output)return aY(e,t,i,n.displayMode,!0);if("html"===n.output){var o=JJ(e,i);r=SJ.makeSpan(["katex"],[o])}else{var s=aY(e,t,i,n.displayMode,!1),a=JJ(e,i);r=SJ.makeSpan(["katex"],[s,a])}return cY(r,n)}(SZ(e,n),e,n)}catch(t){return MZ(t,e,n)}},AZ={version:"0.16.25",render:CZ,renderToString:function(e,t){return TZ(e,t).toMarkup()},ParseError:EK,SETTINGS_SCHEMA:LK,__parse:function(e,t){var n=new zK(t);return SZ(e,n)},__renderToDomTree:TZ,__renderToHTMLTree:function(e,t){var n=new zK(t);try{return function(e,t,n){var r=JJ(e,lY(n)),i=SJ.makeSpan(["katex"],[r]);return cY(i,n)}(SZ(e,n),0,n)}catch(t){return MZ(t,e,n)}},__setFontMetrics:function(e,t){eG[e]=t},__defineSymbol:DG,__defineFunction:IJ,__defineMacro:fX,__domTree:{Span:wG,Anchor:bG,SymbolNode:SG,SvgNode:CG,PathNode:MG,LineNode:TG}};class OZ{constructor(e){this.#G=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ie=(e,t)=>{const{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:s}=i,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(!this.#G){(this.#re??e.dom.parentElement??document.body).appendChild(this.element),this.#G=!0}if(r||c)return;if(!this.#oe(e,t))return void this.hide();JT({getBoundingClientRect:()=>Fm(e,a,l)},this.element,{placement:this.#ne.placement??"top",middleware:[GT(),UT(this.#se),KT(this.#ue),...this.#te]}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()},this.update=(e,t)=>{this.#ae(e,t)},this.destroy=()=>{this.#ae.cancel()},this.show=e=>{this.element.dataset.show="true",e&&JT(e,this.element,{placement:"top",middleware:[GT(),UT(this.#se),KT(this.#ue),...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#le=e.debounce??200,this.#oe=e.shouldShow??this.#ce,this.#se=e.offset,this.#ue=e.shift,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.element.dataset.show="false",this.#ae=at(this.#ie,this.#le)}#le;#oe;#te;#ne;#re;#G;#se;#ue;#ae;#ie;#ce(e){const{doc:t,selection:n}=e.state,{empty:r,from:i,to:o}=n,s=!t.textBetween(i,o).length&&e.state.selection instanceof Df,a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable;return!(l||r||s||c)}}function NZ(e){const t=CM({},`${e}_TOOLTIP_SPEC`),n=xM(n=>{const r=n.get(t.key);return new Uf({key:new Jf(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}const EZ={tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0;let s=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),a(t)};function a(t){return 36===t?(e.consume(t),s++,a):s<2?n(t):(e.exit("mathFlowFenceSequence"),Eg(e,l,"whitespace")(t))}function l(t){return null===t||Cg(t)?h(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return null===t||Cg(t)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(t)):36===t?n(t):(e.consume(t),c)}function h(n){return e.exit("mathFlowFence"),r.interrupt?t(n):e.attempt(DZ,u,m)(n)}function u(t){return e.attempt({tokenize:g,partial:!0},m,d)(t)}function d(t){return(o?Eg(e,p,"linePrefix",o+1):p)(t)}function p(t){return null===t?m(t):Cg(t)?e.attempt(DZ,u,m)(t):(e.enter("mathFlowValue"),f(t))}function f(t){return null===t||Cg(t)?(e.exit("mathFlowValue"),p(t)):(e.consume(t),f)}function m(n){return e.exit("mathFlow"),t(n)}function g(e,t,n){let i=0;return Eg(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),o(t)},"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(t){return 36===t?(i++,e.consume(t),o):i<s?n(t):(e.exit("mathFlowFenceSequence"),Eg(e,a,"whitespace")(t))}function a(r){return null===r||Cg(r)?(e.exit("mathFlowFence"),t(r)):n(r)}}},concrete:!0,name:"mathFlow"},DZ={tokenize:function(e,t,n){const r=this;return function(n){if(null===n)return t(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0};function IZ(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),{tokenize:function(e,n,r){let i,o,s=0;return function(t){return e.enter("mathText"),e.enter("mathTextSequence"),a(t)};function a(n){return 36===n?(e.consume(n),s++,a):s<2&&!t?r(n):(e.exit("mathTextSequence"),l(n))}function l(t){return null===t?r(t):36===t?(o=e.enter("mathTextSequence"),i=0,h(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):Cg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("mathTextData"),c(t))}function c(t){return null===t||32===t||36===t||Cg(t)?(e.exit("mathTextData"),l(t)):(e.consume(t),c)}function h(t){return 36===t?(e.consume(t),i++,h):i===s?(e.exit("mathTextSequence"),e.exit("mathText"),n(t)):(o.type="mathTextData",c(t))}},resolve:_Z,previous:PZ,name:"mathText"}}function _Z(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("mathTextData"===e[t][1].type){e[r][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,r-=2;break}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="mathTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e}function PZ(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}const RZ={};function LZ(e){const t=e||RZ,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return{flow:{36:EZ},text:{36:IZ(e)}}}(t)),i.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){const t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;const r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e},mathFlowValue:e,mathText:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;n.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),o.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),n.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,n,r){const i=e.value||"",o=n.createTracker(r),s="$".repeat(Math.max(dy(i,"$")+1,2)),a=n.enter("mathFlow");let l=o.move(s);if(e.meta){const t=n.enter("mathFlowMeta");l+=o.move(n.safe(e.meta,{after:"\n",before:l,encode:["$"],...o.current()})),t()}return l+=o.move("\n"),i&&(l+=o.move(i+"\n")),l+=o.move(s),a(),l},inlineMath:n}};function n(e,n,r){let i=e.value||"",o=1;for(t||o++;new RegExp("(^|[^$])"+"\\$".repeat(o)+"([^$]|$)").test(i);)o++;const s="$".repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let a=-1;for(;++a<r.unsafe.length;){const e=r.unsafe[a];if(!e.atBreak)continue;const t=r.compilePattern(e);let n;for(;n=t.exec(i);){let e=n.index;10===i.codePointAt(e)&&13===i.codePointAt(e-1)&&e--,i=i.slice(0,e)+" "+i.slice(n.index+1)}}return s+i+s}}(t))}var BZ=Object.defineProperty,zZ=Object.getOwnPropertySymbols,VZ=Object.prototype.hasOwnProperty,FZ=Object.prototype.propertyIsEnumerable,HZ=(e,t,n)=>t in e?BZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qZ=(e,t)=>{for(var n in t||(t={}))VZ.call(t,n)&&HZ(e,n,t[n]);if(zZ)for(var n of zZ(t))FZ.call(t,n)&&HZ(e,n,t[n]);return e};function jZ(e,t){return Object.assign(e,{meta:qZ({package:"@milkdown/components"},t)}),e}var $Z=Object.defineProperty,WZ=Object.getOwnPropertySymbols,UZ=Object.prototype.hasOwnProperty,KZ=Object.prototype.propertyIsEnumerable,GZ=(e,t,n)=>t in e?$Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JZ=(e,t)=>{for(var n in t||(t={}))UZ.call(t,n)&&GZ(e,n,t[n]);if(WZ)for(var n of WZ(t))KZ.call(t,n)&&GZ(e,n,t[n]);return e};const YZ=CM(JZ({},{mode:"preview"}),"linkTooltipStateCtx");jZ(YZ,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const XZ=CM(JZ({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");jZ(YZ,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const ZZ=CM(JZ({},{linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");jZ(YZ,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const QZ=vM("ToggleLink",e=>()=>t=>{const{doc:n,selection:r}=t,i=OA.type(e);return n.rangeHasMark(r.from,r.to,i)?(e.get(XZ.key).removeLink(r.from,r.to),!0):(e.get(XZ.key).addLink(r.from,r.to),!0)}),eQ=NZ("LINK_PREVIEW");jZ(eQ[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),jZ(eQ[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const tQ=NZ("LINK_EDIT");function nQ({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}jZ(tQ[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),jZ(tQ[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),nQ.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const rQ=BI({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){const i=MD(t);P_(t,e=>{i.value=e});const o=()=>{n(i.value)},s=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),o()),"Escape"===e.key&&(e.preventDefault(),r())};return()=>vR("div",{class:"link-edit"},vR("input",{class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:s,onInput:e=>{i.value=e.target.value},value:i.value}),i.value?vR(nQ,{class:"button confirm",icon:e.value.confirmButton,onClick:o}):null)}});var iQ,oQ,sQ,aQ,lQ,cQ,hQ,uQ,dQ,pQ=Object.defineProperty,fQ=Object.defineProperties,mQ=Object.getOwnPropertyDescriptors,gQ=Object.getOwnPropertySymbols,vQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,wQ=e=>{throw TypeError(e)},bQ=(e,t,n)=>t in e?pQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xQ=(e,t)=>{for(var n in t||(t={}))vQ.call(t,n)&&bQ(e,n,t[n]);if(gQ)for(var n of gQ(t))yQ.call(t,n)&&bQ(e,n,t[n]);return e},kQ=(e,t)=>fQ(e,mQ(t)),SQ=(e,t,n)=>t.has(e)||wQ("Cannot "+n),CQ=(e,t,n)=>(SQ(e,t,"read from private field"),n?n.call(e):t.get(e)),MQ=(e,t,n)=>t.has(e)?wQ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),TQ=(e,t,n,r)=>(SQ(e,t,"write to private field"),t.set(e,n),n);const AQ={from:-1,to:-1,mark:null};class OQ{constructor(e,t){this.ctx=e,MQ(this,iQ),MQ(this,oQ),MQ(this,sQ,xQ({},AQ)),MQ(this,aQ),MQ(this,lQ),MQ(this,cQ,MD("")),MQ(this,hQ,()=>{CQ(this,oQ).hide(),this.ctx.update(YZ.key,e=>kQ(xQ({},e),{mode:"preview"})),TQ(this,sQ,xQ({},AQ))}),MQ(this,uQ,e=>{const t=this.ctx.get(cC),{from:n,to:r,mark:i}=CQ(this,sQ),o=OA.type(this.ctx),s=nB.sanitize(e);if(i&&i.attrs.href===s)return void CQ(this,hQ).call(this);const a=t.state.tr;i&&a.removeMark(n,r,i),a.addMark(n,r,o.create({href:s})),t.dispatch(a),CQ(this,hQ).call(this)}),MQ(this,dQ,(e,t,n)=>{const r=this.ctx.get(ZZ.key);CQ(this,lQ).value=r,CQ(this,cQ).value=e,this.ctx.update(YZ.key,e=>kQ(xQ({},e),{mode:"edit"}));const i=this.ctx.get(cC);i.dispatch(i.state.tr.setSelection(Df.create(i.state.doc,t,n))),CQ(this,oQ).show({getBoundingClientRect:()=>Fm(i,t,n)}),requestAnimationFrame(()=>{var e;null==(e=CQ(this,iQ).querySelector("input"))||e.focus()})}),this.update=e=>{const{state:t}=e,{selection:n}=t;if(!(n instanceof Df))return;const{from:r,to:i}=n;r===CQ(this,sQ).from&&i===CQ(this,sQ).to||CQ(this,hQ).call(this)},this.destroy=()=>{CQ(this,aQ).unmount(),CQ(this,oQ).destroy(),CQ(this,iQ).remove()},this.addLink=(e,t)=>{TQ(this,sQ,{from:e,to:t,mark:null}),CQ(this,dQ).call(this,"",e,t)},this.editLink=(e,t,n)=>{TQ(this,sQ,{from:t,to:n,mark:e}),CQ(this,dQ).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{const n=this.ctx.get(cC),r=n.state.tr;r.removeMark(e,t,OA.type(this.ctx)),n.dispatch(r),CQ(this,hQ).call(this)},TQ(this,lQ,MD(this.ctx.get(ZZ.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const r=JR(rQ,{config:CQ(this,lQ),src:CQ(this,cQ),onConfirm:CQ(this,uQ),onCancel:CQ(this,hQ)});r.mount(n),TQ(this,aQ,r),TQ(this,iQ,n),TQ(this,oQ,new OZ({content:n,debounce:0,shouldShow:()=>!1})),CQ(this,oQ).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},CQ(this,oQ).update(t)}}iQ=new WeakMap,oQ=new WeakMap,sQ=new WeakMap,aQ=new WeakMap,lQ=new WeakMap,cQ=new WeakMap,hQ=new WeakMap,uQ=new WeakMap,dQ=new WeakMap;var NQ=Object.defineProperty,EQ=Object.defineProperties,DQ=Object.getOwnPropertyDescriptors,IQ=Object.getOwnPropertySymbols,_Q=Object.prototype.hasOwnProperty,PQ=Object.prototype.propertyIsEnumerable,RQ=(e,t,n)=>t in e?NQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function LQ(e){let t;e.update(XZ.key,e=>{return n=((e,t)=>{for(var n in t||(t={}))_Q.call(t,n)&&RQ(e,n,t[n]);if(IQ)for(var n of IQ(t))PQ.call(t,n)&&RQ(e,n,t[n]);return e})({},e),EQ(n,DQ({addLink:(e,n)=>{null==t||t.addLink(e,n)},editLink:(e,n,r)=>{null==t||t.editLink(e,n,r)},removeLink:(e,n)=>{null==t||t.removeLink(e,n)}}));var n}),e.set(tQ.key,{view:n=>(t=new OQ(e,n),t)})}const BQ=BI({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){const i=e=>{e.preventDefault(),e.stopPropagation(),n.value()},o=e=>{e.preventDefault(),e.stopPropagation(),r.value()},s=n=>{n.preventDefault();const r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>vR("div",{class:"link-preview"},vR(nQ,{class:"button link-icon",icon:e.value.linkIcon,onClick:s}),vR("a",{href:t.value,target:"_blank",class:"link-display"},t.value),vR(nQ,{class:"button link-edit-button",icon:e.value.editButton,onClick:i}),vR(nQ,{class:"button link-remove-button",icon:e.value.removeButton,onClick:o}))}});var zQ,VQ,FQ,HQ,qQ,jQ,$Q,WQ,UQ,KQ,GQ,JQ,YQ,XQ=e=>{throw TypeError(e)},ZQ=(e,t,n)=>t.has(e)||XQ("Cannot "+n),QQ=(e,t,n)=>(ZQ(e,t,"read from private field"),n?n.call(e):t.get(e)),e0=(e,t,n)=>t.has(e)?XQ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),t0=(e,t,n,r)=>(ZQ(e,t,"write to private field"),t.set(e,n),n);class n0{constructor(e,t){this.ctx=e,e0(this,zQ),e0(this,VQ),e0(this,FQ,this.ctx.use(YZ.key)),e0(this,HQ),e0(this,qQ,MD("")),e0(this,jQ,MD(()=>{})),e0(this,$Q,MD(()=>{})),e0(this,WQ),e0(this,UQ,!1),e0(this,KQ,({mode:e})=>{"edit"===e&&QQ(this,YQ).call(this)}),e0(this,GQ,()=>{t0(this,UQ,!0)}),e0(this,JQ,()=>{t0(this,UQ,!1)}),e0(this,YQ,()=>{QQ(this,VQ).hide(),QQ(this,VQ).element.removeEventListener("mouseenter",QQ(this,GQ)),QQ(this,VQ).element.removeEventListener("mouseleave",QQ(this,JQ))}),this.show=(e,t,n,r)=>{QQ(this,HQ).value=this.ctx.get(ZZ.key),QQ(this,qQ).value=e.attrs.href,QQ(this,jQ).value=()=>{this.ctx.get(XZ.key).editLink(e,t,n)},QQ(this,$Q).value=()=>{this.ctx.get(XZ.key).removeLink(t,n),QQ(this,YQ).call(this)},QQ(this,VQ).show({getBoundingClientRect:()=>r}),QQ(this,VQ).element.addEventListener("mouseenter",QQ(this,GQ)),QQ(this,VQ).element.addEventListener("mouseleave",QQ(this,JQ))},this.hide=()=>{QQ(this,UQ)||QQ(this,YQ).call(this)},this.update=()=>{},this.destroy=()=>{QQ(this,WQ).unmount(),QQ(this,FQ).off(QQ(this,KQ)),QQ(this,VQ).destroy(),QQ(this,zQ).remove()},t0(this,HQ,MD(this.ctx.get(ZZ.key))),t0(this,WQ,JR(BQ,{config:QQ(this,HQ),src:QQ(this,qQ),onEdit:QQ(this,jQ),onRemove:QQ(this,$Q)})),t0(this,zQ,document.createElement("div")),QQ(this,zQ).className="milkdown-link-preview",QQ(this,WQ).mount(QQ(this,zQ)),t0(this,VQ,new OZ({debounce:0,content:QQ(this,zQ),shouldShow:()=>!1})),QQ(this,VQ).update(t),t0(this,FQ,e.use(YZ.key)),QQ(this,FQ).on(QQ(this,KQ))}}function r0(e){let t;const n=Xe((n,r)=>{if(!t)return;if(!n.hasFocus())return;if("edit"===e.get(YZ.key).mode)return;const i=function(e,t,n){const r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;const{pos:i}=r,o=t.state.doc.nodeAt(i);if(!o)return;const s=o.marks.find(t=>t.type===OA.mark.type(e));if(!s)return;return eQ.pluginKey()?{show:!0,pos:i,node:o,mark:s}:void 0}(e,n,r);if(i){const e=n.state.doc.resolve(i.pos),r=function(e,t,n,r,i){let o={start:-1,end:-1};return n.nodesBetween(r,i,(n,r)=>{if(o.start>-1)return!1;-1===o.start&&e.isInSet(n.marks)&&t===n&&(o={start:r,end:r+Math.max(n.textContent.length,1)})}),o}(i.mark,i.node,n.state.doc,e.before(),e.after()),o=r.start,s=r.end;t.show(i.mark,o,s,Fm(n,o,s))}else t.hide()},50);e.set(eQ.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>(t=new n0(e,n),t)})}function i0(e){r0(e),LQ(e)}zQ=new WeakMap,VQ=new WeakMap,FQ=new WeakMap,HQ=new WeakMap,qQ=new WeakMap,jQ=new WeakMap,$Q=new WeakMap,WQ=new WeakMap,UQ=new WeakMap,KQ=new WeakMap,GQ=new WeakMap,JQ=new WeakMap,YQ=new WeakMap;const o0=[YZ,XZ,ZZ,eQ,tQ,QZ].flat();var s0=Object.defineProperty,a0=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable,h0=(e,t,n)=>t in e?s0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u0=(e,t)=>{for(var n in t||(t={}))l0.call(t,n)&&h0(e,n,t[n]);if(a0)for(var n of a0(t))c0.call(t,n)&&h0(e,n,t[n]);return e};function d0(e,t){return Object.assign(e,{meta:u0({package:"@milkdown/components"},t)}),e}const p0=CM({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function f0({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}d0(p0,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),f0.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const m0=BI({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:r,readonly:i,setAttr:o,onMount:s,selected:a}){const l=e=>{null!=e&&e instanceof Element&&s(e)},c=e=>{e.stopPropagation(),e.preventDefault(),null!=t.value&&o("checked",!t.value)},h=gR(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:i.value})),u=gR(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>vR("li",{class:ZR("list-item",a.value&&"ProseMirror-selectednode")},vR("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},vR(f0,{class:ZR("label",i.value&&"readonly",u.value),icon:h.value})),vR("div",{class:"children",ref:l}))}}),g0=SM(TO.node,e=>(t,n,r)=>{const i=document.createElement("div");i.className="milkdown-list-item-block";const o=document.createElement("div");o.setAttribute("data-content-dom","true"),o.classList.add("content-dom");const s=MD(t.attrs.label),a=MD(t.attrs.checked),l=MD(t.attrs.listType),c=MD(!n.editable),h=e.get(p0.key),u=MD(!1),d=__(()=>{u.value?i.classList.add("selected"):i.classList.remove("selected")});let p=0;const f=JR(m0,{label:s,checked:a,listType:l,readonly:c,config:h,selected:u,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(i,e,t)))},onMount:e=>{const{anchor:t,head:r}=n.state.selection;e.appendChild(o);const i=n.state.doc.resolve(t),s=n.state.doc.resolve(r);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!i.doc.eq(n.state.doc))return;const e=new Df(i,s);n.dispatch(n.state.tr.setSelection(e))})}});f.mount(i);const m=e=>{l.value=e.attrs.listType,s.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:i,contentDOM:o,update:e=>e.type===t.type&&(e.sameMarkup(g)&&e.content.eq(g.content)||(g=e,m(e)),!0),ignoreMutation:e=>!i||!o||"selection"!==e.type&&(o===e.target&&"attributes"===e.type||!o.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{d(),f.unmount(),i.remove(),o.remove()}}});d0(g0,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const v0=[p0,g0];var y0=Object.defineProperty,w0=Object.getOwnPropertySymbols,b0=Object.prototype.hasOwnProperty,x0=Object.prototype.propertyIsEnumerable,k0=(e,t,n)=>t in e?y0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S0=(e,t)=>{for(var n in t||(t={}))b0.call(t,n)&&k0(e,n,t[n]);if(w0)for(var n of w0(t))x0.call(t,n)&&k0(e,n,t[n]);return e};function C0(e,t){return Object.assign(e,{meta:S0({package:"@milkdown/components"},t)}),e}var M0=Object.defineProperty,T0=Object.getOwnPropertySymbols,A0=Object.prototype.hasOwnProperty,O0=Object.prototype.propertyIsEnumerable,N0=(e,t,n)=>t in e?M0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const E0=CM(((e,t)=>{for(var n in t||(t={}))A0.call(t,n)&&N0(e,n,t[n]);if(T0)for(var n of T0(t))O0.call(t,n)&&N0(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function D0({icon:e,class:t,onClick:n}){return vR("span",{class:ZR("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=nB.sanitize(e.trim()))}})}function I0(e){const{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:s,rowHandleRef:a}=e,l=t.value;if(!l)return;const c=n.value;if(!c)return;const h=r.value;if(!h)return;const u=h.querySelector("tbody");if(!u)return;const d=l.querySelector("tbody");if(!d)return;const p=i.value;if(!p)return;const f=o.value;if(!f)return;const m=s.value;if(!m)return;const g=a.value;if(!g)return;return{preview:l,wrapper:c,content:h,contentRoot:u,previewRoot:d,yHandle:p,xHandle:f,colHandle:m,rowHandle:g}}function _0(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function P0(e,t,n,r,i){const{width:o,height:s}=r.querySelector("tbody").getBoundingClientRect();if("y"===e){const e=r.querySelectorAll("tr")[i];if(!e)return;n.appendChild(e.cloneNode(!0));const s=e.getBoundingClientRect().height;return Object.assign(t.style,{width:`${o}px`,height:`${s}px`}),void(t.dataset.show="true")}if("x"===e){const e=r.querySelectorAll("tr");let o;return Array.from(e).forEach(e=>{const t=e.children[i];if(!t)return;void 0===o&&(o=t.getBoundingClientRect().width);const r=t.parentElement.cloneNode(!1),s=t.cloneNode(!0);r.appendChild(s),n.appendChild(r)}),Object.assign(t.style,{width:`${o}px`,height:`${s}px`}),void(t.dataset.show="true")}}function R0(e,t,n,r){const{xHandle:i,yHandle:o,colHandle:s,rowHandle:a,preview:l}=n;i.dataset.displayType="y"===e?"indicator":"none",o.dataset.displayType="x"===e?"indicator":"none","y"===e?(s.dataset.show="false",B0(a)):(a.dataset.show="false",B0(s));const{hoverIndex:c,dragInfo:h}=r,[u,d]=c.value;h.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:d,endIndex:"y"===e?u:d,type:"y"===e?"row":"col"},l.dataset.direction="y"===e?"vertical":"horizontal"}function L0(e,t,n,r){const i=null==n?void 0:n.get(cC);if(!(null==i?void 0:i.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const o=I0(e);o&&requestAnimationFrame(()=>{r(o)})}function B0(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function z0(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return-1}function V0(e,[t,n]){const r=e.value;if(!r)return;const i=r.querySelectorAll("tr"),o=i[t];if(!o)return;const s=i[0];if(!s)return;const a=s.children[n];if(!a)return;const l=o.children[n];return l?{row:o,col:l,headerCol:a}:void 0}function F0({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:i,colHandleRef:o,hoverIndex:s}=e,a=o.value;if(!a)return;s.value=t;const l=V0(i,t);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",n&&n(a),JT(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function H0({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:i,rowHandleRef:o,hoverIndex:s}=e,a=o.value;if(!a)return;s.value=t;const l=V0(i,t);if(!l)return;const{row:c}=l;a.dataset.show="true",n&&n(a),JT(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function q0(e,t,n){const r="x"===n?"left":"top",i="x"===n?"right":"bottom",o=e.length-1,s=e.findIndex((e,n)=>{const s=e.getBoundingClientRect(),a=s[r],l=s[i];return a<=t&&t<=l||(n===o&&t>l||0===n&&t<a)}),a=e[s];return a?[a,s]:void 0}function j0(e){return at(t=>{const n=I0(e);if(!n)return;const{preview:r,content:i,contentRoot:o,xHandle:s,yHandle:a}=n,{dragInfo:l,hoverIndex:c}=e;if("false"===r.dataset.show)return;const h=V0(e.contentWrapperRef,c.value);if(!h)return;if(!o.querySelector("tr"))return;const u=l.value;if(!u)return;if(!o.offsetParent)return;const d=o.offsetParent.offsetTop,p=o.offsetParent.offsetLeft;if("col"===u.type){const e=h.col.getBoundingClientRect().width,{left:n,width:s}=o.getBoundingClientRect(),l=p-n,c=t.clientX+l-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";r.style.top=`${d}px`;const g=c<n+l-20?n+l-20:c>n+s+l-e+20?n+s+l-e+20:c;r.style.left=`${g}px`;const v=function(e,t){const n=e.querySelector("tr");if(!n)return;return q0(Array.from(n.children),t,"x")}(o,t.clientX);if(v){const[e,t]=v,n=a.getBoundingClientRect().width,r=i.getBoundingClientRect();u.endIndex=t,JT(e,a,{placement:"left"===m?"left":"right",middleware:[UT("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${r.height}px`,left:`${e}px`,top:`${d}px`})}).catch(console.error)}}else if("row"===u.type){const e=h.row.getBoundingClientRect().height,{top:n,height:a}=o.getBoundingClientRect(),l=d-n,c=t.clientY+l-e/2,[f,m]=u.startCoords,g=m<t.clientY?"down":"up",v=c<n+l-20?n+l-20:c>n+a+l-e+20?n+a+l-e+20:c;r.style.top=`${v}px`,r.style.left=`${p}px`;const y=function(e,t){return q0(Array.from(e.querySelectorAll("tr")),t,"y")}(o,t.clientY);if(y){const[e,t]=y,n=s.getBoundingClientRect().height,r=i.getBoundingClientRect();u.endIndex=t,JT(e,s,{placement:"up"===g?"top":"bottom",middleware:[UT("up"===g?-1*n:0)]}).then(({y:e})=>{s.dataset.show="true",Object.assign(s.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20)}function $0(e,t,n){const{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:o,dragInfo:s}=e,a=function(e,t){return n=>{L0(e,n,t,t=>{R0("y",n,t,e);const{preview:r,content:i,previewRoot:o}=t;_0(o);const{hoverIndex:s}=e,[a]=s.value;P0("y",r,o,i,a)})}}(e,t),l=function(e,t){return n=>{L0(e,n,t,t=>{R0("x",n,t,e);const{preview:r,content:i,previewRoot:o}=t,{hoverIndex:s}=e,[a,l]=s.value;_0(o),P0("x",r,o,i,l)})}}(e,t),c=()=>{const e=r.value;if(!e)return;if("false"===e.dataset.show)return;const t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},h=()=>{var a;const l=r.value;if(!l)return;const c=i.value;if(!c)return;const h=o.value;if(!h)return;const u=s.value;if(!u)return;if(!t)return;if("false"===l.dataset.show)return;if(!e.colHandleRef.value)return;if(!e.rowHandleRef.value)return;if(c.dataset.show="false",h.dataset.show="false",u.startIndex===u.endIndex)return;const d=t.get(DC),p={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};if("col"===u.type){d.call(oH.key,{pos:p.pos,index:u.startIndex}),d.call(rH.key,p);const t=[0,u.endIndex];F0({refs:e,index:t})}else{d.call(iH.key,{pos:p.pos,index:u.startIndex}),d.call(nH.key,p);const t=[u.endIndex,0];H0({refs:e,index:t})}requestAnimationFrame(()=>{t.get(cC).focus()})},u=j0(e);return ZI(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",h)}),n_(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",h)}),{dragRow:a,dragCol:l}}function W0(e,t){return at(n=>{if(!(null==t?void 0:t.editable))return;const{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=e,h=i.value;if(!h)return;const u=o.value;if(!u)return;const d=r.value;if(!d)return;const p=a.value;if(!p)return;const f=s.value;if(!f)return;const m=function(e,t){var n,r,i;if(t)try{const o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return;const s=null==o?void 0:o.inside;if(null==s||s<0)return;const a=t.state.doc.resolve(s),l=t.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],h=["table_row","table_header_row"],u=c.includes(l.type.name)?l:null==(n=qm(e=>c.includes(e.type.name))(a))?void 0:n.node,d=null==(r=qm(e=>h.includes(e.type.name))(a))?void 0:r.node,p=null==(i=qm(e=>"table"===e.type.name)(a))?void 0:i.node;if(!u||!d||!p)return;const f=z0(d,u);return[z0(p,d),f]}catch(e){return}}(n,t);if(!m)return;const g=V0(r,m);if(!g)return;const[v,y]=m,w=g.col.getBoundingClientRect(),b=Math.abs(n.clientX-w.left)<8,x=Math.abs(w.right-n.clientX)<8,k=Math.abs(n.clientY-w.top)<8,S=Math.abs(w.bottom-n.clientY)<8,C=b||x||k||S,M=p.querySelector(".button-group"),T=f.querySelector(".button-group");if(M&&(M.dataset.show="false"),T&&(T.dataset.show="false"),C){const e=d.getBoundingClientRect();p.dataset.show="false",f.dataset.show="false",u.dataset.displayType="tool",h.dataset.displayType="tool";const t=h.getBoundingClientRect().width,n=u.getBoundingClientRect().height;return b||x?(c.value[1]=b?y:y+1,JT(g.col,h,{placement:b?"left":"right",middleware:[UT(b?-1*t:0)]}).then(({x:t})=>{h.dataset.show="true",Object.assign(h.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):h.dataset.show="false",void(0!==m[0]&&(k||S)?(c.value[0]=k?v:v+1,JT(g.row,u,{placement:k?"top":"bottom",middleware:[UT(k?-1*n:0)]}).then(({y:t})=>{u.dataset.show="true",Object.assign(u.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):u.dataset.show="false")}c.value=[-1,-1],h.dataset.show="false",u.dataset.show="false",p.dataset.show="true",f.dataset.show="true",H0({refs:e,index:m}),F0({refs:e,index:m}),l.value=m},20)}function U0(e,t){const n=W0(e,t),r=function(e){return()=>{const{rowHandleRef:t,colHandleRef:n,yLineHandleRef:r,xLineHandleRef:i}=e;setTimeout(()=>{const e=t.value;if(!e)return;const o=n.value;if(!o)return;const s=r.value;if(!s)return;const a=i.value;a&&(e.dataset.show="false",o.dataset.show="false",s.dataset.show="false",a.dataset.show="false")},200)}}(e);return{pointerMove:n,pointerLeave:r}}C0(E0,{displayName:"Config<table-block>",group:"TableBlock"}),D0.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const K0=BI({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:r,config:i,onMount:o}){const s=MD(),a=e=>{null!=e&&(e instanceof HTMLElement?(s.value=e,o(e)):s.value=void 0)},l=MD(),c=MD(),h=MD(),u=MD(),d=MD(),p=MD(),f=MD([0,0]),m=MD([-1,-1]),g=MD(),v={dragPreviewRef:p,tableWrapperRef:d,contentWrapperRef:s,yLineHandleRef:u,xLineHandleRef:h,colHandleRef:l,rowHandleRef:c,hoverIndex:f,lineHoverIndex:m,dragInfo:g},{pointerLeave:y,pointerMove:w}=U0(v,e),{dragRow:b,dragCol:x}=$0(v,n,r),{onAddRow:k,onAddCol:S,selectCol:C,selectRow:M,deleteSelected:T,onAlign:A}=function(e,t,n){const{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:o,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=e;return{onAddRow:()=>{var e,o,s;if(!t)return;const a=r.value;if(!a)return;const[c]=l.value;if(c<0)return;if(!t.get(cC).editable)return;const h=Array.from(null!=(o=null==(e=i.value)?void 0:e.querySelectorAll("tr"))?o:[]),u=t.get(DC),d=(null!=(s=null==n?void 0:n())?s:0)+1;h.length===c?(u.call(iH.key,{pos:d,index:c-1}),u.call(uH.key)):(u.call(iH.key,{pos:d,index:c}),u.call(hH.key)),u.call(iH.key,{pos:d,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,o,s,a;if(!t)return;if(!r.value)return;const[c,h]=l.value;if(h<0)return;if(!t.get(cC).editable)return;const u=Array.from(null!=(s=null==(o=null==(e=i.value)?void 0:e.querySelector("tr"))?void 0:o.children)?s:[]),d=t.get(DC),p=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===h?(d.call(oH.key,{pos:p,index:h-1}),d.call(cH.key)):(d.call(oH.key,{pos:p,index:h}),d.call(lH.key)),d.call(oH.key,{pos:p,index:h})},selectCol:()=>{var e,r;if(!t)return;const[i,s]=a.value,l=t.get(DC),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(oH.key,{pos:c,index:s});const h=null==(r=o.value)?void 0:r.querySelector(".button-group");h&&(h.dataset.show="true"===h.dataset.show?"false":"true")},selectRow:()=>{var e,r;if(!t)return;const[i,o]=a.value,l=t.get(DC),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(iH.key,{pos:c,index:i});const h=null==(r=s.value)?void 0:r.querySelector(".button-group");h&&i>0&&(h.dataset.show="true"===h.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(cC).editable&&(e.preventDefault(),e.stopPropagation(),t.get(DC).call(aH.key),requestAnimationFrame(()=>{t.get(cC).focus()}))},onAlign:e=>n=>{t&&t.get(cC).editable&&(n.preventDefault(),n.stopPropagation(),t.get(DC).call(dH.key,e),requestAnimationFrame(()=>{t.get(cC).focus()}))}}}(v,n,r);return ZI(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n)return;if(!t)return;const{selection:r}=t.state;if(!(r instanceof QB))return;const{$from:i}=r,o=az(i);if(o&&o.node===n)if(r.isColSelection()){const{$head:t}=r;F0({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}})}else if(r.isRowSelection()){const{$head:t}=r,n=qm(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;const i=z0(o.node,n.node);H0({refs:e,index:[i,0],before:e=>{var t;i>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}(v,e,t.value)})}),()=>vR("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:w,onPointerleave:y},vR("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:x,onClick:C,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:l},vR(D0,{icon:i.renderButton("col_drag_handle")}),vR("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},vR("button",{type:"button",onPointerdown:A("left")},vR(D0,{icon:i.renderButton("align_col_left")})),vR("button",{type:"button",onPointerdown:A("center")},vR(D0,{icon:i.renderButton("align_col_center")})),vR("button",{type:"button",onPointerdown:A("right")},vR(D0,{icon:i.renderButton("align_col_right")})),vR("button",{type:"button",onPointerdown:T},vR(D0,{icon:i.renderButton("delete_col")})))),vR("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:b,onClick:M,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},vR(D0,{icon:i.renderButton("row_drag_handle")}),vR("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},vR("button",{type:"button",onPointerdown:T},vR(D0,{icon:i.renderButton("delete_row")})))),vR("div",{class:"table-wrapper",ref:d},vR("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},vR("table",null,vR("tbody",null))),vR("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:h},vR("button",{type:"button",onClick:k,class:"add-button"},vR(D0,{icon:i.renderButton("add_row")}))),vR("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},vR("button",{type:"button",onClick:S,class:"add-button"},vR(D0,{icon:i.renderButton("add_col")}))),vR("table",{ref:a,class:"children"})))}});var G0,J0,Y0=e=>{throw TypeError(e)},X0=(e,t,n)=>(((e,t,n)=>{t.has(e)||Y0("Cannot "+n)})(e,t,"access private method"),n);class Z0{constructor(e,t,n,r){var i,o,s;this.ctx=e,this.node=t,this.view=n,this.getPos=r,i=this,(o=G0).has(i)?Y0("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,s);const a=document.createElement("div");a.className="milkdown-table-block";const l=document.createElement("tbody");this.contentDOM=l,l.setAttribute("data-content-dom","true"),l.classList.add("content-dom"),this.nodeRef=TD(t);const c=JR(K0,{view:n,ctx:e,getPos:r,config:e.get(E0.key),onMount:e=>{e.appendChild(l)},node:this.nodeRef});c.mount(a),this.app=c,this.dom=a}update(e){return e.type===this.node.type&&((!e.sameMarkup(this.node)||!e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0))}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const t=e;return X0(this,G0,J0).call(this,t)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}G0=new WeakSet,J0=function(e){const t=this.view;if(!t.editable)return!1;const{state:n,dispatch:r}=t,i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return!1;const o=n.doc.resolve(i.inside),s=qm(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(o);if(!s)return!1;if(n.selection instanceof Df){const e=qm(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===s.node)return!1}const{from:a}=s,l=_f.create(n.doc,a+1);return!n.selection.eq(l)&&(n.selection instanceof QB?setTimeout(()=>{r(n.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(l).scrollIntoView())}),!0)};const Q0=SM(HF.node,e=>(t,n,r)=>new Z0(e,t,n,r));C0(Q0,{displayName:"NodeView<table-block>",group:"TableBlock"});const e1=[E0,Q0];function t1(e){if(!e)return!1;if(Array.isArray(e))return!(e.length>1)&&t1(e[0]);const t=e.content;return t?t1(t):"text"===e.type}const n1=xM(e=>{const t=e.get(MC);e.update(cM,e=>({...e,editable:e.editable??(()=>!0)}));const n=new Jf("MILKDOWN_CLIPBOARD"),r=new Uf({key:n,props:{handlePaste:(n,r)=>{const i=e.get(qC),o=n.props.editable?.(n.state),{clipboardData:s}=r;if(!o||!s)return!1;if(n.state.selection.$from.node().type.spec.code)return!1;const a=s.getData("text/plain"),l=s.getData("vscode-editor-data");if(l){const e=JSON.parse(l),r=e?.mode;if(a&&r){const{tr:e}=n.state,i=jm("code_block",t);return e.replaceSelectionWith(i.create({language:r})).setSelection(Df.near(e.doc.resolve(Math.max(0,e.selection.from-2)))).insertText(a.replace(/\r\n?/g,"\n")),n.dispatch(e),!0}}const c=s.getData("text/html");if(0===c.length&&0===a.length)return!1;const h=kp.fromSchema(t);let u;if(0===c.length){const e=i(a);if(!e||"string"==typeof e)return!1;u=Ip.fromSchema(t).serializeFragment(e.content)}else{const e=document.createElement("template");e.innerHTML=c,u=e.content.cloneNode(!0),e.remove()}const d=h.parseSlice(u),p=function(e){if(1===e.content.childCount){const t=e.content.firstChild;if("text"===(null==t?void 0:t.type.name)&&0===t.marks.length)return t;if("paragraph"===(null==t?void 0:t.type.name)&&1===t.childCount){const e=t.firstChild;if("text"===(null==e?void 0:e.type.name)&&0===e.marks.length)return e}}return!1}(d);if(p)return n.dispatch(n.state.tr.replaceSelectionWith(p,!0)),!0;try{return n.dispatch(n.state.tr.replaceSelection(d)),!0}catch{return!1}},clipboardTextSerializer:n=>{const r=e.get(GC);if(t1(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");const i=t.topNodeType.createAndFill(void 0,n.content);if(!i)return"";return r(i)}}});return r});function r1(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}!function(e,t){Object.assign(e,{meta:{package:"@milkdown/plugin-clipboard",...t}})}(n1,{displayName:"Prose<clipboard>"});const i1=vM("Undo",()=>()=>Tj);r1(i1,{displayName:"Command<undo>"});const o1=vM("Redo",()=>()=>Aj);r1(o1,{displayName:"Command<redo>"});const s1=CM({},"historyProviderConfig");r1(s1,{displayName:"Ctx<historyProviderConfig>"});const a1=xM(e=>Cj(e.get(s1.key)));r1(a1,{displayName:"Ctx<historyProviderPlugin>"});const l1=AM("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(DC);return()=>t.call(i1.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(DC);return()=>t.call(o1.key)}}});r1(l1.ctx,{displayName:"KeymapCtx<history>"}),r1(l1.shortcuts,{displayName:"Keymap<history>"});const c1=[s1,a1,l1,i1,o1].flat();const h1=CM({type:"space",size:2},"indentConfig");h1.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const u1=kM(e=>({Tab:(t,n)=>{const r=e.get(h1.key),{tr:i}=t,o=function(e,t){const{doc:n,selection:r}=e;if(!n||!r)return e;if(!(r instanceof Df||r instanceof Rf))return e;const{to:i}=r,o="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(o,i)}(i,r);return!!o.docChanged&&(n?.(o),!0)}}));u1.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const d1=[h1,u1];class p1{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}}const f1=Ym(new p1,"listener"),m1=new Jf("MILKDOWN_LISTENER"),g1=e=>(e.inject(f1,new p1),async()=>{await e.wait(xC);const t=e.get(f1),{listeners:n}=t;n.beforeMount.forEach(t=>t(e)),await e.wait(WC);const r=e.get(GC);let i=null,o=null,s=null;const a=new Uf({key:m1,view:()=>({destroy:()=>{n.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach(t=>t(e)),!1),blur:()=>(n.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{i=t.doc,o=r(t.doc)},apply:t=>{const a=t.selection;if((!s&&a||s&&!a.eq(s))&&(n.selectionUpdated.forEach(t=>{t(e,a,s)}),s=a),!t.docChanged||!1===t.getMeta("addToHistory"))return;const l=Xe(()=>{const{doc:s}=t;if(n.updated.length>0&&i&&!i.eq(s)&&n.updated.forEach(t=>{t(e,s,i)}),n.markdownUpdated.length>0&&i&&!i.eq(s)){const t=r(s);n.markdownUpdated.forEach(n=>{n(e,t,o)}),o=t}i=s},200);return l()}}});e.update(fC,e=>e.concat(a)),await e.wait(aM),n.mounted.forEach(t=>t(e))});g1.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const v1=CM({shouldAppend:e=>!!e&&!["heading","paragraph"].includes(e.type.name),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");v1.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};const y1=xM(e=>{const t=new Jf("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=e.get(v1.key),i=new Uf({key:t,state:{init:(e,t)=>{const r=t.tr.doc.lastChild;return n(r,t)},apply:(e,t,r,i)=>{if(!e.docChanged)return t;const o=e.doc.lastChild;return n(o,i)}},appendTransaction:(e,t,n)=>{const{doc:o,tr:s}=n,a=r?.(n),l=i.getState(n),c=o.content.size;if(l&&a)return s.insert(c,a)}});return i});y1.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};const w1=[v1,y1];var b1=(e=>(e.CodeMirror="code-mirror",e.ListItem="list-item",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.ImageBlock="image-block",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.Table="table",e.Latex="latex",e))(b1||{});const x1={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0},k1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M19.5 8.25l-7.5 7.5-7.5-7.5"\n />\n </svg>\n',S1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1098_15553)">\n <path\n d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1098_15553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',C1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8081)">\n <path\n d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8081">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',M1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n >\n <g clip-path="url(#clip0_1013_1606)">\n <path\n d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"\n fill="#817567"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1606">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',T1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="none"\n >\n <path\n d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"\n />\n </svg>\n',A1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="16"\n height="16"\n viewBox="0 0 16 16"\n >\n <path\n d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"\n />\n </svg>\n',O1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1013_1585)">\n <path\n d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1585">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',N1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8075)">\n <path\n d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8075">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',E1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7676)">\n <path\n d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7676">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',D1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"\n />\n </svg>\n',I1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"\n />\n </svg>\n',_1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"\n />\n </svg>\n',P1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n >\n <path\n d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"\n />\n </svg>\n',R1={[b1.CodeMirror]:{theme:Ad,languages:yd,expandIcon:k1,searchIcon:I1,clearSearchIcon:S1,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:e=>e?O1:P1}},L1=Ym([],"FeaturesCtx"),B1=Ym({},"CrepeCtx");function z1(e){return e.use("FeaturesCtx")}function V1(e){return t=>{z1(t).update(t=>t.includes(e)?t:[...t,e])}}function F1(e){return"code_block"===e.$from.parent.type.name}function H1(e){var t;const n=null==(t=e.$from.node(e.$from.depth-1))?void 0:t.type;return"list_item"===(null==n?void 0:n.name)}var q1,j1,$1=e=>{throw TypeError(e)},W1=(e,t,n)=>t.has(e)||$1("Cannot "+n),U1=(e,t,n)=>(W1(e,t,"read from private field"),n?n.call(e):t.get(e)),K1=(e,t,n)=>t.has(e)?$1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);class G1{constructor(){K1(this,q1,[]),this.clear=()=>{var e,t,n;return n=[],W1(e=this,t=q1,"write to private field"),t.set(e,n),this},K1(this,j1,e=>{const t={group:e,addItem:(n,r)=>{const i={...r,key:n};return e.items.push(i),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const n={key:e,label:t,items:[]};return U1(this,q1).push(n),U1(this,j1).call(this,n)},this.getGroup=e=>{const t=U1(this,q1).find(t=>t.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return U1(this,j1).call(this,t)},this.build=()=>U1(this,q1)}}q1=new WeakMap,j1=new WeakMap;const J1=BI({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:e,show:t,filter:n,hide:r,config:i}){const o=MD(),s=gR(()=>function(e,t,n){var r,i,o,s,a,l,c,h,u,d,p,f,m,g,v,y,w,b,x,k,S,C,M,T,A,O,N,E,D,I,_,P,R,L,B,z,V,F,H,q,j,$,W,U,K,G,J,Y,X,Z,Q,ee,te,ne,re,ie,oe,se,ae,le,ce,he,ue,de,pe,fe,me,ge,ve,ye,we,be,xe,ke,Se,Ce,Me,Te,Ae,Oe,Ne,Ee,De,Ie,_e,Pe,Re,Le,Be,ze,Ve,Fe,He,qe,je,$e,We,Ue,Ke,Ge,Je,Ye,Xe,Ze,Qe,et,tt,nt,rt,it,ot,st,at,lt,ct,ht,ut,dt,pt;const ft=n&&z1(n).get(),mt=null==ft?void 0:ft.includes(b1.Latex),gt=null==ft?void 0:ft.includes(b1.ImageBlock),vt=null==ft?void 0:ft.includes(b1.Table),yt=new G1;if(null!==(null==t?void 0:t.textGroup)){const e=yt.addGroup("text",null!=(i=null==(r=null==t?void 0:t.textGroup)?void 0:r.label)?i:"Text");null!==(null==(o=null==t?void 0:t.textGroup)?void 0:o.text)&&e.addItem("text",{label:null!=(l=null==(a=null==(s=null==t?void 0:t.textGroup)?void 0:s.text)?void 0:a.label)?l:"Text",icon:null!=(u=null==(h=null==(c=null==t?void 0:t.textGroup)?void 0:c.text)?void 0:h.icon)?u:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5547)">\n <path\n d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5547">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=RA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n})}}),null!==(null==(d=null==t?void 0:t.textGroup)?void 0:d.h1)&&e.addItem("h1",{label:null!=(m=null==(f=null==(p=null==t?void 0:t.textGroup)?void 0:p.h1)?void 0:f.label)?m:"Heading 1",icon:null!=(y=null==(v=null==(g=null==t?void 0:t.textGroup)?void 0:g.h1)?void 0:v.icon)?y:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5553)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:1}})}}),null!==(null==(w=null==t?void 0:t.textGroup)?void 0:w.h2)&&e.addItem("h2",{label:null!=(k=null==(x=null==(b=null==t?void 0:t.textGroup)?void 0:b.h2)?void 0:x.label)?k:"Heading 2",icon:null!=(M=null==(C=null==(S=null==t?void 0:t.textGroup)?void 0:S.h2)?void 0:C.icon)?M:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5559)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5559">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:2}})}}),null!==(null==(T=null==t?void 0:t.textGroup)?void 0:T.h3)&&e.addItem("h3",{label:null!=(N=null==(O=null==(A=null==t?void 0:t.textGroup)?void 0:A.h3)?void 0:O.label)?N:"Heading 3",icon:null!=(I=null==(D=null==(E=null==t?void 0:t.textGroup)?void 0:E.h3)?void 0:D.icon)?I:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5565)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5565">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:3}})}}),null!==(null==(_=null==t?void 0:t.textGroup)?void 0:_.h4)&&e.addItem("h4",{label:null!=(L=null==(R=null==(P=null==t?void 0:t.textGroup)?void 0:P.h4)?void 0:R.label)?L:"Heading 4",icon:null!=(V=null==(z=null==(B=null==t?void 0:t.textGroup)?void 0:B.h4)?void 0:z.icon)?V:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7757)">\n <path\n d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7757">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:4}})}}),null!==(null==(F=null==t?void 0:t.textGroup)?void 0:F.h5)&&e.addItem("h5",{label:null!=(j=null==(q=null==(H=null==t?void 0:t.textGroup)?void 0:H.h5)?void 0:q.label)?j:"Heading 5",icon:null!=(U=null==(W=null==($=null==t?void 0:t.textGroup)?void 0:$.h5)?void 0:W.icon)?U:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7760)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7760">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:5}})}}),null!==(null==(K=null==t?void 0:t.textGroup)?void 0:K.h6)&&e.addItem("h6",{label:null!=(Y=null==(J=null==(G=null==t?void 0:t.textGroup)?void 0:G.h6)?void 0:J.label)?Y:"Heading 6",icon:null!=(Q=null==(Z=null==(X=null==t?void 0:t.textGroup)?void 0:X.h6)?void 0:Z.icon)?Q:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7763)">\n <path\n d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7763">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=HA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n,attrs:{level:6}})}}),null!==(null==(ee=null==t?void 0:t.textGroup)?void 0:ee.quote)&&e.addItem("quote",{label:null!=(re=null==(ne=null==(te=null==t?void 0:t.textGroup)?void 0:te.quote)?void 0:ne.label)?re:"Quote",icon:null!=(se=null==(oe=null==(ie=null==t?void 0:t.textGroup)?void 0:ie.quote)?void 0:oe.icon)?se:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7897)">\n <path\n d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7897">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=KA.type(e);t.call(FO.key),t.call(qO.key,{nodeType:n})}}),null!==(null==(ae=null==t?void 0:t.textGroup)?void 0:ae.divider)&&e.addItem("divider",{label:null!=(he=null==(ce=null==(le=null==t?void 0:t.textGroup)?void 0:le.divider)?void 0:ce.label)?he:"Divider",icon:null!=(pe=null==(de=null==(ue=null==t?void 0:t.textGroup)?void 0:ue.divider)?void 0:de.icon)?pe:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7900)">\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7900">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=dO.type(e);t.call(FO.key),t.call(jO.key,{nodeType:n})}})}if(null!==(null==t?void 0:t.listGroup)){const e=yt.addGroup("list",null!=(me=null==(fe=null==t?void 0:t.listGroup)?void 0:fe.label)?me:"List");null!==(null==(ge=null==t?void 0:t.listGroup)?void 0:ge.bulletList)&&e.addItem("bullet-list",{label:null!=(we=null==(ye=null==(ve=null==t?void 0:t.listGroup)?void 0:ve.bulletList)?void 0:ye.label)?we:"Bullet List",icon:null!=(ke=null==(xe=null==(be=null==t?void 0:t.listGroup)?void 0:be.bulletList)?void 0:xe.icon)?ke:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8070)">\n <path\n d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8070">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=gO.type(e);t.call(FO.key),t.call(qO.key,{nodeType:n})}}),null!==(null==(Se=null==t?void 0:t.listGroup)?void 0:Se.orderedList)&&e.addItem("ordered-list",{label:null!=(Te=null==(Me=null==(Ce=null==t?void 0:t.listGroup)?void 0:Ce.orderedList)?void 0:Me.label)?Te:"Ordered List",icon:null!=(Ne=null==(Oe=null==(Ae=null==t?void 0:t.listGroup)?void 0:Ae.orderedList)?void 0:Oe.icon)?Ne:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8067)">\n <path\n d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8067">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=xO.type(e);t.call(FO.key),t.call(qO.key,{nodeType:n})}}),null!==(null==(Ee=null==t?void 0:t.listGroup)?void 0:Ee.taskList)&&e.addItem("task-list",{label:null!=(_e=null==(Ie=null==(De=null==t?void 0:t.listGroup)?void 0:De.taskList)?void 0:Ie.label)?_e:"Task List",icon:null!=(Le=null==(Re=null==(Pe=null==t?void 0:t.listGroup)?void 0:Pe.taskList)?void 0:Re.icon)?Le:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"\n />\n </svg>\n',onRun:e=>{const t=e.get(DC),n=TO.type(e);t.call(FO.key),t.call(qO.key,{nodeType:n,attrs:{checked:!1}})}})}if(null!==(null==t?void 0:t.advancedGroup)){const e=yt.addGroup("advanced",null!=(ze=null==(Be=null==t?void 0:t.advancedGroup)?void 0:Be.label)?ze:"Advanced");null!==(null==(Ve=null==t?void 0:t.advancedGroup)?void 0:Ve.image)&&gt&&e.addItem("image",{label:null!=(qe=null==(He=null==(Fe=null==t?void 0:t.advancedGroup)?void 0:Fe.image)?void 0:He.label)?qe:"Image",icon:null!=(We=null==($e=null==(je=null==t?void 0:t.advancedGroup)?void 0:je.image)?void 0:$e.icon)?We:N1,onRun:e=>{const t=e.get(DC),n=SB.type(e);t.call(FO.key),t.call(jO.key,{nodeType:n})}}),null!==(null==(Ue=null==t?void 0:t.advancedGroup)?void 0:Ue.codeBlock)&&e.addItem("code",{label:null!=(Je=null==(Ge=null==(Ke=null==t?void 0:t.advancedGroup)?void 0:Ke.codeBlock)?void 0:Ge.label)?Je:"Code",icon:null!=(Ze=null==(Xe=null==(Ye=null==t?void 0:t.advancedGroup)?void 0:Ye.codeBlock)?void 0:Xe.icon)?Ze:C1,onRun:e=>{const t=e.get(DC),n=ZA.type(e);t.call(FO.key),t.call(HO.key,{nodeType:n})}}),null!==(null==(Qe=null==t?void 0:t.advancedGroup)?void 0:Qe.table)&&vt&&e.addItem("table",{label:null!=(nt=null==(tt=null==(et=null==t?void 0:t.advancedGroup)?void 0:et.table)?void 0:tt.label)?nt:"Table",icon:null!=(ot=null==(it=null==(rt=null==t?void 0:t.advancedGroup)?void 0:rt.table)?void 0:it.icon)?ot:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8078)">\n <path\n d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8078">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(DC),n=e.get(cC);t.call(FO.key);const{from:r}=n.state.selection;t.call(jO.key,{nodeType:UF(e,3,3)}),t.call($O.key,{pos:r})}}),null!==(null==(st=null==t?void 0:t.advancedGroup)?void 0:st.math)&&mt&&e.addItem("math",{label:null!=(ct=null==(lt=null==(at=null==t?void 0:t.advancedGroup)?void 0:at.math)?void 0:lt.label)?ct:"Math",icon:null!=(dt=null==(ut=null==(ht=null==t?void 0:t.advancedGroup)?void 0:ht.math)?void 0:ut.icon)?dt:_1,onRun:e=>{const t=e.get(DC),n=ZA.type(e);t.call(FO.key),t.call(jO.key,{nodeType:n,attrs:{language:"LaTex"}})}})}null==(pt=null==t?void 0:t.buildMenu)||pt.call(t,yt);let wt=yt.build();e&&(wt=wt.map(t=>{const n=t.items.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()));return{...t,items:n}}).filter(e=>e.items.length>0));const bt=wt.flatMap(e=>e.items);return bt.forEach((e,t)=>{Object.assign(e,{index:t})}),wt.reduce((e,t)=>{const n=e+t.items.length;return Object.assign(t,{range:[e,n]}),n},0),{groups:wt,size:bt.length}}(n.value,i,e)),a=MD(0),l=MD({x:-999,y:-999}),c=e=>{const{x:t,y:n}=e;l.value={x:t,y:n}};P_([s,t],()=>{const{size:e}=s.value;0===e&&t.value?r():a.value>=e&&(a.value=0)});const h=(e,t)=>{const n=a.value,r="function"==typeof e?e(n):e;null==t||t(r),a.value=r},u=e=>{var t,n;const r=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e}"]`),i=null==(n=o.value)?void 0:n.querySelector(".menu-groups");r&&i&&(i.scrollTop=r.offsetTop-i.offsetTop)},d=t=>{const n=s.value.groups.flatMap(e=>e.items).at(t);n&&e&&n.onRun(e),r()},p=e=>{const{size:t,groups:n}=s.value;return"Escape"===e.key?(e.preventDefault(),void(null==r||r())):"ArrowDown"===e.key?(e.preventDefault(),h(e=>e<t-1?e+1:e,u)):"ArrowUp"===e.key?(e.preventDefault(),h(e=>e<=0?e:e-1,u)):"ArrowLeft"===e.key?(e.preventDefault(),h(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)-1];return r?r.range[1]-1:e},u)):"ArrowRight"===e.key?(e.preventDefault(),h(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)+1];return r?r.range[0]:e},u)):void("Enter"===e.key&&(e.preventDefault(),d(a.value)))},f=e=>t=>{const n=l.value;if(!n)return;const{x:r,y:i}=t;r===n.x&&i===n.y||h(e)};return __(()=>{t.value?window.addEventListener("keydown",p,{capture:!0}):window.removeEventListener("keydown",p,{capture:!0})}),n_(()=>{window.removeEventListener("keydown",p,{capture:!0})}),()=>vR("div",{ref:o,onPointerdown:e=>e.preventDefault()},vR("nav",{class:"tab-group"},vR("ul",null,s.value.groups.map(e=>vR("li",{key:e.key,onPointerdown:()=>h(e.range[0],u),class:a.value>=e.range[0]&&a.value<e.range[1]?"selected":""},e.label)))),vR("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(e=>vR("div",{key:e.key,class:"menu-group"},vR("h6",null,e.label),vR("ul",null,e.items.map(e=>vR("li",{key:e.key,"data-index":e.index,class:a.value===e.index?"hover":"",onPointerenter:f(e.index),onPointerdown:()=>{var t,n;null==(n=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.add("active")},onPointerup:()=>{var t,n;null==(n=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.remove("active"),d(e.index)}},vR(rB,{icon:e.icon}),vR("span",null,e.label))))))))}});var Y1,X1,Z1,Q1,e4,t4=e=>{throw TypeError(e)},n4=(e,t,n)=>t.has(e)||t4("Cannot "+n),r4=(e,t,n)=>(n4(e,t,"read from private field"),n?n.call(e):t.get(e)),i4=(e,t,n)=>t.has(e)?t4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),o4=(e,t,n,r)=>(n4(e,t,"write to private field"),t.set(e,n),n);const s4=function(e){const t=CM({},`${e}_SLASH_SPEC`),n=xM(n=>{const r=n.get(t.key);return new Uf({key:new Jf(`${e}_SLASH`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${e}`},n.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${e}`},r}("CREPE_MENU"),a4=CM({show:()=>{},hide:()=>{}},"menuAPICtx");class l4{constructor(e,t,n){i4(this,Y1),i4(this,X1),i4(this,Z1),i4(this,Q1),i4(this,e4,null),this.update=e=>{r4(this,Q1).update(e)},this.show=e=>{o4(this,e4,e),r4(this,Z1).value="",r4(this,Q1).show()},this.hide=()=>{o4(this,e4,null),r4(this,Q1).hide()},this.destroy=()=>{r4(this,Q1).destroy(),r4(this,X1).unmount(),r4(this,Y1).remove()};const r=document.createElement("div");r.classList.add("milkdown-slash-menu");const i=MD(!1),o=MD("");o4(this,Z1,o);const s=this.hide,a=JR(J1,{ctx:e,config:n,show:i,filter:o,hide:s});o4(this,X1,a),a.mount(r),o4(this,Y1,r);const l=this;o4(this,Q1,new YR({content:r4(this,Y1),debounce:20,shouldShow(e){if(F1(e.state.selection)||H1(e.state.selection))return!1;const t=this.getContent(e,e=>["paragraph","heading"].includes(e.type.name));if(null==t)return!1;if(!function(e){if(!(e instanceof Df))return!1;const{$head:t}=e,n=t.parent,r=t.parentOffset;return r===n.content.size}(e.state.selection))return!1;const n=r4(l,e4);if(o.value=t.startsWith("/")?t.slice(1):t,"number"==typeof n){const t=e.state.doc.nodeSize-2,r=Math.min(n,t);return e.state.doc.resolve(r).node()===e.state.doc.resolve(e.state.selection.from).node()||(o4(l,e4,null),!1)}return!!t.startsWith("/")},offset:10})),r4(this,Q1).onShow=()=>{i.value=!0},r4(this,Q1).onHide=()=>{i.value=!1},this.update(t),e.set(a4.key,{show:e=>this.show(e),hide:()=>this.hide()})}}Y1=new WeakMap,X1=new WeakMap,Z1=new WeakMap,Q1=new WeakMap,e4=new WeakMap;const c4=BI({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(e){const t=MD();return()=>vR(DP,null,vR("div",{ref:t,class:"operation-item",onPointerdown:e=>{var n;e.preventDefault(),e.stopPropagation(),null==(n=t.value)||n.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),null==(r=t.value)||r.classList.remove("active"),e.onAdd()}},vR(rB,{icon:e.addIcon})),vR("div",{class:"operation-item"},vR(rB,{icon:e.handleIcon})))}});var h4,u4,d4,p4,f4=e=>{throw TypeError(e)},m4=(e,t,n)=>t.has(e)||f4("Cannot "+n),g4=(e,t,n)=>(m4(e,t,"read from private field"),n?n.call(e):t.get(e)),v4=(e,t,n)=>t.has(e)?f4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),y4=(e,t,n,r)=>(m4(e,t,"write to private field"),t.set(e,n),n);class w4{constructor(e,t){var n,r,i;v4(this,h4),v4(this,u4),v4(this,d4),v4(this,p4),this.update=()=>{g4(this,u4).update()},this.destroy=()=>{g4(this,u4).destroy(),g4(this,h4).remove(),g4(this,d4).unmount()},this.onAdd=()=>{const e=g4(this,p4),t=e.get(cC);t.hasFocus()||t.focus();const{state:n,dispatch:r}=t,i=g4(this,u4).active;if(!i)return;const o=i.$pos.pos+i.node.nodeSize;let s=n.tr.insert(o,RA.type(e).create());s=s.setSelection(Df.near(s.doc.resolve(o))),r(s.scrollIntoView()),g4(this,u4).hide(),e.get(a4.key).show(s.selection.from)},y4(this,p4,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const s=JR(c4,{onAdd:this.onAdd,addIcon:null!=(n=null==t?void 0:t.handleAddIcon)?n:E1,handleIcon:null!=(r=null==t?void 0:t.handleDragIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7680)">\n <path\n d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7680">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'});s.mount(o),y4(this,d4,s),y4(this,h4,o);const a=null!=(i=null==t?void 0:t.blockHandle)?i:{};y4(this,u4,new iA({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:e,blockDom:t})=>{if("heading"===e.node.type.name)return"left";let n=0;e.node.descendants(e=>{n+=e.childCount});const r=e.el,i=r.getBoundingClientRect(),o=t.getBoundingClientRect(),s=window.getComputedStyle(r),a=Number.parseInt(s.paddingTop,10)||0,l=Number.parseInt(s.paddingBottom,10)||0,c=i.height-a-l,h=o.height;return n>2||h<c?"left-start":"left"},...a})),this.update()}}h4=new WeakMap,u4=new WeakMap,d4=new WeakMap,p4=new WeakMap;const b4=(e,t)=>{e.config(V1(b1.BlockEdit)).config(e=>function(e,t){e.set(XT.key,{filterNodes:e=>{const t=qm(e=>["table","blockquote","math_inline"].includes(e.type.name))(e);return!t}}),e.set(oA.key,{view:()=>new w4(e,t)})}(e,t)).config(e=>function(e,t){e.set(s4.key,{view:n=>new l4(e,n,t)})}(e,t)).use(a4).use(oA).use(s4)},x4=ZA.extendSchema(e=>t=>{const n=e(t);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(e,t)=>{var r,i;if("latex"!==(null!=(r=t.attrs.language)?r:"").toLowerCase())return n.toMarkdown.runner(e,t);e.addNode("math",void 0,(null==(i=t.content.firstChild)?void 0:i.text)||"")}}}}),k4="math_inline",S4=MM(k4,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${k4}"]`,getAttrs:e=>{var t;return{value:null!=(t=e.dataset.value)?t:""}}}],toDOM:e=>{const t=e.attrs.value,n=document.createElement("span");return n.dataset.type=k4,n.dataset.value=t,AZ.render(t,n,{throwOnError:!1}),n},parseMarkdown:{match:e=>"inlineMath"===e.type,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===k4,runner:(e,t)=>{e.addNode("inlineMath",void 0,t.attrs.value)}}})),C4=vM("ToggleLatex",e=>()=>(t,n)=>{const{hasNode:r,pos:i,target:o}=Um(t,S4.type(e)),{selection:s,doc:a,tr:l}=t;if(!r){const t=a.textBetween(s.from,s.to);let r=l.replaceSelectionWith(S4.type(e).create({value:t}));return n&&n(r.setSelection(_f.create(r.doc,s.from))),!0}const{from:c,to:h}=s;if(!o||i<0)return!1;let u=l.delete(i,i+1);const d=o.attrs.value;return u=u.insertText(d,i),n&&n(u.setSelection(Df.create(u.doc,c,h+d.length-1))),!0}),M4=NZ("INLINE_LATEX"),T4=BI({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(e){const t=t=>{if(t&&t instanceof HTMLElement){for(;t.firstChild;)t.removeChild(t.firstChild);e.innerView.value&&t.appendChild(e.innerView.value.dom)}},n=t=>{t.preventDefault(),e.updateValue.value()};return()=>vR("div",{class:"container"},e.innerView&&vR("div",{ref:t}),vR("button",{type:"button",onPointerdown:n},vR(rB,{icon:e.config.inlineEditConfirm})))}});var A4,O4,N4,E4,D4,I4,_4,P4,R4=e=>{throw TypeError(e)},L4=(e,t,n)=>t.has(e)||R4("Cannot "+n),B4=(e,t,n)=>(L4(e,t,"read from private field"),n?n.call(e):t.get(e)),z4=(e,t,n)=>t.has(e)?R4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),V4=(e,t,n,r)=>(L4(e,t,"write to private field"),t.set(e,n),n);class F4{constructor(e,t,n){this.ctx=e,z4(this,A4),z4(this,O4),z4(this,N4),z4(this,E4,TD(null)),z4(this,D4,TD(()=>{})),z4(this,I4),z4(this,_4,()=>{B4(this,E4).value&&(B4(this,E4).value.destroy(),B4(this,E4).value=null)}),z4(this,P4,e=>{const t=(()=>{const{selection:t,schema:n}=e.state;if(t.empty)return!1;if(!(t instanceof _f))return!1;const r=t.node;if(r.type.name!==k4)return!1;const i=t.from,o=n.nodes.paragraph.create(null,n.text(r.attrs.value)),s=new tC(B4(this,N4),{state:$f.create({doc:o,schema:new bp({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"}}}),plugins:[jb({"Mod-z":Tj,"Mod-Z":Aj,"Mod-y":Aj,Enter:()=>(B4(this,D4).value(),!0)})]})});return B4(this,E4).value=s,B4(this,D4).value=()=>{const{tr:t}=e.state;t.setNodeAttribute(i,"value",s.state.doc.textContent),e.dispatch(t),requestAnimationFrame(()=>{e.focus()})},!0})();return t||B4(this,_4).call(this),t}),this.update=(e,t)=>{B4(this,O4).update(e,t)},this.destroy=()=>{B4(this,I4).unmount(),B4(this,O4).destroy(),B4(this,A4).remove()};const r=document.createElement("div");r.className="milkdown-latex-inline-edit",V4(this,A4,r),V4(this,I4,JR(T4,{config:n,innerView:B4(this,E4),updateValue:B4(this,D4)})),B4(this,I4).mount(r),V4(this,O4,new OZ({debounce:0,content:B4(this,A4),shouldShow:B4(this,P4),offset:10,floatingUIOptions:{placement:"bottom"}})),B4(this,O4).update(t),V4(this,N4,document.createElement("div"))}}A4=new WeakMap,O4=new WeakMap,N4=new WeakMap,E4=new WeakMap,D4=new WeakMap,I4=new WeakMap,_4=new WeakMap,P4=new WeakMap;const H4=yM(e=>function(e,t,n={}){return new Yf(e,(e,r,i,o)=>{var s,a,l;const{tr:c}=e;let h=r[1],u=r[0];const d={group:h,fullMatch:u,start:i,end:o},p=null==(s=n.updateCaptured)?void 0:s.call(n,d);if(Object.assign(d,p),({group:h,fullMatch:u,start:i,end:o}=d),null===u)return null;if(!h||""===h.trim())return null;const f=null==(a=n.getAttr)?void 0:a.call(n,r),m=t.createAndFill(f);return m&&(c.replaceRangeWith(t.isBlock?c.doc.resolve(i).before():i,o,m),null==(l=n.beforeDispatch)||l.call(n,{match:[u,null!=h?h:""],start:i,end:o,tr:c})),c})}(/(?:\$)([^$]+)(?:\$)$/,S4.type(e),{getAttr:e=>{var t;return{value:null!=(t=e[1])?t:""}}})),q4=yM(e=>Qf(/^\$\$[\s\n]$/,ZA.type(e),()=>({language:"LaTeX"}))),j4=EM("remarkMath",()=>LZ);function $4(e){return Ay(e,"math",(e,t,n)=>{const{value:r}=e,i={type:"code",lang:"LaTeX",value:r};n.children.splice(t,1,i)})}const W4=EM("remarkMathBlock",()=>()=>$4),U4=(e,t)=>{e.config(V1(b1.Latex)).config(e=>{if(!z1(e).get().includes(b1.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");e.update(Rj.key,e=>({...e,renderPreview:(n,r,i)=>{if("latex"===n.toLowerCase()&&r.length>0)return function(e,t){const n=AZ.renderToString(e,{...t,throwOnError:!1,displayMode:!0});return n}(r,null==t?void 0:t.katexOptions);return(0,e.renderPreview)(n,r,i)}})),e.set(M4.key,{view:n=>{var r;return new F4(e,n,{inlineEditConfirm:null!=(r=null==t?void 0:t.inlineEditConfirm)?r:M1,...t})}})}).use(j4).use(W4).use(S4).use(M4).use(H4).use(q4).use(x4).use(C4)};const K4=(e,t)=>{e.config(V1(b1.ListItem)).config(e=>function(e,t){e.set(p0.key,{renderLabel:({label:e,listType:n,checked:r})=>{var i,o,s;return null==r?"bullet"===n?null!=(i=null==t?void 0:t.bulletIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_952_6527)">\n <circle cx="12" cy="12" r="3" />\n </g>\n <defs>\n <clipPath id="clip0_952_6527">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':e:r?null!=(o=null==t?void 0:t.checkBoxCheckedIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_1151)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_1151">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':null!=(s=null==t?void 0:t.checkBoxUncheckedIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_535)">\n <path\n d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_535">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'}})}(e,t)).use(v0)};const G4=CM({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),J4=xM(e=>new Uf({key:new Jf("CREPE_PLACEHOLDER"),props:{decorations:t=>{var n;const r=function(e){return e.get("CrepeCtx")}(e);if(r.readonly)return null;const i=e.get(G4.key);if("doc"===i.mode&&!function(e){var t;return e.childCount<=1&&!(null==(t=e.firstChild)?void 0:t.content.size)}(t.doc))return null;if(F1(t.selection)||H1(t.selection))return null;const o=function(e,t){const{selection:n}=e;if(!n.empty)return null;const r=n.$anchor,i=r.parent;if(i.content.size>0)return null;if(qm(e=>"table"===e.type.name)(r))return null;const o=r.before();return AS.node(o,o+i.nodeSize,{class:"crepe-placeholder","data-placeholder":t})}(t,null!=(n=i.text)?n:"Please enter...");return o?ES.create(t.doc,[o]):null}}}));const Y4=BI({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){const{ctx:t,config:n}=e;function r(n){e.selection.value;return t.get(dC).status===mM.Created&&n(t)}const i=gR(()=>function(e,t){var n,r,i,o,s,a,l;const c=new G1;c.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"\n />\n </svg>\n',active:e=>e.get(DC).call(zO.key,yA.type(e)),onRun:e=>{e.get(DC).call(wA.key)}}).addItem("italic",{icon:null!=(r=null==e?void 0:e.italicIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"\n />\n </svg>\n',active:e=>e.get(DC).call(zO.key,dA.type(e)),onRun:e=>{e.get(DC).call(pA.key)}}).addItem("strikethrough",{icon:null!=(i=null==e?void 0:e.strikethroughIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"\n />\n </svg>\n',active:e=>e.get(DC).call(zO.key,LF.type(e)),onRun:e=>{e.get(DC).call(BF.key)}});const h=c.addGroup("function","Function");h.addItem("code",{icon:null!=(o=null==e?void 0:e.codeIcon)?o:C1,active:e=>e.get(DC).call(zO.key,SA.type(e)),onRun:e=>{e.get(DC).call(CA.key)}});const u=t&&z1(t).get();return(null==u?void 0:u.includes(b1.Latex))&&h.addItem("latex",{icon:null!=(s=null==e?void 0:e.latexIcon)?s:_1,active:e=>e.get(DC).call(VO.key,S4.type(e)),onRun:e=>{e.get(DC).call(C4.key)}}),h.addItem("link",{icon:null!=(a=null==e?void 0:e.linkIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"\n />\n </svg>\n',active:e=>e.get(DC).call(zO.key,OA.type(e)),onRun:e=>{e.get(DC).call(QZ.key)}}),null==(l=null==e?void 0:e.buildToolbar)||l.call(e,c),c.build()}(n,t));return()=>vR(DP,null,i.value.map(e=>e.items.map(e=>{return vR("button",{type:"button",class:ZR("toolbar-item",t&&r(e.active)&&"active"),onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&n(t)})},vR(rB,{icon:e.icon}));var n})).reduce((e,t,n)=>(0===n?e.push(...t):e.push(vR("div",{class:"divider"}),...t),e),[]))}});var X4,Z4,Q4,e5,t5,n5=e=>{throw TypeError(e)},r5=(e,t,n)=>t.has(e)||n5("Cannot "+n),i5=(e,t,n)=>(r5(e,t,"read from private field"),n?n.call(e):t.get(e)),o5=(e,t,n)=>t.has(e)?n5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),s5=(e,t,n,r)=>(r5(e,t,"write to private field"),t.set(e,n),n);const a5=NZ("CREPE_TOOLBAR");class l5{constructor(e,t,n){o5(this,X4),o5(this,Z4),o5(this,Q4),o5(this,e5),o5(this,t5,MD(!1)),this.update=(e,t)=>{i5(this,X4).update(e,t),i5(this,e5).value=e.state.selection},this.destroy=()=>{i5(this,X4).destroy(),i5(this,Q4).unmount(),i5(this,Z4).remove()},this.hide=()=>{i5(this,X4).hide()};const r=document.createElement("div");r.className="milkdown-toolbar",s5(this,e5,TD(t.state.selection));const i=JR(Y4,{ctx:e,hide:this.hide,config:n,selection:i5(this,e5),show:i5(this,t5)});i.mount(r),s5(this,Z4,r),s5(this,Q4,i),s5(this,X4,new OZ({content:i5(this,Z4),debounce:20,offset:10,shouldShow(e){const{doc:t,selection:n}=e.state,{empty:i,from:o,to:s}=n,a=!t.textBetween(o,s).length&&n instanceof Df,l=!(n instanceof Df),c=e.dom.getRootNode().activeElement,h=r.contains(c),u=!e.hasFocus()&&!h,d=!e.editable;return!(u||l||i||a||d)}})),i5(this,X4).onShow=()=>{i5(this,t5).value=!0},i5(this,X4).onHide=()=>{i5(this,t5).value=!1},this.update(t)}}X4=new WeakMap,Z4=new WeakMap,Q4=new WeakMap,e5=new WeakMap,t5=new WeakMap;function c5(e,t,n){switch(e){case b1.CodeMirror:return((e,t={})=>{e.config(V1(b1.CodeMirror)).config(e=>{const{languages:n=[],theme:r}=t,i=[yl.of(aj.concat(lj)),qU];r&&i.push(r),t.extensions&&i.push(...t.extensions),e.update(Rj.key,e=>{var r;return{extensions:i,languages:n,expandIcon:t.expandIcon||k1,searchIcon:t.searchIcon||I1,clearSearchIcon:t.clearSearchIcon||S1,searchPlaceholder:t.searchPlaceholder||"Search language",copyText:t.copyText||"Copy",copyIcon:t.copyIcon||T1,onCopy:t.onCopy||(()=>{}),noResultText:t.noResultText||"No result",renderLanguage:t.renderLanguage||e.renderLanguage,renderPreview:t.renderPreview||e.renderPreview,previewToggleButton:e=>{var n,r;return[(null==(n=t.previewToggleIcon)?void 0:n.call(t,e))||(e?O1:P1),(null==(r=t.previewToggleText)?void 0:r.call(t,e))||(e?"Edit":"Hide")].map(e=>e.trim()).join(" ")},previewLabel:t.previewLabel||e.previewLabel,previewLoading:t.previewLoading||e.previewLoading,previewOnlyByDefault:null!=(r=t.previewOnlyByDefault)?r:e.previewOnlyByDefault}})}).use(Wj)})(t,n);case b1.ListItem:return K4(t,n);case b1.LinkTooltip:return((e,t)=>{e.config(V1(b1.LinkTooltip)).config(i0).config(e=>{e.update(ZZ.key,e=>{var n,r,i,o,s,a;return{...e,linkIcon:null!=(n=null==t?void 0:t.linkIcon)?n:T1,editButton:null!=(r=null==t?void 0:t.editButton)?r:O1,removeButton:null!=(i=null==t?void 0:t.removeButton)?i:D1,confirmButton:null!=(o=null==t?void 0:t.confirmButton)?o:M1,inputPlaceholder:null!=(s=null==t?void 0:t.inputPlaceholder)?s:"Paste link...",onCopyLink:null!=(a=null==t?void 0:t.onCopyLink)?a:()=>{}}})}).use(o0)})(t,n);case b1.ImageBlock:return((e,t)=>{e.config(V1(b1.ImageBlock)).config(e=>{e.update(xK.key,e=>{var n,r,i,o,s,a;return{uploadButton:null!=(n=null==t?void 0:t.inlineUploadButton)?n:"Upload",imageIcon:null!=(r=null==t?void 0:t.inlineImageIcon)?r:N1,confirmButton:null!=(i=null==t?void 0:t.inlineConfirmButton)?i:M1,uploadPlaceholderText:null!=(o=null==t?void 0:t.inlineUploadPlaceholderText)?o:"or paste link",onUpload:null!=(a=null!=(s=null==t?void 0:t.inlineOnUpload)?s:null==t?void 0:t.onUpload)?a:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}}),e.update(pB.key,e=>{var n,r,i,o,s,a,l,c;return{uploadButton:null!=(n=null==t?void 0:t.blockUploadButton)?n:"Upload file",imageIcon:null!=(r=null==t?void 0:t.blockImageIcon)?r:N1,captionIcon:null!=(i=null==t?void 0:t.blockCaptionIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"\n />\n </svg>\n',confirmButton:null!=(o=null==t?void 0:t.blockConfirmButton)?o:"Confirm",captionPlaceholderText:null!=(s=null==t?void 0:t.blockCaptionPlaceholderText)?s:"Write Image Caption",uploadPlaceholderText:null!=(a=null==t?void 0:t.blockUploadPlaceholderText)?a:"or paste link",onUpload:null!=(c=null!=(l=null==t?void 0:t.blockOnUpload)?l:null==t?void 0:t.onUpload)?c:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}})}).use(RB).use(AK)})(t,n);case b1.Cursor:return((e,t)=>{if(e.config(V1(b1.Cursor)).config(e=>{e.update(iK.key,()=>{var e,n;return{class:"crepe-drop-cursor",width:null!=(e=null==t?void 0:t.width)?e:4,color:null!=(n=null==t?void 0:t.color)&&n}})}).use(cK),!1===(null==t?void 0:t.virtual))return;const n=hK();e.use(xM(()=>n))})(t,n);case b1.BlockEdit:return b4(t,n);case b1.Placeholder:return((e,t)=>{e.config(V1(b1.Placeholder)).config(e=>{t&&e.update(G4.key,e=>({...e,...t}))}).use(J4).use(G4)})(t,n);case b1.Toolbar:return((e,t)=>{e.config(V1(b1.Toolbar)).config(e=>{e.set(a5.key,{view:n=>new l5(e,n,t)})}).use(a5)})(t,n);case b1.Table:return((e,t)=>{e.config(V1(b1.Table)).config(e=>{e.update(E0.key,e=>({...e,renderButton:e=>{var n,r,i,o,s,a,l,c,h;switch(e){case"add_row":return null!=(n=null==t?void 0:t.addRowIcon)?n:E1;case"add_col":return null!=(r=null==t?void 0:t.addColIcon)?r:E1;case"delete_row":return null!=(i=null==t?void 0:t.deleteRowIcon)?i:D1;case"delete_col":return null!=(o=null==t?void 0:t.deleteColIcon)?o:D1;case"align_col_left":return null!=(s=null==t?void 0:t.alignLeftIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_center":return null!=(a=null==t?void 0:t.alignCenterIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_right":return null!=(l=null==t?void 0:t.alignRightIcon)?l:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"\n />\n </svg>\n';case"col_drag_handle":return null!=(c=null==t?void 0:t.colDragHandleIcon)?c:A1;case"row_drag_handle":return null!=(h=null==t?void 0:t.rowDragHandleIcon)?h:A1}}}))}).use(e1)})(t,n);case b1.Latex:return U4(t,n)}}var h5,u5,d5,p5=e=>{throw TypeError(e)},f5=(e,t,n)=>t.has(e)||p5("Cannot "+n),m5=(e,t,n)=>(f5(e,t,"read from private field"),n?n.call(e):t.get(e)),g5=(e,t,n)=>t.has(e)?p5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),v5=(e,t,n,r)=>(f5(e,t,"write to private field"),t.set(e,n),n);class y5{constructor({root:e,defaultValue:t=""}={}){var n;g5(this,h5),g5(this,u5),g5(this,d5,!0),this.addFeature=(e,t)=>(e(m5(this,h5),t),this),this.create=()=>m5(this,h5).create(),this.destroy=()=>m5(this,h5).destroy(),this.setReadonly=e=>(v5(this,d5,!e),m5(this,h5).action(t=>{if(m5(this,h5).status===mM.Created){t.get(cC).setProps({editable:()=>!e})}}),this),this.getMarkdown=()=>m5(this,h5).action(e=>{const t=e.get(cC);return e.get(MC),e.get(GC)(t.state.doc)}),this.on=e=>m5(this,h5).status!==mM.Created?(m5(this,h5).config(t=>{const n=t.get(f1);e(n)}),this):(m5(this,h5).action(t=>{const n=t.get(f1);e(n)}),this),v5(this,u5,null!=(n="string"==typeof e?document.querySelector(e):e)?n:document.body),v5(this,h5,gM.make().config(e=>{e.inject(B1,this),e.inject(L1,[])}).config(e=>{e.set(hM,m5(this,u5)),e.set(YC,t),e.set(cM,{editable:()=>m5(this,d5)}),e.update(h1.key,e=>({...e,size:4}))}).use(oN).use(g1).use(c1).use(d1).use(w1).use(n1).use(_H))}get editor(){return m5(this,h5)}get readonly(){return!m5(this,d5)}}h5=new WeakMap,u5=new WeakMap,d5=new WeakMap;class w5 extends y5{constructor({features:e={},featureConfigs:t={},...n}={}){super(n);const r=st(t,R1);Object.entries({...x1,...e}).filter(([,e])=>e).map(([e])=>e).forEach(e=>{const t=r[e];c5(e,this.editor,t)})}}w5.Feature=b1;const b5=t.createContext({});const x5=()=>{const e=function(){const{dom:e,editor:n,setLoading:r,editorFactory:i}=t.useContext(b5),o=t.useRef(null);return t.useEffect(()=>{const t=o.current;if(!i)return;if(!t)return;e.current=t;const s=i(t);return s?(r(!0),s.create().then(e=>{n.current=e}).finally(()=>{r(!1)}).catch(console.error),()=>{s.destroy().catch(console.error)}):void 0},[e,n,i,r]),o}();return t.createElement("div",{"data-milkdown-root":!0,ref:e})};exports.BrainfishEditor=({readOnly:n=!1,markdown:r,className:i})=>(function(e,n=[]){const r=t.useContext(b5),i=t.useCallback(e,n);t.useLayoutEffect(()=>{r.setEditorFactory(()=>i)},[r,i]),r.loading}(e=>{const t=new w5({root:e,defaultValue:r});return t.setReadonly(n),t},[n,r]),e.jsx("div",{className:i,"data-testid":"brainfish-editor",children:e.jsx(x5,{})})),exports.CompletionContext=G$,exports.DefaultBufferLength=lt,exports.EditorSelection=Ln,exports.EditorState=Ar,exports.EditorView=hl,exports.LRLanguage=Ih,exports.Language=Eh,exports.LanguageDescription=$h,exports.LanguageSupport=jh,exports.MilkdownProvider=({children:e})=>{const n=t.useRef(void 0),[r,i]=t.useState(void 0),o=t.useRef(void 0),[s,a]=t.useState(!0),l=t.useMemo(()=>({loading:s,dom:n,editor:o,setLoading:a,editorFactory:r,setEditorFactory:i}),[s,r]);return t.createElement(b5.Provider,{value:l},e)},exports.NodeProp=ut,exports.NodeSet=mt,exports.NodeType=ft,exports.NodeWeakMap=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Nt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Mt&&this.map.set(e.tree,t)}get(e){return e instanceof Nt?this.getBuffer(e.context.buffer,e.index):e instanceof Mt?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},exports.ParseContext=Lh,exports.Parser=zt,exports.Prec=Zn,exports.Tag=th,exports.Tree=wt,exports.bracketMatchingHandle=Uu,exports.completeFromList=Y$,exports.continuedIndent=function({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}},exports.countColumn=Wr,exports.defineLanguageFacet=Oh,exports.delimitedIndent=function({closing:e,align:t=!0,units:n=1}){return r=>ru(r,t,n,e)},exports.flatIndent=e=>e.baseIndent,exports.foldInside=function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null},exports.foldNodeProp=ou,exports.foldService=iu,exports.ifNotIn=function(e,t){return n=>{for(let t=_h(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}},exports.indentNodeProp=Xh,exports.indentUnit=Uh,exports.keymap=yl,exports.languageDataProp=Ah,exports.parseMixed=function(e){return(t,n,r,i)=>new $t(t,e,n,r,i)},exports.snippetCompletion=function(e,t){return{...t,apply:UW(e)}},exports.styleTags=ih,exports.sublanguageProp=Nh,exports.syntaxTree=_h,exports.tags=Mh;
30
+ //# sourceMappingURL=index-Cdt7DehW.cjs.map