@researai/deepscientist 1.5.16 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (896) hide show
  1. package/AGENTS.md +309 -130
  2. package/AISB/catalog/aisb.b1.agentic_coding.yaml +244 -0
  3. package/AISB/catalog/aisb.b10.climate_earth.yaml +235 -0
  4. package/AISB/catalog/aisb.b11.model_efficiency.yaml +231 -0
  5. package/AISB/catalog/aisb.b12.embodied_ai.yaml +238 -0
  6. package/AISB/catalog/aisb.b2.agent_systems.yaml +229 -0
  7. package/AISB/catalog/aisb.b3.self_evolving_rl.yaml +237 -0
  8. package/AISB/catalog/aisb.b4.lm_reasoning.yaml +240 -0
  9. package/AISB/catalog/aisb.b5.math_proof.yaml +235 -0
  10. package/AISB/catalog/aisb.b6.research_process.yaml +243 -0
  11. package/AISB/catalog/aisb.b7.multimodal_fusion.yaml +232 -0
  12. package/AISB/catalog/aisb.b8.lifesci_drug.yaml +275 -0
  13. package/AISB/catalog/aisb.b9.material_science.yaml +237 -0
  14. package/AISB/catalog/aisb.t3.001_savvy.yaml +159 -0
  15. package/AISB/catalog/aisb.t3.001_savvy.zh.yaml +121 -0
  16. package/AISB/catalog/aisb.t3.002_pinet.yaml +189 -0
  17. package/AISB/catalog/aisb.t3.002_pinet.zh.yaml +130 -0
  18. package/AISB/catalog/aisb.t3.004_decentralattn.yaml +184 -0
  19. package/AISB/catalog/aisb.t3.004_decentralattn.zh.yaml +153 -0
  20. package/AISB/catalog/aisb.t3.005_tsae.yaml +193 -0
  21. package/AISB/catalog/aisb.t3.005_tsae.zh.yaml +139 -0
  22. package/AISB/catalog/aisb.t3.006_physense.yaml +194 -0
  23. package/AISB/catalog/aisb.t3.006_physense.zh.yaml +118 -0
  24. package/AISB/catalog/aisb.t3.007_reasoningiqa.yaml +169 -0
  25. package/AISB/catalog/aisb.t3.007_reasoningiqa.zh.yaml +133 -0
  26. package/AISB/catalog/aisb.t3.008_meanflows.yaml +188 -0
  27. package/AISB/catalog/aisb.t3.008_meanflows.zh.yaml +140 -0
  28. package/AISB/catalog/aisb.t3.009_scoremissing.yaml +179 -0
  29. package/AISB/catalog/aisb.t3.009_scoremissing.zh.yaml +119 -0
  30. package/AISB/catalog/aisb.t3.010_suitabilityfilter.yaml +221 -0
  31. package/AISB/catalog/aisb.t3.010_suitabilityfilter.zh.yaml +141 -0
  32. package/AISB/catalog/aisb.t3.011_osd.yaml +206 -0
  33. package/AISB/catalog/aisb.t3.011_osd.zh.yaml +163 -0
  34. package/AISB/catalog/aisb.t3.012_efficientqat.yaml +206 -0
  35. package/AISB/catalog/aisb.t3.012_efficientqat.zh.yaml +159 -0
  36. package/AISB/catalog/aisb.t3.013_appl.yaml +152 -0
  37. package/AISB/catalog/aisb.t3.013_appl.zh.yaml +126 -0
  38. package/AISB/catalog/aisb.t3.014_piguard.yaml +207 -0
  39. package/AISB/catalog/aisb.t3.014_piguard.zh.yaml +164 -0
  40. package/AISB/catalog/aisb.t3.015_frspec.yaml +209 -0
  41. package/AISB/catalog/aisb.t3.015_frspec.zh.yaml +163 -0
  42. package/AISB/catalog/aisb.t3.016_mathfusion.yaml +166 -0
  43. package/AISB/catalog/aisb.t3.016_mathfusion.zh.yaml +145 -0
  44. package/AISB/catalog/aisb.t3.017_multimodalglp.yaml +171 -0
  45. package/AISB/catalog/aisb.t3.017_multimodalglp.zh.yaml +122 -0
  46. package/AISB/catalog/aisb.t3.018_cotsynth.yaml +206 -0
  47. package/AISB/catalog/aisb.t3.018_cotsynth.zh.yaml +162 -0
  48. package/AISB/catalog/aisb.t3.019_dyscaleut.yaml +211 -0
  49. package/AISB/catalog/aisb.t3.019_dyscaleut.zh.yaml +148 -0
  50. package/AISB/catalog/aisb.t3.020_aristotle.yaml +173 -0
  51. package/AISB/catalog/aisb.t3.020_aristotle.zh.yaml +119 -0
  52. package/AISB/catalog/aisb.t3.021_tokenrecycling.yaml +160 -0
  53. package/AISB/catalog/aisb.t3.021_tokenrecycling.zh.yaml +129 -0
  54. package/AISB/catalog/aisb.t3.022_chainofreasoning.yaml +204 -0
  55. package/AISB/catalog/aisb.t3.022_chainofreasoning.zh.yaml +161 -0
  56. package/AISB/catalog/aisb.t3.023_guidedembed.yaml +211 -0
  57. package/AISB/catalog/aisb.t3.023_guidedembed.zh.yaml +189 -0
  58. package/AISB/catalog/aisb.t3.024_outputcentric.yaml +148 -0
  59. package/AISB/catalog/aisb.t3.024_outputcentric.zh.yaml +131 -0
  60. package/AISB/catalog/aisb.t3.025_deeper.yaml +143 -0
  61. package/AISB/catalog/aisb.t3.025_deeper.zh.yaml +116 -0
  62. package/AISB/catalog/aisb.t3.026_gartkg.yaml +195 -0
  63. package/AISB/catalog/aisb.t3.026_gartkg.zh.yaml +127 -0
  64. package/AISB/catalog/aisb.t3.027_citeeval.yaml +182 -0
  65. package/AISB/catalog/aisb.t3.027_citeeval.zh.yaml +135 -0
  66. package/AISB/catalog/aisb.t3.028_sbam.yaml +206 -0
  67. package/AISB/catalog/aisb.t3.028_sbam.zh.yaml +166 -0
  68. package/AISB/catalog/aisb.t3.029_cdqgeoembed.yaml +224 -0
  69. package/AISB/catalog/aisb.t3.029_cdqgeoembed.zh.yaml +142 -0
  70. package/AISB/catalog/aisb.t3.030_processrm.yaml +211 -0
  71. package/AISB/catalog/aisb.t3.030_processrm.zh.yaml +166 -0
  72. package/AISB/catalog/aisb.t3.031_circuitstability.yaml +172 -0
  73. package/AISB/catalog/aisb.t3.031_circuitstability.zh.yaml +134 -0
  74. package/AISB/catalog/aisb.t3.032_ptsolver.yaml +169 -0
  75. package/AISB/catalog/aisb.t3.032_ptsolver.zh.yaml +135 -0
  76. package/AISB/catalog/aisb.t3.033_gcse.yaml +144 -0
  77. package/AISB/catalog/aisb.t3.033_gcse.zh.yaml +126 -0
  78. package/AISB/catalog/aisb.t3.034_ensemblewm.yaml +183 -0
  79. package/AISB/catalog/aisb.t3.034_ensemblewm.zh.yaml +146 -0
  80. package/AISB/catalog/aisb.t3.035_moralvalueswa.yaml +207 -0
  81. package/AISB/catalog/aisb.t3.035_moralvalueswa.zh.yaml +165 -0
  82. package/AISB/catalog/aisb.t3.036_weakstrongpref.yaml +210 -0
  83. package/AISB/catalog/aisb.t3.036_weakstrongpref.zh.yaml +194 -0
  84. package/AISB/catalog/aisb.t3.037_dementiamask.yaml +172 -0
  85. package/AISB/catalog/aisb.t3.037_dementiamask.zh.yaml +132 -0
  86. package/AISB/catalog/aisb.t3.038_tinysam.yaml +284 -0
  87. package/AISB/catalog/aisb.t3.038_tinysam.zh.yaml +240 -0
  88. package/AISB/catalog/aisb.t3.039_calf.yaml +224 -0
  89. package/AISB/catalog/aisb.t3.039_calf.zh.yaml +194 -0
  90. package/AISB/catalog/aisb.t3.040_graniteguardian.yaml +199 -0
  91. package/AISB/catalog/aisb.t3.040_graniteguardian.zh.yaml +174 -0
  92. package/AISB/catalog/aisb.t3.041_amdm.yaml +149 -0
  93. package/AISB/catalog/aisb.t3.041_amdm.zh.yaml +137 -0
  94. package/AISB/catalog/aisb.t3.042_xpatch.yaml +216 -0
  95. package/AISB/catalog/aisb.t3.042_xpatch.zh.yaml +182 -0
  96. package/AISB/catalog/aisb.t3.043_vhm.yaml +268 -0
  97. package/AISB/catalog/aisb.t3.043_vhm.zh.yaml +193 -0
  98. package/AISB/catalog/aisb.t3.044_rgvi.yaml +224 -0
  99. package/AISB/catalog/aisb.t3.044_rgvi.zh.yaml +176 -0
  100. package/AISB/catalog/aisb.t3.045_pslstm.yaml +203 -0
  101. package/AISB/catalog/aisb.t3.045_pslstm.zh.yaml +179 -0
  102. package/AISB/catalog/aisb.t3.046_nonstatts.yaml +208 -0
  103. package/AISB/catalog/aisb.t3.046_nonstatts.zh.yaml +194 -0
  104. package/AISB/catalog/aisb.t3.047_timepfn.yaml +156 -0
  105. package/AISB/catalog/aisb.t3.047_timepfn.zh.yaml +124 -0
  106. package/AISB/catalog/aisb.t3.048_proxyspex.yaml +148 -0
  107. package/AISB/catalog/aisb.t3.048_proxyspex.zh.yaml +125 -0
  108. package/AISB/catalog/aisb.t3.049_hogwildinference.yaml +183 -0
  109. package/AISB/catalog/aisb.t3.049_hogwildinference.zh.yaml +138 -0
  110. package/AISB/catalog/aisb.t3.050_causalpfn.yaml +214 -0
  111. package/AISB/catalog/aisb.t3.050_causalpfn.zh.yaml +190 -0
  112. package/AISB/catalog/aisb.t3.051_flashtp.yaml +169 -0
  113. package/AISB/catalog/aisb.t3.051_flashtp.zh.yaml +124 -0
  114. package/AISB/catalog/aisb.t3.052_nsdiff.yaml +155 -0
  115. package/AISB/catalog/aisb.t3.052_nsdiff.zh.yaml +138 -0
  116. package/AISB/catalog/aisb.t3.053_k2vae.yaml +158 -0
  117. package/AISB/catalog/aisb.t3.053_k2vae.zh.yaml +132 -0
  118. package/AISB/catalog/aisb.t3.054_timebase.yaml +178 -0
  119. package/AISB/catalog/aisb.t3.054_timebase.zh.yaml +158 -0
  120. package/AISB/catalog/aisb.t3.055_csbrain.yaml +238 -0
  121. package/AISB/catalog/aisb.t3.055_csbrain.zh.yaml +184 -0
  122. package/AISB/catalog/aisb.t3.056_infosam.yaml +224 -0
  123. package/AISB/catalog/aisb.t3.056_infosam.zh.yaml +189 -0
  124. package/AISB/catalog/aisb.t3.057_mdreid.yaml +129 -0
  125. package/AISB/catalog/aisb.t3.057_mdreid.zh.yaml +117 -0
  126. package/AISB/catalog/aisb.t3.058_mindglitch.yaml +171 -0
  127. package/AISB/catalog/aisb.t3.058_mindglitch.zh.yaml +145 -0
  128. package/AISB/catalog/aisb.t3.059_selfsupervised.yaml +154 -0
  129. package/AISB/catalog/aisb.t3.059_selfsupervised.zh.yaml +125 -0
  130. package/AISB/catalog/aisb.t3.060_iaggad.yaml +121 -0
  131. package/AISB/catalog/aisb.t3.060_iaggad.zh.yaml +100 -0
  132. package/AISB/catalog/aisb.t3.061_hsgkn.yaml +136 -0
  133. package/AISB/catalog/aisb.t3.061_hsgkn.zh.yaml +113 -0
  134. package/AISB/catalog/aisb.t3.062_visionts.yaml +237 -0
  135. package/AISB/catalog/aisb.t3.062_visionts.zh.yaml +216 -0
  136. package/AISB/catalog/aisb.t3.063_tsrag.yaml +162 -0
  137. package/AISB/catalog/aisb.t3.063_tsrag.zh.yaml +138 -0
  138. package/AISB/catalog/aisb.t3.064_pir.yaml +221 -0
  139. package/AISB/catalog/aisb.t3.064_pir.zh.yaml +197 -0
  140. package/AISB/catalog/aisb.t3.065_proteinbinding.yaml +234 -0
  141. package/AISB/catalog/aisb.t3.065_proteinbinding.zh.yaml +167 -0
  142. package/AISB/catalog/aisb.t3.066_tropicalattention.yaml +267 -0
  143. package/AISB/catalog/aisb.t3.066_tropicalattention.zh.yaml +229 -0
  144. package/AISB/catalog/aisb.t3.067_kanad.yaml +193 -0
  145. package/AISB/catalog/aisb.t3.067_kanad.zh.yaml +167 -0
  146. package/AISB/catalog/aisb.t3.068_sempo.yaml +187 -0
  147. package/AISB/catalog/aisb.t3.068_sempo.zh.yaml +148 -0
  148. package/AISB/catalog/aisb.t3.069_treehfd.yaml +129 -0
  149. package/AISB/catalog/aisb.t3.069_treehfd.zh.yaml +111 -0
  150. package/AISB/catalog/aisb.t3.070_certifiedunlearning.yaml +224 -0
  151. package/AISB/catalog/aisb.t3.070_certifiedunlearning.zh.yaml +171 -0
  152. package/AISB/catalog/aisb.t3.071_neuralmjd.yaml +142 -0
  153. package/AISB/catalog/aisb.t3.071_neuralmjd.zh.yaml +120 -0
  154. package/AISB/catalog/aisb.t3.072_fedgmt.yaml +181 -0
  155. package/AISB/catalog/aisb.t3.072_fedgmt.zh.yaml +158 -0
  156. package/AISB/catalog/aisb.t3.073_rld.yaml +161 -0
  157. package/AISB/catalog/aisb.t3.073_rld.zh.yaml +129 -0
  158. package/AISB/catalog/aisb.t3.074_lsvi.yaml +163 -0
  159. package/AISB/catalog/aisb.t3.074_lsvi.zh.yaml +129 -0
  160. package/AISB/catalog/aisb.t3.075_treeslicedentropy.yaml +201 -0
  161. package/AISB/catalog/aisb.t3.075_treeslicedentropy.zh.yaml +148 -0
  162. package/AISB/catalog/aisb.t3.076_aanet.yaml +169 -0
  163. package/AISB/catalog/aisb.t3.076_aanet.zh.yaml +129 -0
  164. package/AISB/catalog/aisb.t3.077_cmnn.yaml +199 -0
  165. package/AISB/catalog/aisb.t3.077_cmnn.zh.yaml +165 -0
  166. package/AISB/catalog/aisb.t3.078_conformalanomaly.yaml +146 -0
  167. package/AISB/catalog/aisb.t3.078_conformalanomaly.zh.yaml +117 -0
  168. package/AISB/catalog/aisb.t3.079_dpfkmeans.yaml +131 -0
  169. package/AISB/catalog/aisb.t3.079_dpfkmeans.zh.yaml +104 -0
  170. package/AISB/catalog/aisb.t3.080_latentscorereweight.yaml +169 -0
  171. package/AISB/catalog/aisb.t3.080_latentscorereweight.zh.yaml +123 -0
  172. package/AISB/catalog/aisb.t3.081_qmamba.yaml +150 -0
  173. package/AISB/catalog/aisb.t3.081_qmamba.zh.yaml +117 -0
  174. package/AISB/catalog/aisb.t3.082_onlinellmrouting.yaml +160 -0
  175. package/AISB/catalog/aisb.t3.082_onlinellmrouting.zh.yaml +133 -0
  176. package/AISB/catalog/aisb.t3.083_starformer.yaml +178 -0
  177. package/AISB/catalog/aisb.t3.083_starformer.zh.yaml +140 -0
  178. package/AISB/catalog/aisb.t3.084_ift.yaml +139 -0
  179. package/AISB/catalog/aisb.t3.084_ift.zh.yaml +111 -0
  180. package/AISB/catalog/aisb.t3.085_neuralsurv.yaml +183 -0
  181. package/AISB/catalog/aisb.t3.085_neuralsurv.zh.yaml +143 -0
  182. package/AISB/catalog/aisb.t3.086_stella.yaml +197 -0
  183. package/AISB/catalog/aisb.t3.086_stella.zh.yaml +142 -0
  184. package/AISB/catalog/aisb.t3.087_moses.yaml +167 -0
  185. package/AISB/catalog/aisb.t3.087_moses.zh.yaml +132 -0
  186. package/AISB/catalog/aisb.t3.088_channelnorm.yaml +140 -0
  187. package/AISB/catalog/aisb.t3.088_channelnorm.zh.yaml +109 -0
  188. package/AISB/catalog/aisb.t3.089_causalvelocity.yaml +730 -0
  189. package/AISB/catalog/aisb.t3.089_causalvelocity.zh.yaml +668 -0
  190. package/AISB/catalog/aisb.t3.090_rstib.yaml +144 -0
  191. package/AISB/catalog/aisb.t3.090_rstib.zh.yaml +109 -0
  192. package/AISB/catalog/aisb.t3.091_timeawarecausal.yaml +132 -0
  193. package/AISB/catalog/aisb.t3.091_timeawarecausal.zh.yaml +107 -0
  194. package/AISB/catalog/aisb.t3.092_kmeanslocalopt.yaml +138 -0
  195. package/AISB/catalog/aisb.t3.092_kmeanslocalopt.zh.yaml +110 -0
  196. package/AISB/catalog/aisb.t3.093_fedwmsam.yaml +134 -0
  197. package/AISB/catalog/aisb.t3.093_fedwmsam.zh.yaml +106 -0
  198. package/AISB/catalog/aisb.t3.094_boundre.yaml +147 -0
  199. package/AISB/catalog/aisb.t3.094_boundre.zh.yaml +114 -0
  200. package/AISB/catalog/aisb.t3.095_fastfeaturecp.yaml +153 -0
  201. package/AISB/catalog/aisb.t3.095_fastfeaturecp.zh.yaml +118 -0
  202. package/AISB/catalog/aisb.t3.096_m3svm.yaml +189 -0
  203. package/AISB/catalog/aisb.t3.096_m3svm.zh.yaml +149 -0
  204. package/AISB/catalog/aisb.t3.097_wassersteintl.yaml +212 -0
  205. package/AISB/catalog/aisb.t3.097_wassersteintl.zh.yaml +169 -0
  206. package/AISB/catalog/aisb.t3.098_xmahalanobis.yaml +171 -0
  207. package/AISB/catalog/aisb.t3.098_xmahalanobis.zh.yaml +127 -0
  208. package/AISB/catalog/aisb.t3.099_ollalanding.yaml +248 -0
  209. package/AISB/catalog/aisb.t3.099_ollalanding.zh.yaml +182 -0
  210. package/AISB/catalog/aisb.t3.100_invmissingdata.yaml +179 -0
  211. package/AISB/catalog/aisb.t3.100_invmissingdata.zh.yaml +150 -0
  212. package/AISB/catalog/aisb.t3.101_acia.yaml +164 -0
  213. package/AISB/catalog/aisb.t3.101_acia.zh.yaml +109 -0
  214. package/AISB/catalog/aisb.t3.102_stochasticff.yaml +178 -0
  215. package/AISB/catalog/aisb.t3.102_stochasticff.zh.yaml +130 -0
  216. package/AISB/catalog/aisb.t3.103_qdcp.yaml +150 -0
  217. package/AISB/catalog/aisb.t3.103_qdcp.zh.yaml +116 -0
  218. package/AISB/catalog/aisb.t3.104_balancedactiveinf.yaml +137 -0
  219. package/AISB/catalog/aisb.t3.104_balancedactiveinf.zh.yaml +104 -0
  220. package/AISB/catalog/aisb.t3.105_binaryclasseval.yaml +161 -0
  221. package/AISB/catalog/aisb.t3.105_binaryclasseval.zh.yaml +130 -0
  222. package/AISB/image/001_aisb.t3.001_savvy.jpg +0 -0
  223. package/AISB/image/002_aisb.t3.002_pinet.jpg +0 -0
  224. package/AISB/image/003_aisb.t3.003_dmsqd.jpg +0 -0
  225. package/AISB/image/004_aisb.t3.004_decentralattn.jpg +0 -0
  226. package/AISB/image/005_aisb.t3.005_tsae.jpg +0 -0
  227. package/AISB/image/006_aisb.t3.006_physense.jpg +0 -0
  228. package/AISB/image/007_aisb.t3.007_reasoningiqa.jpg +0 -0
  229. package/AISB/image/008_aisb.t3.008_meanflows.jpg +0 -0
  230. package/AISB/image/009_aisb.t3.009_scoremissing.jpg +0 -0
  231. package/AISB/image/010_aisb.t3.010_suitabilityfilter.jpg +0 -0
  232. package/AISB/image/011_aisb.t3.011_osd.jpg +0 -0
  233. package/AISB/image/012_aisb.t3.012_efficientqat.jpg +0 -0
  234. package/AISB/image/013_aisb.t3.013_appl.jpg +0 -0
  235. package/AISB/image/014_aisb.t3.014_piguard.jpg +0 -0
  236. package/AISB/image/015_aisb.t3.015_frspec.jpg +0 -0
  237. package/AISB/image/016_aisb.t3.016_mathfusion.jpg +0 -0
  238. package/AISB/image/017_aisb.t3.017_multimodalglp.jpg +0 -0
  239. package/AISB/image/018_aisb.t3.018_cotsynth.jpg +0 -0
  240. package/AISB/image/019_aisb.t3.019_dyscaleut.jpg +0 -0
  241. package/AISB/image/020_aisb.t3.020_aristotle.jpg +0 -0
  242. package/AISB/image/021_aisb.t3.021_tokenrecycling.jpg +0 -0
  243. package/AISB/image/022_aisb.t3.022_chainofreasoning.jpg +0 -0
  244. package/AISB/image/023_aisb.t3.023_guidedembed.jpg +0 -0
  245. package/AISB/image/024_aisb.t3.024_outputcentric.jpg +0 -0
  246. package/AISB/image/025_aisb.t3.025_deeper.jpg +0 -0
  247. package/AISB/image/026_aisb.t3.026_gartkg.jpg +0 -0
  248. package/AISB/image/027_aisb.t3.027_citeeval.jpg +0 -0
  249. package/AISB/image/028_aisb.t3.028_sbam.jpg +0 -0
  250. package/AISB/image/029_aisb.t3.029_cdqgeoembed.jpg +0 -0
  251. package/AISB/image/030_aisb.t3.030_processrm.jpg +0 -0
  252. package/AISB/image/031_aisb.t3.031_circuitstability.jpg +0 -0
  253. package/AISB/image/032_aisb.t3.032_ptsolver.jpg +0 -0
  254. package/AISB/image/033_aisb.t3.033_gcse.jpg +0 -0
  255. package/AISB/image/034_aisb.t3.034_ensemblewm.jpg +0 -0
  256. package/AISB/image/035_aisb.t3.035_moralvalueswa.jpg +0 -0
  257. package/AISB/image/036_aisb.t3.036_weakstrongpref.jpg +0 -0
  258. package/AISB/image/037_aisb.t3.037_dementiamask.jpg +0 -0
  259. package/AISB/image/038_aisb.t3.038_tinysam.jpg +0 -0
  260. package/AISB/image/039_aisb.t3.039_calf.jpg +0 -0
  261. package/AISB/image/040_aisb.t3.040_graniteguardian.jpg +0 -0
  262. package/AISB/image/041_aisb.t3.041_amdm.jpg +0 -0
  263. package/AISB/image/042_aisb.t3.042_xpatch.jpg +0 -0
  264. package/AISB/image/043_aisb.t3.043_vhm.jpg +0 -0
  265. package/AISB/image/044_aisb.t3.044_rgvi.jpg +0 -0
  266. package/AISB/image/045_aisb.t3.045_pslstm.jpg +0 -0
  267. package/AISB/image/046_aisb.t3.046_nonstatts.jpg +0 -0
  268. package/AISB/image/047_aisb.t3.047_timepfn.jpg +0 -0
  269. package/AISB/image/048_aisb.t3.048_proxyspex.jpg +0 -0
  270. package/AISB/image/049_aisb.t3.049_hogwildinference.jpg +0 -0
  271. package/AISB/image/050_aisb.t3.050_causalpfn.jpg +0 -0
  272. package/AISB/image/051_aisb.t3.051_flashtp.jpg +0 -0
  273. package/AISB/image/052_aisb.t3.052_nsdiff.jpg +0 -0
  274. package/AISB/image/053_aisb.t3.053_k2vae.jpg +0 -0
  275. package/AISB/image/054_aisb.t3.054_timebase.jpg +0 -0
  276. package/AISB/image/055_aisb.t3.055_csbrain.jpg +0 -0
  277. package/AISB/image/056_aisb.t3.056_infosam.jpg +0 -0
  278. package/AISB/image/057_aisb.t3.057_mdreid.jpg +0 -0
  279. package/AISB/image/058_aisb.t3.058_mindglitch.jpg +0 -0
  280. package/AISB/image/059_aisb.t3.059_selfsupervised.jpg +0 -0
  281. package/AISB/image/060_aisb.t3.060_iaggad.jpg +0 -0
  282. package/AISB/image/061_aisb.t3.061_hsgkn.jpg +0 -0
  283. package/AISB/image/062_aisb.t3.062_visionts.jpg +0 -0
  284. package/AISB/image/063_aisb.t3.063_tsrag.jpg +0 -0
  285. package/AISB/image/064_aisb.t3.064_pir.jpg +0 -0
  286. package/AISB/image/065_aisb.t3.065_proteinbinding.jpg +0 -0
  287. package/AISB/image/066_aisb.t3.066_tropicalattention.jpg +0 -0
  288. package/AISB/image/067_aisb.t3.067_kanad.jpg +0 -0
  289. package/AISB/image/068_aisb.t3.068_sempo.jpg +0 -0
  290. package/AISB/image/069_aisb.t3.069_treehfd.jpg +0 -0
  291. package/AISB/image/070_aisb.t3.070_certifiedunlearning.jpg +0 -0
  292. package/AISB/image/071_aisb.t3.071_neuralmjd.jpg +0 -0
  293. package/AISB/image/072_aisb.t3.072_fedgmt.jpg +0 -0
  294. package/AISB/image/073_aisb.t3.073_rld.jpg +0 -0
  295. package/AISB/image/074_aisb.t3.074_lsvi.jpg +0 -0
  296. package/AISB/image/075_aisb.t3.075_treeslicedentropy.jpg +0 -0
  297. package/AISB/image/076_aisb.t3.076_aanet.jpg +0 -0
  298. package/AISB/image/077_aisb.t3.077_cmnn.jpg +0 -0
  299. package/AISB/image/078_aisb.t3.078_conformalanomaly.jpg +0 -0
  300. package/AISB/image/079_aisb.t3.079_dpfkmeans.jpg +0 -0
  301. package/AISB/image/080_aisb.t3.080_latentscorereweight.jpg +0 -0
  302. package/AISB/image/081_aisb.t3.081_qmamba.jpg +0 -0
  303. package/AISB/image/082_aisb.t3.082_onlinellmrouting.jpg +0 -0
  304. package/AISB/image/083_aisb.t3.083_starformer.jpg +0 -0
  305. package/AISB/image/084_aisb.t3.084_ift.jpg +0 -0
  306. package/AISB/image/085_aisb.t3.085_neuralsurv.jpg +0 -0
  307. package/AISB/image/086_aisb.t3.086_stella.jpg +0 -0
  308. package/AISB/image/087_aisb.t3.087_moses.jpg +0 -0
  309. package/AISB/image/088_aisb.t3.088_channelnorm.jpg +0 -0
  310. package/AISB/image/089_aisb.t3.089_causalvelocity.jpg +0 -0
  311. package/AISB/image/090_aisb.t3.090_rstib.jpg +0 -0
  312. package/AISB/image/091_aisb.t3.091_timeawarecausal.jpg +0 -0
  313. package/AISB/image/092_aisb.t3.092_kmeanslocalopt.jpg +0 -0
  314. package/AISB/image/093_aisb.t3.093_fedwmsam.jpg +0 -0
  315. package/AISB/image/094_aisb.t3.094_boundre.jpg +0 -0
  316. package/AISB/image/095_aisb.t3.095_fastfeaturecp.jpg +0 -0
  317. package/AISB/image/096_aisb.t3.096_m3svm.jpg +0 -0
  318. package/AISB/image/097_aisb.t3.097_wassersteintl.jpg +0 -0
  319. package/AISB/image/098_aisb.t3.098_xmahalanobis.jpg +0 -0
  320. package/AISB/image/099_aisb.t3.099_ollalanding.jpg +0 -0
  321. package/AISB/image/100_aisb.t3.100_invmissingdata.jpg +0 -0
  322. package/AISB/image/101_aisb.t3.101_acia.jpg +0 -0
  323. package/AISB/image/102_aisb.t3.102_stochasticff.jpg +0 -0
  324. package/AISB/image/103_aisb.t3.103_qdcp.jpg +0 -0
  325. package/AISB/image/104_aisb.t3.104_balancedactiveinf.jpg +0 -0
  326. package/AISB/image/105_aisb.t3.105_binaryclasseval.jpg +0 -0
  327. package/AISB/image/106_aisb.t1.reasoning_lite.jpg +0 -0
  328. package/AISB/image/107_aisb.t2.paper_audit.jpg +0 -0
  329. package/AISB/image/108_aisb.t3.multi_gpu_search.jpg +0 -0
  330. package/AISB/image/109_aisb.t3.tdc_admet.jpg +0 -0
  331. package/AISB/image/aisb.b1.agentic_coding.svg +16 -0
  332. package/AISB/image/aisb.b10.climate_earth.svg +16 -0
  333. package/AISB/image/aisb.b11.model_efficiency.svg +16 -0
  334. package/AISB/image/aisb.b12.embodied_ai.svg +16 -0
  335. package/AISB/image/aisb.b2.agent_systems.svg +16 -0
  336. package/AISB/image/aisb.b3.self_evolving_rl.svg +16 -0
  337. package/AISB/image/aisb.b4.lm_reasoning.svg +16 -0
  338. package/AISB/image/aisb.b5.math_proof.svg +16 -0
  339. package/AISB/image/aisb.b6.research_process.svg +16 -0
  340. package/AISB/image/aisb.b7.multimodal_fusion.svg +16 -0
  341. package/AISB/image/aisb.b8.lifesci_drug.svg +16 -0
  342. package/AISB/image/aisb.b9.material_science.svg +16 -0
  343. package/README.md +196 -32
  344. package/bin/ds.js +924 -66
  345. package/docs/en/00_QUICK_START.md +195 -18
  346. package/docs/en/01_SETTINGS_REFERENCE.md +468 -96
  347. package/docs/en/02_START_RESEARCH_GUIDE.md +26 -5
  348. package/docs/en/03_QQ_CONNECTOR_GUIDE.md +14 -3
  349. package/docs/en/04_LINGZHU_CONNECTOR_GUIDE.md +2 -0
  350. package/docs/en/05_TUI_GUIDE.md +171 -2
  351. package/docs/en/07_MEMORY_AND_MCP.md +38 -2
  352. package/docs/en/09_DOCTOR.md +78 -7
  353. package/docs/en/10_WEIXIN_CONNECTOR_GUIDE.md +38 -1
  354. package/docs/en/11_LICENSE_AND_RISK.md +4 -0
  355. package/docs/en/12_GUIDED_WORKFLOW_TOUR.md +15 -0
  356. package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
  357. package/docs/en/15_CODEX_PROVIDER_SETUP.md +624 -180
  358. package/docs/en/16_TELEGRAM_CONNECTOR_GUIDE.md +14 -0
  359. package/docs/en/17_WHATSAPP_CONNECTOR_GUIDE.md +14 -0
  360. package/docs/en/18_FEISHU_CONNECTOR_GUIDE.md +14 -0
  361. package/docs/en/21_LOCAL_MODEL_BACKENDS_GUIDE.md +386 -0
  362. package/docs/en/22_BENCHSTORE_YAML_REFERENCE.md +469 -0
  363. package/docs/en/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +316 -0
  364. package/docs/en/24_CLAUDE_CODE_PROVIDER_SETUP.md +469 -0
  365. package/docs/en/25_OPENCODE_PROVIDER_SETUP.md +653 -0
  366. package/docs/en/26_CITATION_AND_ATTRIBUTION.md +119 -0
  367. package/docs/en/27_KIMI_CODE_PROVIDER_SETUP.md +180 -0
  368. package/docs/en/28_DISCORD_CONNECTOR_GUIDE.md +61 -0
  369. package/docs/en/29_SLACK_CONNECTOR_GUIDE.md +60 -0
  370. package/docs/en/30_SETTINGS_CONTROL_CENTER_GUIDE.md +371 -0
  371. package/docs/en/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
  372. package/docs/en/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +273 -0
  373. package/docs/en/33_WORKSPACE_EXPLORER_QA.md +121 -0
  374. package/docs/en/91_DEVELOPMENT.md +266 -0
  375. package/docs/en/99_ACKNOWLEDGEMENTS.md +24 -19
  376. package/docs/en/README.md +48 -7
  377. package/docs/images/admin/admin-connectors-health-en.png +0 -0
  378. package/docs/images/admin/admin-controllers-en.png +0 -0
  379. package/docs/images/admin/admin-diagnostics-en.png +0 -0
  380. package/docs/images/admin/admin-errors-en.png +0 -0
  381. package/docs/images/admin/admin-issues-en.png +0 -0
  382. package/docs/images/admin/admin-logs-en.png +0 -0
  383. package/docs/images/admin/admin-quest-detail-en.png +0 -0
  384. package/docs/images/admin/admin-quests-en.png +0 -0
  385. package/docs/images/admin/admin-repairs-en.png +0 -0
  386. package/docs/images/admin/admin-runtime-en.png +0 -0
  387. package/docs/images/admin/admin-search-en.png +0 -0
  388. package/docs/images/admin/admin-stats-en.png +0 -0
  389. package/docs/images/admin/admin-summary-en.png +0 -0
  390. package/docs/images/connectors/connector-discord-en.png +0 -0
  391. package/docs/images/connectors/connector-feishu-en.png +0 -0
  392. package/docs/images/connectors/connector-lingzhu-en.png +0 -0
  393. package/docs/images/connectors/connector-qq-en.png +0 -0
  394. package/docs/images/connectors/connector-slack-en.png +0 -0
  395. package/docs/images/connectors/connector-telegram-en.png +0 -0
  396. package/docs/images/connectors/connector-weixin-en.png +0 -0
  397. package/docs/images/connectors/connector-whatsapp-en.png +0 -0
  398. package/docs/images/settings/settings-baselines-en.png +0 -0
  399. package/docs/images/settings/settings-config-en.png +0 -0
  400. package/docs/images/settings/settings-connectors-overview-en.png +0 -0
  401. package/docs/images/settings/settings-deepxiv-en.png +0 -0
  402. package/docs/images/settings/settings-mcp-servers-en.png +0 -0
  403. package/docs/images/settings/settings-plugins-en.png +0 -0
  404. package/docs/images/settings/settings-runners-en.png +0 -0
  405. package/docs/zh/00_QUICK_START.md +142 -18
  406. package/docs/zh/01_SETTINGS_REFERENCE.md +219 -98
  407. package/docs/zh/02_START_RESEARCH_GUIDE.md +26 -5
  408. package/docs/zh/05_TUI_GUIDE.md +171 -2
  409. package/docs/zh/07_MEMORY_AND_MCP.md +29 -2
  410. package/docs/zh/09_DOCTOR.md +54 -8
  411. package/docs/zh/10_WEIXIN_CONNECTOR_GUIDE.md +24 -1
  412. package/docs/zh/11_LICENSE_AND_RISK.md +4 -0
  413. package/docs/zh/12_GUIDED_WORKFLOW_TOUR.md +15 -0
  414. package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
  415. package/docs/zh/15_CODEX_PROVIDER_SETUP.md +552 -181
  416. package/docs/zh/21_LOCAL_MODEL_BACKENDS_GUIDE.md +384 -0
  417. package/docs/zh/22_BENCHSTORE_YAML_REFERENCE.md +459 -0
  418. package/docs/zh/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +287 -0
  419. package/docs/zh/23_CLAUDE_RUNNER_GUIDE.md +103 -0
  420. package/docs/zh/24_CLAUDE_CODE_PROVIDER_SETUP.md +460 -0
  421. package/docs/zh/25_OPENCODE_PROVIDER_SETUP.md +660 -0
  422. package/docs/zh/26_CITATION_AND_ATTRIBUTION.md +102 -0
  423. package/docs/zh/27_KIMI_CODE_PROVIDER_SETUP.md +51 -0
  424. package/docs/zh/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
  425. package/docs/zh/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +264 -0
  426. package/docs/zh/33_WORKSPACE_EXPLORER_QA.md +127 -0
  427. package/docs/zh/99_ACKNOWLEDGEMENTS.md +23 -19
  428. package/docs/zh/README.md +33 -7
  429. package/install.sh +168 -20
  430. package/package.json +5 -1
  431. package/pyproject.toml +2 -1
  432. package/src/deepscientist/__init__.py +1 -1
  433. package/src/deepscientist/acp/envelope.py +13 -0
  434. package/src/deepscientist/admin/__init__.py +3 -0
  435. package/src/deepscientist/admin/charts.py +681 -0
  436. package/src/deepscientist/admin/logs.py +119 -0
  437. package/src/deepscientist/admin/repairs.py +217 -0
  438. package/src/deepscientist/admin/service.py +1310 -0
  439. package/src/deepscientist/admin/system_info.py +700 -0
  440. package/src/deepscientist/admin/tasks.py +465 -0
  441. package/src/deepscientist/admin/tool_metrics.py +600 -0
  442. package/src/deepscientist/artifact/guidance.py +8 -4
  443. package/src/deepscientist/artifact/schemas.py +115 -0
  444. package/src/deepscientist/artifact/service.py +4268 -260
  445. package/src/deepscientist/bash_exec/monitor.py +30 -3
  446. package/src/deepscientist/bash_exec/service.py +134 -1
  447. package/src/deepscientist/benchstore/__init__.py +4 -0
  448. package/src/deepscientist/benchstore/prompt_builder.py +224 -0
  449. package/src/deepscientist/benchstore/service.py +1716 -0
  450. package/src/deepscientist/bridges/connectors.py +8 -2
  451. package/src/deepscientist/channels/weixin_ilink.py +8 -1
  452. package/src/deepscientist/cli.py +92 -17
  453. package/src/deepscientist/codex_cli_compat.py +187 -74
  454. package/src/deepscientist/config/models.py +82 -11
  455. package/src/deepscientist/config/service.py +1077 -93
  456. package/src/deepscientist/connector/weixin_support.py +48 -17
  457. package/src/deepscientist/daemon/api/handlers.py +827 -235
  458. package/src/deepscientist/daemon/api/router.py +81 -1
  459. package/src/deepscientist/daemon/app.py +1512 -85
  460. package/src/deepscientist/diagnostics/__init__.py +6 -0
  461. package/src/deepscientist/diagnostics/runner_failures.py +277 -0
  462. package/src/deepscientist/doctor.py +407 -56
  463. package/src/deepscientist/evidence_packets.py +590 -0
  464. package/src/deepscientist/home.py +52 -4
  465. package/src/deepscientist/kimi_cli_compat.py +50 -0
  466. package/src/deepscientist/latex_runtime.py +2 -2
  467. package/src/deepscientist/mcp/context.py +2 -0
  468. package/src/deepscientist/mcp/schemas.py +114 -0
  469. package/src/deepscientist/mcp/server.py +1566 -126
  470. package/src/deepscientist/memory/service.py +203 -16
  471. package/src/deepscientist/process_control.py +8 -1
  472. package/src/deepscientist/prompts/builder.py +850 -88
  473. package/src/deepscientist/quest/__init__.py +2 -2
  474. package/src/deepscientist/quest/layout.py +12 -1
  475. package/src/deepscientist/quest/node_traces.py +10 -0
  476. package/src/deepscientist/quest/service.py +1852 -161
  477. package/src/deepscientist/quest/stage_views.py +1 -1
  478. package/src/deepscientist/runners/__init__.py +18 -0
  479. package/src/deepscientist/runners/base.py +89 -1
  480. package/src/deepscientist/runners/builtins.py +13 -1
  481. package/src/deepscientist/runners/claude.py +391 -0
  482. package/src/deepscientist/runners/codex.py +480 -35
  483. package/src/deepscientist/runners/codex_telemetry.py +127 -0
  484. package/src/deepscientist/runners/kimi.py +334 -0
  485. package/src/deepscientist/runners/metadata.py +68 -0
  486. package/src/deepscientist/runners/opencode.py +414 -0
  487. package/src/deepscientist/runners/runtime_overrides.py +100 -0
  488. package/src/deepscientist/runners/simple_cli.py +538 -0
  489. package/src/deepscientist/runtime_storage.py +303 -0
  490. package/src/deepscientist/shared.py +80 -16
  491. package/src/deepscientist/skills/installer.py +37 -0
  492. package/src/deepscientist/skills/registry.py +2 -0
  493. package/src/deepscientist/tinytex.py +2 -2
  494. package/src/deepscientist/tui.py +10 -3
  495. package/src/prompts/benchstore/system.md +77 -0
  496. package/src/prompts/connectors/qq.md +33 -2
  497. package/src/prompts/connectors/weixin.md +208 -23
  498. package/src/prompts/contracts/admin_ops.md +74 -0
  499. package/src/prompts/contracts/admin_ops_knowledge.md +138 -0
  500. package/src/prompts/contracts/shared_interaction.md +5 -10
  501. package/src/prompts/start_setup/system.md +422 -0
  502. package/src/prompts/system.md +411 -304
  503. package/src/prompts/system_copilot.md +89 -0
  504. package/src/skills/analysis-campaign/SKILL.md +239 -578
  505. package/src/skills/analysis-campaign/references/artifact-flow-examples.md +102 -0
  506. package/src/skills/analysis-campaign/references/boundary-cases.md +98 -0
  507. package/src/skills/analysis-campaign/references/campaign-checklist-template.md +39 -24
  508. package/src/skills/analysis-campaign/references/campaign-design.md +26 -10
  509. package/src/skills/analysis-campaign/references/campaign-plan-template.md +53 -54
  510. package/src/skills/analysis-campaign/references/operational-guidance.md +97 -0
  511. package/src/skills/analysis-campaign/references/writing-facing-slice-examples.md +10 -20
  512. package/src/skills/baseline/SKILL.md +183 -461
  513. package/src/skills/baseline/references/artifact-flow-examples.md +106 -0
  514. package/src/skills/baseline/references/artifact-payload-examples.md +1 -1
  515. package/src/skills/baseline/references/baseline-checklist-template.md +27 -35
  516. package/src/skills/baseline/references/baseline-plan-template.md +37 -76
  517. package/src/skills/baseline/references/boundary-cases.md +86 -0
  518. package/src/skills/baseline/references/codebase-audit-checklist.md +2 -6
  519. package/src/skills/baseline/references/comparability-contract.md +7 -12
  520. package/src/skills/baseline/references/operational-guidance.md +56 -0
  521. package/src/skills/baseline/references/route-selection.md +5 -25
  522. package/src/skills/decision/SKILL.md +113 -306
  523. package/src/skills/decision/references/checkpoint-memory-template.md +47 -0
  524. package/src/skills/decision/references/operational-guidance.md +94 -0
  525. package/src/skills/decision/references/research-route-criteria.md +7 -8
  526. package/src/skills/decision/references/strategic-decision-template.md +13 -26
  527. package/src/skills/experiment/SKILL.md +132 -670
  528. package/src/skills/experiment/references/execution-playbook.md +374 -0
  529. package/src/skills/experiment/references/main-experiment-checklist-template.md +26 -2
  530. package/src/skills/experiment/references/main-experiment-plan-template.md +28 -17
  531. package/src/skills/experiment/references/operational-guidance.md +108 -0
  532. package/src/skills/finalize/SKILL.md +62 -0
  533. package/src/skills/finalize/references/checkpoint-memory-template.md +49 -0
  534. package/src/skills/finalize/references/resume-packet-template.md +7 -0
  535. package/src/skills/idea/SKILL.md +228 -15
  536. package/src/skills/idea/references/controlled-brainstorming-playbook.md +78 -0
  537. package/src/skills/idea/references/current-board-packet-template.md +61 -0
  538. package/src/skills/idea/references/high-value-idea-sourcing.md +119 -0
  539. package/src/skills/idea/references/idea-generation-playbook.md +21 -0
  540. package/src/skills/idea/references/idea-thinking-flow.md +6 -0
  541. package/src/skills/idea/references/literature-survey-template.md +3 -0
  542. package/src/skills/idea/references/objective-contract-template.md +54 -0
  543. package/src/skills/idea/references/outline-seeding-example.md +56 -0
  544. package/src/skills/idea/references/pre-idea-draft-template.md +105 -0
  545. package/src/skills/idea/references/related-work-playbook.md +75 -2
  546. package/src/skills/idea/references/research-history-playbook.md +114 -0
  547. package/src/skills/idea/references/selection-gate.md +58 -6
  548. package/src/skills/intake-audit/SKILL.md +43 -2
  549. package/src/skills/intake-audit/references/state-audit-template.md +10 -0
  550. package/src/skills/nature-data/SKILL.md +128 -0
  551. package/src/skills/nature-data/UPSTREAM_LICENSE.txt +21 -0
  552. package/src/skills/nature-data/agents/openai.yaml +4 -0
  553. package/src/skills/nature-data/references/chinese-author-alignment.md +84 -0
  554. package/src/skills/nature-data/references/fair-metadata-checklist.md +105 -0
  555. package/src/skills/nature-data/references/policy-principles.md +103 -0
  556. package/src/skills/nature-data/references/repository-and-identifiers.md +96 -0
  557. package/src/skills/nature-data/references/source-basis.md +54 -0
  558. package/src/skills/nature-data/references/statement-patterns.md +153 -0
  559. package/src/skills/nature-figure/SKILL.md +197 -0
  560. package/src/skills/nature-figure/UPSTREAM_LICENSE.txt +21 -0
  561. package/src/skills/nature-figure/agents/openai.yaml +4 -0
  562. package/src/skills/nature-figure/evals/evals.json +37 -0
  563. package/src/skills/nature-figure/references/api.md +428 -0
  564. package/src/skills/nature-figure/references/backend-selection.md +100 -0
  565. package/src/skills/nature-figure/references/chart-types.md +281 -0
  566. package/src/skills/nature-figure/references/common-patterns.md +349 -0
  567. package/src/skills/nature-figure/references/design-theory.md +436 -0
  568. package/src/skills/nature-figure/references/figure-contract.md +93 -0
  569. package/src/skills/nature-figure/references/nature-2026-observations.md +112 -0
  570. package/src/skills/nature-figure/references/qa-contract.md +119 -0
  571. package/src/skills/nature-figure/references/r-template-index.md +66 -0
  572. package/src/skills/nature-figure/references/r-workflow.md +161 -0
  573. package/src/skills/nature-figure/references/tutorials.md +250 -0
  574. package/src/skills/nature-paper2ppt/SKILL.md +507 -0
  575. package/src/skills/nature-paper2ppt/UPSTREAM_LICENSE.txt +21 -0
  576. package/src/skills/nature-paper2ppt/agents/openai.yaml +4 -0
  577. package/src/skills/nature-polishing/SKILL.md +385 -0
  578. package/src/skills/nature-polishing/UPSTREAM_LICENSE.txt +21 -0
  579. package/src/skills/nature-polishing/agents/openai.yaml +4 -0
  580. package/src/skills/nature-polishing/references/phrasebank-playbook.md +162 -0
  581. package/src/skills/nature-polishing/references/section-moves.md +240 -0
  582. package/src/skills/nature-polishing/references/style-guardrails.md +94 -0
  583. package/src/skills/nature-polishing/references/writing-strategy.md +148 -0
  584. package/src/skills/optimize/SKILL.md +177 -1568
  585. package/src/skills/optimize/references/brief-shaping-playbook.md +95 -0
  586. package/src/skills/optimize/references/candidate-board-template.md +13 -0
  587. package/src/skills/optimize/references/candidate-ranking-template.md +51 -0
  588. package/src/skills/optimize/references/codegen-route-playbook.md +50 -0
  589. package/src/skills/optimize/references/debug-response-template.md +29 -0
  590. package/src/skills/optimize/references/frontier-review-template.md +32 -0
  591. package/src/skills/optimize/references/fusion-playbook.md +36 -0
  592. package/src/skills/optimize/references/method-brief-template.md +73 -0
  593. package/src/skills/optimize/references/operational-guidance.md +621 -0
  594. package/src/skills/optimize/references/optimization-memory-template.md +30 -0
  595. package/src/skills/optimize/references/optimize-checklist-template.md +18 -0
  596. package/src/skills/optimize/references/plateau-response-playbook.md +28 -0
  597. package/src/skills/optimize/references/prompt-patterns.md +49 -0
  598. package/src/skills/paper-outline/SKILL.md +227 -0
  599. package/src/skills/paper-outline/references/outline-patterns.md +87 -0
  600. package/src/skills/paper-plot/SKILL.md +79 -0
  601. package/src/skills/paper-plot/agents/openai.yaml +4 -0
  602. package/src/skills/paper-plot/references/bar_grouped_hatch.md +96 -0
  603. package/src/skills/paper-plot/references/bar_paired_delta.md +72 -0
  604. package/src/skills/paper-plot/references/line_confidence_band.md +75 -0
  605. package/src/skills/paper-plot/references/line_loss_with_inset.md +65 -0
  606. package/src/skills/paper-plot/references/line_training_curve.md +44 -0
  607. package/src/skills/paper-plot/references/radar_dual_series.md +59 -0
  608. package/src/skills/paper-plot/references/scatter_broken_axis.md +59 -0
  609. package/src/skills/paper-plot/references/scatter_tsne_cluster.md +72 -0
  610. package/src/skills/paper-plot/scripts/bar_memevolve.py +109 -0
  611. package/src/skills/paper-plot/scripts/bar_spice.py +166 -0
  612. package/src/skills/paper-plot/scripts/line_aime.py +94 -0
  613. package/src/skills/paper-plot/scripts/line_loss_inset.py +157 -0
  614. package/src/skills/paper-plot/scripts/line_selfdistill.py +168 -0
  615. package/src/skills/paper-plot/scripts/radar_dora.py +151 -0
  616. package/src/skills/paper-plot/scripts/scatter_break.py +169 -0
  617. package/src/skills/paper-plot/scripts/scatter_tsne.py +133 -0
  618. package/src/skills/rebuttal/SKILL.md +9 -0
  619. package/src/skills/references/tool-usage-by-stage.md +438 -0
  620. package/src/skills/review/SKILL.md +105 -7
  621. package/src/skills/science/PROVENANCE.md +44 -0
  622. package/src/skills/science/SKILL.md +137 -0
  623. package/src/skills/science/references/artifact-science-tool.md +110 -0
  624. package/src/skills/science/references/claim-type-discipline.md +56 -0
  625. package/src/skills/science/references/domain-index.md +422 -0
  626. package/src/skills/science/references/hpc-via-bash-exec.md +42 -0
  627. package/src/skills/science/references/package-check-playbook.md +64 -0
  628. package/src/skills/science/references/package-index.min.json +3616 -0
  629. package/src/skills/science/references/packages/abinit.md +80 -0
  630. package/src/skills/science/references/packages/acts.md +73 -0
  631. package/src/skills/science/references/packages/aiida-core.md +80 -0
  632. package/src/skills/science/references/packages/alamode.md +80 -0
  633. package/src/skills/science/references/packages/amuse.md +88 -0
  634. package/src/skills/science/references/packages/anndata.md +88 -0
  635. package/src/skills/science/references/packages/arbor.md +80 -0
  636. package/src/skills/science/references/packages/arc.md +73 -0
  637. package/src/skills/science/references/packages/astropy.md +88 -0
  638. package/src/skills/science/references/packages/astroquery.md +88 -0
  639. package/src/skills/science/references/packages/atomate2.md +80 -0
  640. package/src/skills/science/references/packages/atomsmltr.md +73 -0
  641. package/src/skills/science/references/packages/awkward.md +73 -0
  642. package/src/skills/science/references/packages/batman.md +88 -0
  643. package/src/skills/science/references/packages/biopython.md +88 -0
  644. package/src/skills/science/references/packages/bloqade.md +73 -0
  645. package/src/skills/science/references/packages/brian2.md +73 -0
  646. package/src/skills/science/references/packages/bullet3.md +73 -0
  647. package/src/skills/science/references/packages/calculix.md +80 -0
  648. package/src/skills/science/references/packages/cantera.md +73 -0
  649. package/src/skills/science/references/packages/cavity-md-ipi.md +80 -0
  650. package/src/skills/science/references/packages/ccdproc.md +88 -0
  651. package/src/skills/science/references/packages/celerite2.md +88 -0
  652. package/src/skills/science/references/packages/cellrank.md +73 -0
  653. package/src/skills/science/references/packages/cesm.md +80 -0
  654. package/src/skills/science/references/packages/chemicals.md +73 -0
  655. package/src/skills/science/references/packages/chempy.md +73 -0
  656. package/src/skills/science/references/packages/cirq.md +73 -0
  657. package/src/skills/science/references/packages/coffea.md +73 -0
  658. package/src/skills/science/references/packages/cp2k.md +88 -0
  659. package/src/skills/science/references/packages/custodian.md +80 -0
  660. package/src/skills/science/references/packages/dart.md +73 -0
  661. package/src/skills/science/references/packages/datamol.md +88 -0
  662. package/src/skills/science/references/packages/dd4hep.md +73 -0
  663. package/src/skills/science/references/packages/dealii.md +80 -0
  664. package/src/skills/science/references/packages/deepchem.md +88 -0
  665. package/src/skills/science/references/packages/delphes.md +73 -0
  666. package/src/skills/science/references/packages/devito.md +80 -0
  667. package/src/skills/science/references/packages/dftb.md +88 -0
  668. package/src/skills/science/references/packages/dftd4.md +88 -0
  669. package/src/skills/science/references/packages/dftk-jl.md +80 -0
  670. package/src/skills/science/references/packages/dolfinx.md +80 -0
  671. package/src/skills/science/references/packages/drake.md +73 -0
  672. package/src/skills/science/references/packages/dumux.md +73 -0
  673. package/src/skills/science/references/packages/elk.md +80 -0
  674. package/src/skills/science/references/packages/elmerfem.md +80 -0
  675. package/src/skills/science/references/packages/enzo-e.md +88 -0
  676. package/src/skills/science/references/packages/espresso.md +80 -0
  677. package/src/skills/science/references/packages/exoplanet.md +88 -0
  678. package/src/skills/science/references/packages/fairroot.md +73 -0
  679. package/src/skills/science/references/packages/fbpic.md +80 -0
  680. package/src/skills/science/references/packages/fdtdbath-meep.md +80 -0
  681. package/src/skills/science/references/packages/geant4.md +73 -0
  682. package/src/skills/science/references/packages/geosx.md +80 -0
  683. package/src/skills/science/references/packages/gprmax.md +80 -0
  684. package/src/skills/science/references/packages/gromacs.md +80 -0
  685. package/src/skills/science/references/packages/gwaslab.md +73 -0
  686. package/src/skills/science/references/packages/gz-sim.md +73 -0
  687. package/src/skills/science/references/packages/hail.md +88 -0
  688. package/src/skills/science/references/packages/hiphive.md +80 -0
  689. package/src/skills/science/references/packages/hoomd-blue.md +80 -0
  690. package/src/skills/science/references/packages/itensor.md +73 -0
  691. package/src/skills/science/references/packages/itensors-jl.md +73 -0
  692. package/src/skills/science/references/packages/jdftx.md +73 -0
  693. package/src/skills/science/references/packages/jobflow.md +80 -0
  694. package/src/skills/science/references/packages/kadanoffbaym-jl.md +73 -0
  695. package/src/skills/science/references/packages/kite.md +80 -0
  696. package/src/skills/science/references/packages/kratos.md +80 -0
  697. package/src/skills/science/references/packages/kwant.md +73 -0
  698. package/src/skills/science/references/packages/lammps.md +80 -0
  699. package/src/skills/science/references/packages/lightkurve.md +88 -0
  700. package/src/skills/science/references/packages/limix.md +73 -0
  701. package/src/skills/science/references/packages/maxwelllink.md +80 -0
  702. package/src/skills/science/references/packages/mcdc.md +73 -0
  703. package/src/skills/science/references/packages/meep.md +80 -0
  704. package/src/skills/science/references/packages/mfem.md +80 -0
  705. package/src/skills/science/references/packages/mitgcm.md +73 -0
  706. package/src/skills/science/references/packages/modflow6.md +73 -0
  707. package/src/skills/science/references/packages/molecool.md +73 -0
  708. package/src/skills/science/references/packages/mom6.md +73 -0
  709. package/src/skills/science/references/packages/moose.md +80 -0
  710. package/src/skills/science/references/packages/mpas-model.md +73 -0
  711. package/src/skills/science/references/packages/mujoco.md +73 -0
  712. package/src/skills/science/references/packages/mumax3.md +73 -0
  713. package/src/skills/science/references/packages/nekrs.md +80 -0
  714. package/src/skills/science/references/packages/nessi.md +73 -0
  715. package/src/skills/science/references/packages/nest-simulator.md +73 -0
  716. package/src/skills/science/references/packages/netket.md +73 -0
  717. package/src/skills/science/references/packages/neuron.md +73 -0
  718. package/src/skills/science/references/packages/nextflow.md +88 -0
  719. package/src/skills/science/references/packages/nwchem.md +88 -0
  720. package/src/skills/science/references/packages/openbabel.md +88 -0
  721. package/src/skills/science/references/packages/openems.md +80 -0
  722. package/src/skills/science/references/packages/openff-toolkit.md +88 -0
  723. package/src/skills/science/references/packages/openfoam-dev.md +80 -0
  724. package/src/skills/science/references/packages/openmc.md +73 -0
  725. package/src/skills/science/references/packages/openmm.md +80 -0
  726. package/src/skills/science/references/packages/openmoc.md +73 -0
  727. package/src/skills/science/references/packages/openmx.md +80 -0
  728. package/src/skills/science/references/packages/opensees.md +80 -0
  729. package/src/skills/science/references/packages/opensn.md +80 -0
  730. package/src/skills/science/references/packages/opm-simulators.md +73 -0
  731. package/src/skills/science/references/packages/oqupy.md +73 -0
  732. package/src/skills/science/references/packages/packmol.md +80 -0
  733. package/src/skills/science/references/packages/palabos.md +80 -0
  734. package/src/skills/science/references/packages/parflow.md +80 -0
  735. package/src/skills/science/references/packages/pennylane.md +88 -0
  736. package/src/skills/science/references/packages/perceval.md +73 -0
  737. package/src/skills/science/references/packages/phono3py.md +73 -0
  738. package/src/skills/science/references/packages/phonopy.md +73 -0
  739. package/src/skills/science/references/packages/photutils.md +88 -0
  740. package/src/skills/science/references/packages/picongpu.md +80 -0
  741. package/src/skills/science/references/packages/plink-ng.md +88 -0
  742. package/src/skills/science/references/packages/precice.md +73 -0
  743. package/src/skills/science/references/packages/psc.md +80 -0
  744. package/src/skills/science/references/packages/psi4.md +88 -0
  745. package/src/skills/science/references/packages/pybinding.md +73 -0
  746. package/src/skills/science/references/packages/pyfr.md +80 -0
  747. package/src/skills/science/references/packages/pyhf.md +73 -0
  748. package/src/skills/science/references/packages/pyiron_base.md +80 -0
  749. package/src/skills/science/references/packages/pylcp.md +73 -0
  750. package/src/skills/science/references/packages/pylith.md +80 -0
  751. package/src/skills/science/references/packages/pynbody.md +88 -0
  752. package/src/skills/science/references/packages/pysam.md +88 -0
  753. package/src/skills/science/references/packages/pyscf.md +88 -0
  754. package/src/skills/science/references/packages/q-e.md +73 -0
  755. package/src/skills/science/references/packages/qibo.md +73 -0
  756. package/src/skills/science/references/packages/qiskit.md +73 -0
  757. package/src/skills/science/references/packages/quantica-jl.md +73 -0
  758. package/src/skills/science/references/packages/quantumoptics-jl.md +73 -0
  759. package/src/skills/science/references/packages/quimb.md +73 -0
  760. package/src/skills/science/references/packages/qulacs.md +73 -0
  761. package/src/skills/science/references/packages/qutip.md +73 -0
  762. package/src/skills/science/references/packages/rdkit.md +88 -0
  763. package/src/skills/science/references/packages/rmg-py.md +73 -0
  764. package/src/skills/science/references/packages/root.md +73 -0
  765. package/src/skills/science/references/packages/scanpy.md +88 -0
  766. package/src/skills/science/references/packages/scikit-allel.md +88 -0
  767. package/src/skills/science/references/packages/scikit-bio.md +88 -0
  768. package/src/skills/science/references/packages/scqubits.md +73 -0
  769. package/src/skills/science/references/packages/scuff-em.md +80 -0
  770. package/src/skills/science/references/packages/scvi-tools.md +73 -0
  771. package/src/skills/science/references/packages/seissol.md +73 -0
  772. package/src/skills/science/references/packages/sfepy.md +80 -0
  773. package/src/skills/science/references/packages/sisl.md +73 -0
  774. package/src/skills/science/references/packages/smilei.md +80 -0
  775. package/src/skills/science/references/packages/snakemake.md +88 -0
  776. package/src/skills/science/references/packages/specfem3d-globe.md +80 -0
  777. package/src/skills/science/references/packages/specutils.md +88 -0
  778. package/src/skills/science/references/packages/spglib.md +80 -0
  779. package/src/skills/science/references/packages/squidpy.md +88 -0
  780. package/src/skills/science/references/packages/starry.md +88 -0
  781. package/src/skills/science/references/packages/strawberryfields.md +73 -0
  782. package/src/skills/science/references/packages/su2.md +80 -0
  783. package/src/skills/science/references/packages/sunny-jl.md +73 -0
  784. package/src/skills/science/references/packages/sw4.md +73 -0
  785. package/src/skills/science/references/packages/swift.md +88 -0
  786. package/src/skills/science/references/packages/tdnegf.md +73 -0
  787. package/src/skills/science/references/packages/tenpy.md +73 -0
  788. package/src/skills/science/references/packages/thermo.md +73 -0
  789. package/src/skills/science/references/packages/tkwant.md +73 -0
  790. package/src/skills/science/references/packages/tvb-root.md +73 -0
  791. package/src/skills/science/references/packages/uproot5.md +73 -0
  792. package/src/skills/science/references/packages/vampire.md +80 -0
  793. package/src/skills/science/references/packages/wannier_tools.md +73 -0
  794. package/src/skills/science/references/packages/warpx.md +80 -0
  795. package/src/skills/science/references/packages/wrf.md +73 -0
  796. package/src/skills/science/references/packages/xtb.md +88 -0
  797. package/src/skills/science/references/packages/yt.md +73 -0
  798. package/src/skills/science/references/science-task-brief-template.md +71 -0
  799. package/src/skills/scout/SKILL.md +83 -425
  800. package/src/skills/scout/references/literature-scout-template.md +5 -24
  801. package/src/skills/scout/references/operational-guidance.md +191 -0
  802. package/src/skills/scout/references/paper-triage-playbook.md +11 -35
  803. package/src/skills/write/SKILL.md +744 -1246
  804. package/src/skills/write/references/experiments_analysis_patterns.md +129 -0
  805. package/src/skills/write/references/oral_package_patterns.md +252 -0
  806. package/src/skills/write/references/oral_writing_principles.md +291 -0
  807. package/src/skills/write/references/section_rewrite_checklist.md +234 -0
  808. package/src/tui/dist/app/AppContainer.js +1314 -27
  809. package/src/tui/dist/components/Composer.js +26 -1
  810. package/src/tui/dist/components/ConfigScreen.js +2 -1
  811. package/src/tui/dist/components/InputPrompt.js +25 -9
  812. package/src/tui/dist/components/MainContent.js +18 -3
  813. package/src/tui/dist/components/QuestScreen.js +3 -2
  814. package/src/tui/dist/components/UtilityScreen.js +37 -0
  815. package/src/tui/dist/hooks/useSafeInput.js +10 -0
  816. package/src/tui/dist/index.js +13 -1
  817. package/src/tui/dist/layouts/DefaultAppLayout.js +11 -8
  818. package/src/tui/dist/lib/api.js +89 -1
  819. package/src/tui/package.json +1 -1
  820. package/src/ui/dist/assets/{AnalysisPlugin-DnSm0GZn.js → AnalysisPlugin-CA94NGmI.js} +1 -1
  821. package/src/ui/dist/assets/CliPlugin-DHBzphZU.js +79 -0
  822. package/src/ui/dist/assets/CodeEditorPlugin-BOFwD2rn.js +2 -0
  823. package/src/ui/dist/assets/{CodeViewerPlugin-itb0tltR.js → CodeViewerPlugin-CqDpgjik.js} +4 -4
  824. package/src/ui/dist/assets/{DocViewerPlugin-DqKkiCI6.js → DocViewerPlugin-UDBgt8-4.js} +3 -3
  825. package/src/ui/dist/assets/GitCommitViewerPlugin-BmHtZ0bZ.js +6 -0
  826. package/src/ui/dist/assets/{GitDiffViewerPlugin-DxL2ezFG.js → GitDiffViewerPlugin-CAxjNorQ.js} +2 -2
  827. package/src/ui/dist/assets/{GitSnapshotViewer-B_RQm1YZ.js → GitSnapshotViewer-CweA6VON.js} +2 -2
  828. package/src/ui/dist/assets/{ImageViewerPlugin-tHqlXY3n.js → ImageViewerPlugin-C8wHGvGN.js} +5 -5
  829. package/src/ui/dist/assets/LabPlugin-COyyLUol.js +32 -0
  830. package/src/ui/dist/assets/{LatexPlugin-B495DTXC.js → LatexPlugin-BQjAaA5J.js} +4 -4
  831. package/src/ui/dist/assets/{MarkdownViewerPlugin-DG28-61B.js → MarkdownViewerPlugin-Dy1NE2dI.js} +3 -3
  832. package/src/ui/dist/assets/{MarketplacePlugin-BiOGT-Kj.js → MarketplacePlugin-DMIZtEJ2.js} +2 -2
  833. package/src/ui/dist/assets/NotebookEditor-CFHMq_Qt.js +91 -0
  834. package/src/ui/dist/assets/{NotebookEditor-CVsj8h_T.js → NotebookEditor-WFyd8Ybt.js} +23 -23
  835. package/src/ui/dist/assets/{PdfLoader-CASDQmxJ.js → PdfLoader-CLE5u5TS.js} +3 -3
  836. package/src/ui/dist/assets/{PdfMarkdownPlugin-BFhwoKsY.js → PdfMarkdownPlugin-_iNK_H83.js} +1 -1
  837. package/src/ui/dist/assets/PdfViewerPlugin-DgWsbInT.js +22 -0
  838. package/src/ui/dist/assets/SearchPlugin-DrZmn5iw.js +11 -0
  839. package/src/ui/dist/assets/{TextViewerPlugin-CB4DYfWO.js → TextViewerPlugin-D1-T3aC7.js} +4 -4
  840. package/src/ui/dist/assets/branding/runner-claude.svg +107 -0
  841. package/src/ui/dist/assets/branding/runner-codex.svg +10 -0
  842. package/src/ui/dist/assets/branding/runner-kimi.svg +14 -0
  843. package/src/ui/dist/assets/branding/runner-opencode.svg +7 -0
  844. package/src/ui/dist/assets/cli-store-CoZ-x5Ip.js +1 -0
  845. package/src/ui/dist/assets/{code-DLC6G24T.js → code-DbsmSd3Y.js} +1 -1
  846. package/src/ui/dist/assets/file-diff-panel-DsvyRz47.js +1 -0
  847. package/src/ui/dist/assets/{wrap-text-CwMn-iqb.js → file-jump-queue-DeQBikaw.js} +3 -3
  848. package/src/ui/dist/assets/{file-socket-Cu4Qln7Y.js → file-socket-DA5XIx88.js} +1 -1
  849. package/src/ui/dist/assets/fonts/ds-fonts.css +50 -4
  850. package/src/ui/dist/assets/images/deepxiv/register-guide.png +0 -0
  851. package/src/ui/dist/assets/index-39vY9LmZ.js +1 -0
  852. package/src/ui/dist/assets/{index-wQ7RIIRd.js → index-BsO46tJA.js} +1 -1
  853. package/src/ui/dist/assets/index-CHzJ2xtB.js +3530 -0
  854. package/src/ui/dist/assets/index-DH-zxoZ3.css +33 -0
  855. package/src/ui/dist/assets/{plugin-notebook-HbW2K-1c.js → plugin-notebook-JRhysCqj.js} +2 -2
  856. package/src/ui/dist/assets/{project-sync-CsX08Qno.js → project-sync-DPmWKmKD.js} +1 -1
  857. package/src/ui/dist/assets/{zoom-out-R-GWEhzS.js → zoom-out-DAukFWen.js} +3 -3
  858. package/src/ui/dist/index.html +3 -3
  859. package/src/skills/analysis-campaign/references/artifact-orchestration.md +0 -58
  860. package/src/skills/baseline/references/memory-playbook.md +0 -40
  861. package/src/skills/baseline/references/publishable-baseline-package.md +0 -30
  862. package/src/skills/write/references/outline-evidence-contract-example.md +0 -107
  863. package/src/skills/write/references/paper-experiment-matrix-template.md +0 -131
  864. package/src/skills/write/references/paper-section-playbook.md +0 -64
  865. package/src/skills/write/references/reviewer-first-writing.md +0 -64
  866. package/src/skills/write/references/revision-checklist.md +0 -70
  867. package/src/skills/write/references/section-contracts.md +0 -82
  868. package/src/skills/write/references/sentence-level-proofing.md +0 -49
  869. package/src/ui/dist/assets/AiManusChatView-COFACy7V.js +0 -204
  870. package/src/ui/dist/assets/CliPlugin-CvwCmDQ5.js +0 -109
  871. package/src/ui/dist/assets/CodeEditorPlugin-cOqSa0xq.js +0 -2
  872. package/src/ui/dist/assets/GitCommitViewerPlugin-DVgNHBCS.js +0 -1
  873. package/src/ui/dist/assets/LabCopilotPanel-ClMbq5Yu.js +0 -14
  874. package/src/ui/dist/assets/LabPlugin-L_SuE8ow.js +0 -22
  875. package/src/ui/dist/assets/NotebookEditor-C-4Kt1p9.js +0 -81
  876. package/src/ui/dist/assets/PdfViewerPlugin-DcOzU9vd.js +0 -17
  877. package/src/ui/dist/assets/SearchPlugin-CHj7M58O.js +0 -16
  878. package/src/ui/dist/assets/VNCViewer-CjlbyCB3.js +0 -11
  879. package/src/ui/dist/assets/bot-CFkZY-JP.js +0 -6
  880. package/src/ui/dist/assets/chevron-up-Dq5ofbht.js +0 -6
  881. package/src/ui/dist/assets/file-content-Dv4LoZec.js +0 -1
  882. package/src/ui/dist/assets/file-diff-panel-Denq-lC3.js +0 -1
  883. package/src/ui/dist/assets/file-jump-queue-DA-SdG__.js +0 -1
  884. package/src/ui/dist/assets/git-commit-horizontal-BUh6G52n.js +0 -6
  885. package/src/ui/dist/assets/image-B9HUUddG.js +0 -6
  886. package/src/ui/dist/assets/index-B2B1sg-M.js +0 -1
  887. package/src/ui/dist/assets/index-Cgla8biy.css +0 -33
  888. package/src/ui/dist/assets/index-DRyx7vAc.js +0 -1
  889. package/src/ui/dist/assets/index-Gbl53BNp.js +0 -2496
  890. package/src/ui/dist/assets/pdf-effect-queue-ZtnHFCAi.js +0 -6
  891. package/src/ui/dist/assets/popover-DL6h35vr.js +0 -1
  892. package/src/ui/dist/assets/select-DvmXt1yY.js +0 -11
  893. package/src/ui/dist/assets/sigma-7jpXazui.js +0 -6
  894. package/src/ui/dist/assets/trash-xA7kFt8i.js +0 -11
  895. package/src/ui/dist/assets/useCliAccess-DsMwDjOp.js +0 -1
  896. package/src/ui/dist/assets/useFileDiffOverlay-FuhcnKiw.js +0 -1
@@ -162,8 +162,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`),B=C,D=v),T===void 0&&(
162
162
  `},u]}}const dB=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),fB=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],hB=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],pB=[...fB,...hB],gB=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ZC=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),XC=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),mB=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),bB=ZC.concat(XC).sort().reverse();function yB(t){const e=dB(t),n=bB,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],l=[],a=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},u=function(k,y,_){return{className:k,begin:y,relevance:_}},c={$pattern:/[a-z-]+/,keyword:r,attribute:gB.join(" ")},d={begin:"\\(",end:"\\)",contains:l,keywords:c,relevance:0};l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,a("'"),a('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=l.concat({begin:/\{/,end:/\}/,contains:o}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},p={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+mB.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:l,relevance:0}},b={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},m={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+pB.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+ZC.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+XC.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},E={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[m]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,E,p,m,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function EB(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function kB(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,s,o]}}function wB(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,a={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},c={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(u,{contains:[]}),f=t.inherit(c,{contains:[]});u.contains.push(f),c.contains.push(d);let h=[n,a];return[u,c,d,f].forEach(m=>{m.contains=m.contains.concat(h)}),h=h.concat(u,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,s,u,c,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,a,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function _B(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},a={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+a.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:a,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function vB(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},a={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[t.BACKSLASH_ESCAPE,s,a],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,m="\\1")=>{const E=m==="\\1"?m:e.concat(m,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,m,r)},h=(g,b,m)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,m,r),p=[a,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=p,o.contains=p,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:p}}function xB(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=e.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},a={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=t.inherit(t.APOS_STRING_MODE,{illegal:null}),c=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(a)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(a),"on:begin":(te,Z)=>{Z.data._beginMatch=te[1]||te[2]},"on:end":(te,Z)=>{Z.data._beginMatch!==te[1]&&Z.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
163
163
  ]`,p={scope:"string",variants:[c,u,d,f]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],y={keyword:m,literal:(te=>{const Z=[];return te.forEach(A=>{Z.push(A),A.toLowerCase()===A?Z.push(A.toUpperCase()):Z.push(A.toLowerCase())}),Z})(b),built_in:E},_=te=>te.map(Z=>Z.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",_(E).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},x=e.concat(r,"\\b(?!\\()"),S={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),x],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),x],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},O={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},L={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[O,o,S,t.C_BLOCK_COMMENT_MODE,p,g,w]},G={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(m).join("\\b|"),"|",_(E).join("\\b|"),"\\b)"),r,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[L]};L.contains.push(G);const U=[O,S,t.C_BLOCK_COMMENT_MODE,p,g,w],j={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...U]},...U,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:y,contains:[j,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},o,G,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},w,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:y,contains:["self",j,o,S,t.C_BLOCK_COMMENT_MODE,p,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},p,g]}}function SB(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function CB(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function AB(t){const e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},a={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},c={begin:/\{\{/,relevance:0},d={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a,c,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,c,u]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${p})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${f})[jJ](?=${p})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",a,g,d,t.HASH_COMMENT_MODE]}]};return u.contains=[d,g,a],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[a,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,d]}]}}function TB(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function NB(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function MB(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},a={begin:"#<",end:">"},u=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[t.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,c]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},w=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(a,u),relevance:0}].concat(a,u);c.contains=w,g.contains=w;const L=[{begin:/^\s*=>/,starts:{end:"$",contains:w}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:w}}];return u.unshift(a),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(L).concat(u).concat(w)}}function OB(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],a=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:c,keyword:l,literal:a,built_in:u},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:u,type:c}},{className:"punctuation",begin:"->"},s]}}const DB=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),RB=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],IB=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],LB=[...RB,...IB],PB=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),FB=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),BB=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),zB=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function $B(t){const e=DB(t),n=BB,r=FB,i="@[a-z-]+",s="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+LB.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+zB.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,l,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:PB.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function UB(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function HB(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],a=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],c=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=c,p=[...u,...a].filter(_=>!c.includes(_)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},m={match:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function E(_){return e.concat(/\b/,e.either(..._.map(w=>w.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:E(f),relevance:0};function y(_,{exceptions:w,when:x}={}){const S=x;return w=w||[],_.map(O=>O.match(/\|\d+$/)||w.includes(O)?O:S(O)?`${O}|0`:O)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:y(p,{when:_=>_.length<3}),literal:s,type:l,built_in:d},contains:[{scope:"type",match:E(o)},k,m,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function QC(t){return t?typeof t=="string"?t:t.source:null}function Ql(t){return xe("(?=",t,")")}function xe(...t){return t.map(n=>QC(n)).join("")}function VB(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function $t(...t){return"("+(VB(t).capture?"":"?:")+t.map(r=>QC(r)).join("|")+")"}const mb=t=>xe(/\b/,t,/\w$/.test(t)?/\b/:/\B/),WB=["Protocol","Type"].map(mb),Aw=["init","self"].map(mb),KB=["Any","Self"],l0=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Tw=["false","nil","true"],jB=["assignment","associativity","higherThan","left","lowerThan","none","right"],qB=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Nw=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],e3=$t(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),t3=$t(e3,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),a0=xe(e3,t3,"*"),n3=$t(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),If=$t(n3,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),pr=xe(n3,If,"*"),Pc=xe(/[A-Z]/,If,"*"),GB=["attached","autoclosure",xe(/convention\(/,$t("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",xe(/objc\(/,pr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],YB=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function JB(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,$t(...WB,...Aw)],className:{2:"keyword"}},s={match:xe(/\./,$t(...l0)),relevance:0},o=l0.filter(oe=>typeof oe=="string").concat(["_|0"]),l=l0.filter(oe=>typeof oe!="string").concat(KB).map(mb),a={variants:[{className:"keyword",match:$t(...l,...Aw)}]},u={$pattern:$t(/\b\w+/,/#\w+/),keyword:o.concat(qB),literal:Tw},c=[i,s,a],d={match:xe(/\./,$t(...Nw)),relevance:0},f={className:"built_in",match:xe(/\b/,$t(...Nw),/(?=\()/)},h=[d,f],p={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:a0},{match:`\\.(\\.|${t3})+`}]},b=[p,g],m="([0-9]_*)+",E="([0-9a-fA-F]_*)+",k={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},y=(oe="")=>({className:"subst",variants:[{match:xe(/\\/,oe,/[0\\tnr"']/)},{match:xe(/\\/,oe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(oe="")=>({className:"subst",match:xe(/\\/,oe,/[\t ]*(?:[\r\n]|\r\n)/)}),w=(oe="")=>({className:"subst",label:"interpol",begin:xe(/\\/,oe,/\(/),end:/\)/}),x=(oe="")=>({begin:xe(oe,/"""/),end:xe(/"""/,oe),contains:[y(oe),_(oe),w(oe)]}),S=(oe="")=>({begin:xe(oe,/"/),end:xe(/"/,oe),contains:[y(oe),w(oe)]}),O={className:"string",variants:[x(),x("#"),x("##"),x("###"),S(),S("#"),S("##"),S("###")]},L=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],G={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:L},U=oe=>{const Tt=xe(oe,/\//),Y=xe(/\//,oe);return{begin:Tt,end:Y,contains:[...L,{scope:"comment",begin:`#(?!.*${Y})`,end:/$/}]}},j={scope:"regexp",variants:[U("###"),U("##"),U("#"),G]},te={match:xe(/`/,pr,/`/)},Z={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${If}+`},C=[te,Z,A],v={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:YB,contains:[...b,k,O]}]}},T={scope:"keyword",match:xe(/@/,$t(...GB),Ql($t(/\(/,/\s+/)))},D={scope:"meta",match:xe(/@/,pr)},B=[v,T,D],V={match:Ql(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:xe(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,If,"+")},{className:"type",match:Pc,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:xe(/\s+&\s+/,Ql(Pc)),relevance:0}]},de={begin:/</,end:/>/,keywords:u,contains:[...r,...c,...B,p,V]};V.contains.push(de);const fe={match:xe(pr,/\s*:/),keywords:"_|0",relevance:0},ie={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",fe,...r,j,...c,...h,...b,k,O,...C,...B,V]},ge={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,V]},nt={begin:$t(Ql(xe(pr,/\s*:/)),Ql(xe(pr,/\s+/,pr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:pr}]},at={begin:/\(/,end:/\)/,keywords:u,contains:[nt,...r,...c,...b,k,O,...B,V,ie],endsParent:!0,illegal:/["']/},fn={match:[/(func|macro)/,/\s+/,$t(te.match,pr,a0)],className:{1:"keyword",3:"title.function"},contains:[ge,at,e],illegal:[/\[/,/%/]},Jt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ge,at,e],illegal:/\[|%/},Nn={match:[/operator/,/\s+/,a0],className:{1:"keyword",3:"title"}},dr={begin:[/precedencegroup/,/\s+/,Pc],className:{1:"keyword",3:"title"},contains:[V],keywords:[...jB,...Tw],end:/}/},Zt={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Xt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Je={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,pr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[ge,...c,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Pc},...c],relevance:0}]};for(const oe of O.variants){const Tt=oe.contains.find(Q=>Q.label==="interpol");Tt.keywords=u;const Y=[...c,...h,...b,k,O,...C];Tt.contains=[...Y,{begin:/\(/,end:/\)/,contains:["self",...Y]}]}return{name:"Swift",keywords:u,contains:[...r,fn,Jt,Zt,Xt,Je,Nn,dr,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},j,...c,...h,...b,k,O,...C,...B,V,ie]}}const Lf="[A-Za-z$_][0-9A-Za-z$_]*",r3=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],i3=["true","false","null","undefined","NaN","Infinity"],s3=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o3=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l3=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],a3=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],u3=[].concat(l3,s3,o3);function ZB(t){const e=t.regex,n=(v,{after:T})=>{const D="</"+v[0].slice(1);return v.input.indexOf(D,T)!==-1},r=Lf,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(v,T)=>{const D=v[0].length+v.index,B=v.input[D];if(B==="<"||B===","){T.ignoreMatch();return}B===">"&&(n(v,{after:D})||T.ignoreMatch());let V;const de=v.input.substring(D);if(V=de.match(/^\s*=/)){T.ignoreMatch();return}if((V=de.match(/^\s+extends\s+/))&&V.index===0){T.ignoreMatch();return}}},l={$pattern:Lf,keyword:r3,literal:i3,built_in:u3,"variable.language":a3},a="[0-9](_?[0-9])*",u=`\\.(${a})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${a})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},E={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},k=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,b,{match:/\$\d+/},d];f.contains=k.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(k)});const y=[].concat(E,f.contains),_=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(y)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},x={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...s3,...o3]}},O={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},L={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(v){return e.concat("(?!",v.join("|"),")")}const j={match:e.concat(/\b/,U([...l3,"super","import"].map(v=>`${v}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},te={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),O,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,b,E,{match:/\$\d+/},d,S,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,t.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},L,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},te,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},j,G,x,Z,{match:/\$[(.]/}]}}function XB(t){const e=t.regex,n=ZB(t),r=Lf,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Lf,keyword:r3.concat(a),literal:i3,built_in:u3.concat(i),"variable.language":a3},c={className:"meta",begin:"@"+r},d=(g,b,m)=>{const E=g.contains.findIndex(k=>k.label===b);if(E===-1)throw new Error("can not find mode to replace");g.contains.splice(E,1,m)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(c);const f=n.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,h]),n.contains=n.contains.concat([c,s,o,h]),d(n,"shebang",t.SHEBANG()),d(n,"use_strict",l);const p=n.contains.find(g=>g.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function QB(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,a={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},c={className:"label",begin:/^\w+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,a,u,c,d,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function e7(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},a={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,a,u,l]}}function t7(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(s,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),a=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,a,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,a,l]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function n7(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},l=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],m=[...b];return m.pop(),m.push(l),h.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const xW={arduino:BF,bash:zF,c:$F,cpp:UF,csharp:HF,css:ZF,diff:XF,go:QF,graphql:eB,ini:tB,java:nB,javascript:lB,json:aB,kotlin:cB,less:yB,lua:EB,makefile:kB,markdown:wB,objectivec:_B,perl:vB,php:xB,"php-template":SB,plaintext:CB,python:AB,"python-repl":TB,r:NB,ruby:MB,rust:OB,scss:$B,shell:UB,sql:HB,swift:JB,typescript:XB,vbnet:QB,wasm:e7,xml:t7,yaml:n7};function c3(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&c3(n)}),t}class Mw{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function d3(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Ii(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const r7="</span>",Ow=t=>!!t.scope,i7=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class s7{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=d3(e)}openNode(e){if(!Ow(e))return;const n=i7(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Ow(e)&&(this.buffer+=r7)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Dw=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class bb{constructor(){this.rootNode=Dw(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=Dw({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{bb._collapse(n)}))}}class o7 extends bb{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new s7(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function bu(t){return t?typeof t=="string"?t:t.source:null}function f3(t){return uo("(?=",t,")")}function l7(t){return uo("(?:",t,")*")}function a7(t){return uo("(?:",t,")?")}function uo(...t){return t.map(n=>bu(n)).join("")}function u7(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function yb(...t){return"("+(u7(t).capture?"":"?:")+t.map(r=>bu(r)).join("|")+")"}function h3(t){return new RegExp(t.toString()+"|").exec("").length-1}function c7(t,e){const n=t&&t.exec(e);return n&&n.index===0}const d7=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Eb(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=bu(r),o="";for(;s.length>0;){const l=d7.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+i):(o+=l[0],l[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const f7=/\b\B/,p3="[a-zA-Z]\\w*",kb="[a-zA-Z_]\\w*",g3="\\b\\d+(\\.\\d+)?",m3="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",b3="\\b(0b[01]+)",h7="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",p7=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=uo(e,/.*\b/,t.binary,/\b.*/)),Ii({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},yu={begin:"\\\\[\\s\\S]",relevance:0},g7={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[yu]},m7={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[yu]},b7={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Oh=function(t,e,n={}){const r=Ii({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=yb("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:uo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},y7=Oh("//","$"),E7=Oh("/\\*","\\*/"),k7=Oh("#","$"),w7={scope:"number",begin:g3,relevance:0},_7={scope:"number",begin:m3,relevance:0},v7={scope:"number",begin:b3,relevance:0},x7={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[yu,{begin:/\[/,end:/\]/,relevance:0,contains:[yu]}]},S7={scope:"title",begin:p3,relevance:0},C7={scope:"title",begin:kb,relevance:0},A7={begin:"\\.\\s*"+kb,relevance:0},T7=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var Fc=Object.freeze({__proto__:null,APOS_STRING_MODE:g7,BACKSLASH_ESCAPE:yu,BINARY_NUMBER_MODE:v7,BINARY_NUMBER_RE:b3,COMMENT:Oh,C_BLOCK_COMMENT_MODE:E7,C_LINE_COMMENT_MODE:y7,C_NUMBER_MODE:_7,C_NUMBER_RE:m3,END_SAME_AS_BEGIN:T7,HASH_COMMENT_MODE:k7,IDENT_RE:p3,MATCH_NOTHING_RE:f7,METHOD_GUARD:A7,NUMBER_MODE:w7,NUMBER_RE:g3,PHRASAL_WORDS_MODE:b7,QUOTE_STRING_MODE:m7,REGEXP_MODE:x7,RE_STARTERS_RE:h7,SHEBANG:p7,TITLE_MODE:S7,UNDERSCORE_IDENT_RE:kb,UNDERSCORE_TITLE_MODE:C7});function N7(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function M7(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function O7(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=N7,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function D7(t,e){Array.isArray(t.illegal)&&(t.illegal=yb(...t.illegal))}function R7(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function I7(t,e){t.relevance===void 0&&(t.relevance=1)}const L7=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=uo(n.beforeMatch,f3(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},P7=["of","and","for","in","not","or","if","then","parent","list","value"],F7="keyword";function y3(t,e,n=F7){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,y3(t[s],e,s))}),r;function i(s,o){e&&(o=o.map(l=>l.toLowerCase())),o.forEach(function(l){const a=l.split("|");r[a[0]]=[s,B7(a[0],a[1])]})}}function B7(t,e){return e?Number(e):z7(t)?0:1}function z7(t){return P7.includes(t.toLowerCase())}const Rw={},zs=t=>{console.error(t)},Iw=(t,...e)=>{console.log(`WARN: ${t}`,...e)},ko=(t,e)=>{Rw[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Rw[`${t}/${e}`]=!0)},Pf=new Error;function E3(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let l=1;l<=e.length;l++)o[l+r]=i[l],s[l+r]=!0,r+=h3(e[l-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function $7(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw zs("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Pf;if(typeof t.beginScope!="object"||t.beginScope===null)throw zs("beginScope must be object"),Pf;E3(t,t.begin,{key:"beginScope"}),t.begin=Eb(t.begin,{joinWith:""})}}function U7(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw zs("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Pf;if(typeof t.endScope!="object"||t.endScope===null)throw zs("endScope must be object"),Pf;E3(t,t.end,{key:"endScope"}),t.end=Eb(t.end,{joinWith:""})}}function H7(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function V7(t){H7(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),$7(t),U7(t)}function W7(t){function e(o,l){return new RegExp(bu(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,l]),this.matchAt+=h3(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(a=>a[1]);this.matcherRe=e(Eb(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const a=this.matcherRe.exec(l);if(!a)return null;const u=a.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return a.splice(0,u),Object.assign(a,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const a=new n;return this.rules.slice(l).forEach(([u,c])=>a.addRule(u,c)),a.compile(),this.multiRegexes[l]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,a){this.rules.push([l,a]),a.type==="begin"&&this.count++}exec(l){const a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let u=a.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(o){const l=new r;return o.contains.forEach(a=>l.addRule(a.begin,{rule:a,type:"begin"})),o.terminatorEnd&&l.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&l.addRule(o.illegal,{type:"illegal"}),l}function s(o,l){const a=o;if(o.isCompiled)return a;[M7,R7,V7,L7].forEach(c=>c(o,l)),t.compilerExtensions.forEach(c=>c(o,l)),o.__beforeBegin=null,[O7,D7,I7].forEach(c=>c(o,l)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=y3(o.keywords,t.case_insensitive)),a.keywordPatternRe=e(u,!0),l&&(o.begin||(o.begin=/\B|\b/),a.beginRe=e(a.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(a.endRe=e(a.end)),a.terminatorEnd=bu(a.end)||"",o.endsWithParent&&l.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+l.terminatorEnd)),o.illegal&&(a.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(c){return K7(c==="self"?o:c)})),o.contains.forEach(function(c){s(c,a)}),o.starts&&s(o.starts,l),a.matcher=i(a),a}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ii(t.classNameAliases||{}),s(t)}function k3(t){return t?t.endsWithParent||k3(t.starts):!1}function K7(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ii(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:k3(t)?Ii(t,{starts:t.starts?Ii(t.starts):null}):Object.isFrozen(t)?Ii(t):t}var j7="11.11.1";class q7 extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const u0=d3,Lw=Ii,Pw=Symbol("nomatch"),G7=7,w3=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:o7};function a(A){return l.noHighlightRe.test(A)}function u(A){let C=A.className+" ";C+=A.parentNode?A.parentNode.className:"";const v=l.languageDetectRe.exec(C);if(v){const T=S(v[1]);return T||(Iw(s.replace("{}",v[1])),Iw("Falling back to no-highlight mode for this block.",A)),T?v[1]:"no-highlight"}return C.split(/\s+/).find(T=>a(T)||S(T))}function c(A,C,v){let T="",D="";typeof C=="object"?(T=A,v=C.ignoreIllegals,D=C.language):(ko("10.7.0","highlight(lang, code, ...args) has been deprecated."),ko("10.7.0",`Please use highlight(code, options) instead.
164
164
  https://github.com/highlightjs/highlight.js/issues/2277`),D=A,T=C),v===void 0&&(v=!0);const B={code:T,language:D};te("before:highlight",B);const V=B.result?B.result:d(B.language,B.code,v);return V.code=B.code,te("after:highlight",V),V}function d(A,C,v,T){const D=Object.create(null);function B(z,N){return z.keywords[N]}function V(){if(!Y.keywords){ye.addText(ee);return}let z=0;Y.keywordPatternRe.lastIndex=0;let N=Y.keywordPatternRe.exec(ee),I="";for(;N;){I+=ee.substring(z,N.index);const H=Je.case_insensitive?N[0].toLowerCase():N[0],re=B(Y,H);if(re){const[ve,hn]=re;if(ye.addText(I),I="",D[H]=(D[H]||0)+1,D[H]<=G7&&(pe+=hn),ve.startsWith("_"))I+=N[0];else{const $l=Je.classNameAliases[ve]||ve;ie(N[0],$l)}}else I+=N[0];z=Y.keywordPatternRe.lastIndex,N=Y.keywordPatternRe.exec(ee)}I+=ee.substring(z),ye.addText(I)}function de(){if(ee==="")return;let z=null;if(typeof Y.subLanguage=="string"){if(!e[Y.subLanguage]){ye.addText(ee);return}z=d(Y.subLanguage,ee,!0,Q[Y.subLanguage]),Q[Y.subLanguage]=z._top}else z=h(ee,Y.subLanguage.length?Y.subLanguage:null);Y.relevance>0&&(pe+=z.relevance),ye.__addSublanguage(z._emitter,z.language)}function fe(){Y.subLanguage!=null?de():V(),ee=""}function ie(z,N){z!==""&&(ye.startScope(N),ye.addText(z),ye.endScope())}function ge(z,N){let I=1;const H=N.length-1;for(;I<=H;){if(!z._emit[I]){I++;continue}const re=Je.classNameAliases[z[I]]||z[I],ve=N[I];re?ie(ve,re):(ee=ve,V(),ee=""),I++}}function nt(z,N){return z.scope&&typeof z.scope=="string"&&ye.openNode(Je.classNameAliases[z.scope]||z.scope),z.beginScope&&(z.beginScope._wrap?(ie(ee,Je.classNameAliases[z.beginScope._wrap]||z.beginScope._wrap),ee=""):z.beginScope._multi&&(ge(z.beginScope,N),ee="")),Y=Object.create(z,{parent:{value:Y}}),Y}function at(z,N,I){let H=c7(z.endRe,I);if(H){if(z["on:end"]){const re=new Mw(z);z["on:end"](N,re),re.isMatchIgnored&&(H=!1)}if(H){for(;z.endsParent&&z.parent;)z=z.parent;return z}}if(z.endsWithParent)return at(z.parent,N,I)}function fn(z){return Y.matcher.regexIndex===0?(ee+=z[0],1):(Mn=!0,0)}function Jt(z){const N=z[0],I=z.rule,H=new Mw(I),re=[I.__beforeBegin,I["on:begin"]];for(const ve of re)if(ve&&(ve(z,H),H.isMatchIgnored))return fn(N);return I.skip?ee+=N:(I.excludeBegin&&(ee+=N),fe(),!I.returnBegin&&!I.excludeBegin&&(ee=N)),nt(I,z),I.returnBegin?0:N.length}function Nn(z){const N=z[0],I=C.substring(z.index),H=at(Y,z,I);if(!H)return Pw;const re=Y;Y.endScope&&Y.endScope._wrap?(fe(),ie(N,Y.endScope._wrap)):Y.endScope&&Y.endScope._multi?(fe(),ge(Y.endScope,z)):re.skip?ee+=N:(re.returnEnd||re.excludeEnd||(ee+=N),fe(),re.excludeEnd&&(ee=N));do Y.scope&&ye.closeNode(),!Y.skip&&!Y.subLanguage&&(pe+=Y.relevance),Y=Y.parent;while(Y!==H.parent);return H.starts&&nt(H.starts,z),re.returnEnd?0:N.length}function dr(){const z=[];for(let N=Y;N!==Je;N=N.parent)N.scope&&z.unshift(N.scope);z.forEach(N=>ye.openNode(N))}let Zt={};function Xt(z,N){const I=N&&N[0];if(ee+=z,I==null)return fe(),0;if(Zt.type==="begin"&&N.type==="end"&&Zt.index===N.index&&I===""){if(ee+=C.slice(N.index,N.index+1),!i){const H=new Error(`0 width match regex (${A})`);throw H.languageName=A,H.badRule=Zt.rule,H}return 1}if(Zt=N,N.type==="begin")return Jt(N);if(N.type==="illegal"&&!v){const H=new Error('Illegal lexeme "'+I+'" for mode "'+(Y.scope||"<unnamed>")+'"');throw H.mode=Y,H}else if(N.type==="end"){const H=Nn(N);if(H!==Pw)return H}if(N.type==="illegal"&&I==="")return ee+=`
165
- `,1;if(Et>1e5&&Et>N.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ee+=I,I.length}const Je=S(A);if(!Je)throw zs(s.replace("{}",A)),new Error('Unknown language: "'+A+'"');const oe=W7(Je);let Tt="",Y=T||oe;const Q={},ye=new l.__emitter(l);dr();let ee="",pe=0,Ze=0,Et=0,Mn=!1;try{if(Je.__emitTokens)Je.__emitTokens(C,ye);else{for(Y.matcher.considerAll();;){Et++,Mn?Mn=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=Ze;const z=Y.matcher.exec(C);if(!z)break;const N=C.substring(Ze,z.index),I=Xt(N,z);Ze=z.index+I}Xt(C.substring(Ze))}return ye.finalize(),Tt=ye.toHTML(),{language:A,value:Tt,relevance:pe,illegal:!1,_emitter:ye,_top:Y}}catch(z){if(z.message&&z.message.includes("Illegal"))return{language:A,value:u0(C),illegal:!0,relevance:0,_illegalBy:{message:z.message,index:Ze,context:C.slice(Ze-100,Ze+100),mode:z.mode,resultSoFar:Tt},_emitter:ye};if(i)return{language:A,value:u0(C),illegal:!1,relevance:0,errorRaised:z,_emitter:ye,_top:Y};throw z}}function f(A){const C={value:u0(A),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return C._emitter.addText(A),C}function h(A,C){C=C||l.languages||Object.keys(e);const v=f(A),T=C.filter(S).filter(L).map(fe=>d(fe,A,!1));T.unshift(v);const D=T.sort((fe,ie)=>{if(fe.relevance!==ie.relevance)return ie.relevance-fe.relevance;if(fe.language&&ie.language){if(S(fe.language).supersetOf===ie.language)return 1;if(S(ie.language).supersetOf===fe.language)return-1}return 0}),[B,V]=D,de=B;return de.secondBest=V,de}function p(A,C,v){const T=C&&n[C]||v;A.classList.add("hljs"),A.classList.add(`language-${T}`)}function g(A){let C=null;const v=u(A);if(a(v))return;if(te("before:highlightElement",{el:A,language:v}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new q7("One of your code blocks includes unescaped HTML.",A.innerHTML);C=A;const T=C.textContent,D=v?c(T,{language:v,ignoreIllegals:!0}):h(T);A.innerHTML=D.value,A.dataset.highlighted="yes",p(A,v,D.language),A.result={language:D.language,re:D.relevance,relevance:D.relevance},D.secondBest&&(A.secondBest={language:D.secondBest.language,relevance:D.secondBest.relevance}),te("after:highlightElement",{el:A,result:D,text:T})}function b(A){l=Lw(l,A)}const m=()=>{y(),ko("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){y(),ko("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function y(){function A(){y()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",A,!1),k=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function _(A,C){let v=null;try{v=C(t)}catch(T){if(zs("Language definition for '{}' could not be registered.".replace("{}",A)),i)zs(T);else throw T;v=o}v.name||(v.name=A),e[A]=v,v.rawDefinition=C.bind(null,t),v.aliases&&O(v.aliases,{languageName:A})}function w(A){delete e[A];for(const C of Object.keys(n))n[C]===A&&delete n[C]}function x(){return Object.keys(e)}function S(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function O(A,{languageName:C}){typeof A=="string"&&(A=[A]),A.forEach(v=>{n[v.toLowerCase()]=C})}function L(A){const C=S(A);return C&&!C.disableAutodetect}function G(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=C=>{A["before:highlightBlock"](Object.assign({block:C.el},C))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=C=>{A["after:highlightBlock"](Object.assign({block:C.el},C))})}function U(A){G(A),r.push(A)}function j(A){const C=r.indexOf(A);C!==-1&&r.splice(C,1)}function te(A,C){const v=A;r.forEach(function(T){T[v]&&T[v](C)})}function Z(A){return ko("10.7.0","highlightBlock will be removed entirely in v12.0"),ko("10.7.0","Please use highlightElement now."),g(A)}Object.assign(t,{highlight:c,highlightAuto:h,highlightAll:y,highlightElement:g,highlightBlock:Z,configure:b,initHighlighting:m,initHighlightingOnLoad:E,registerLanguage:_,unregisterLanguage:w,listLanguages:x,getLanguage:S,registerAliases:O,autoDetection:L,inherit:Lw,addPlugin:U,removePlugin:j}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=j7,t.regex={concat:uo,lookahead:f3,either:yb,optional:a7,anyNumberOfTimes:l7};for(const A in Fc)typeof Fc[A]=="object"&&c3(Fc[A]);return Object.assign(t,Fc),t},yl=w3({});yl.newInstance=()=>w3({});var Y7=yl;yl.HighlightJS=yl;yl.default=yl;const J7=A_(Y7),Fw={},Z7="hljs-";function SW(t){const e=J7.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:l};function n(a,u,c){const d=c||Fw,f=typeof d.prefix=="string"?d.prefix:Z7;if(!e.getLanguage(a))throw new Error("Unknown language: `"+a+"` is not registered");e.configure({__emitter:X7,classPrefix:f});const h=e.highlight(u,{ignoreIllegals:!0,language:a});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const p=h._emitter.root,g=p.data;return g.language=h.language,g.relevance=h.relevance,p}function r(a,u){const d=(u||Fw).subset||i();let f=-1,h=0,p;for(;++f<d.length;){const g=d[f];if(!e.getLanguage(g))continue;const b=n(g,a,u);b.data&&b.data.relevance!==void 0&&b.data.relevance>h&&(h=b.data.relevance,p=b)}return p||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return e.listLanguages()}function s(a,u){if(typeof a=="string")e.registerLanguage(a,u);else{let c;for(c in a)Object.hasOwn(a,c)&&e.registerLanguage(c,a[c])}}function o(a,u){if(typeof a=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:a});else{let c;for(c in a)if(Object.hasOwn(a,c)){const d=a[c];e.registerAliases(typeof d=="string"?d:[...d],{languageName:c})}}}function l(a){return!!e.getLanguage(a)}}class X7{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}let Xg,Qg;if(typeof WeakMap<"u"){let t=new WeakMap;Xg=e=>t.get(e),Qg=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Xg=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Qg=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ve=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(t){return Xg(t)||Qg(t,Q7(t))}};function Q7(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=ez(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=t.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:b,rowspan:m,colwidth:E}=g.attrs;for(let k=0;k<m;k++){if(k+u>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:m-k});break}const y=i+k*e;for(let _=0;_<b;_++){r[y+_]==0?r[y+_]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:b-_});const w=E&&E[_];if(w){const x=(y+_)%e*2,S=o[x];S==null||S!=w&&o[x+1]==1?(o[x]=w,o[x+1]=1):S==w&&o[x+1]++}}}i+=b,c+=g.nodeSize}const f=(u+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Ve(e,n,r,s);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(a=!0);return a&&tz(l,o,t),l}function ez(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function tz(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const c=e[(i+u)%t.width*2];c!=null&&(!a.colwidth||a.colwidth[u]!=c)&&((l||(l=nz(a)))[u]=c)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function nz(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Pt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Si=new Le("selectingCells");function to(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function rz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function cr(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Dh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=to(e.$head)||iz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function iz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function em(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function sz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function wb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function _3(t,e,n){const r=t.node(-1),i=Ve.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function no(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function v3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function oz(t,e,n){const r=Pt(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Oe=class $r extends ne{constructor(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(c=>c!=n.pos-s);a.unshift(n.pos-s);const u=a.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new o2(l.resolve(f),l.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(em(r)&&em(i)&&wb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?$r.rowSelection(r,i):s&&this.isColSelection()?$r.colSelection(r,i):new $r(r,i)}return X.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ve.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const u=[];for(let c=a*n.width+i.left,d=i.left;d<i.right;d++,c++){const f=n.map[c];if(s[f])continue;s[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,b=h.right-i.right;if(g>0||b>0){let m=p.attrs;if(g>0&&(m=no(m,0,g)),b>0&&(m=no(m,m.colspan-b,b)),h.left<i.left){if(p=p.type.createAndFill(m),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(m)}`)}else p=p.type.create(m,p.content)}if(h.top<i.top||h.bottom>i.bottom){const m={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(m):p=p.type.create(m,p.content)}u.push(p)}o.push(e.child(a).copy(R.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new $(R.from(l),1,1)}replace(e,n=$.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(a.pos),o?$.empty:n)}const s=ne.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new $(R.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ve.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new $r(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ve.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof $r&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new $r(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new $r(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new $r(e.resolve(n),e.resolve(r))}getBookmark(){return new lz(this.$anchorCell.pos,this.$headCell.pos)}};Oe.prototype.visible=!1;ne.jsonID("cell",Oe);var lz=class x3{constructor(e,n){this.anchor=e,this.head=n}map(e){return new x3(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&wb(n,r)?new Oe(n,r):ne.near(r,1)}};function az(t){if(!(t.selection instanceof Oe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ot.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Te.create(t.doc,e)}function uz({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function cz({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function dz(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof J&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Oe.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=Oe.rowSelection(l,l)}else if(!n){const l=Ve.get(r.node),a=r.from+1,u=a+l.map[l.width*l.height-1];s=Oe.create(i,a+1,u)}}else r instanceof X&&uz(r)?s=X.create(i,r.from):r instanceof X&&cz(r)&&(s=X.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const fz=new Le("fix-tables");function S3(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let u=l,c=Math.min(i,o+3);u<c;u++)if(t.child(u)==a){l=u+1,n+=a.nodeSize;continue e}r(a,n),l<i&&t.child(l).sameMarkup(a)?S3(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function C3(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=hz(t,i,s,n))};return e?e.doc!=t.doc&&S3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function hz(t,e,n,r){const i=Ve.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const u=i.problems[a];if(u.type=="collision"){const c=e.nodeAt(u.pos);if(!c)continue;const d=c.attrs;for(let f=0;f<d.rowspan;f++)s[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,no(d,d.colspan-u.n,u.n))}else if(u.type=="missing")s[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,u=n+1;a<i.height;a++){const c=e.child(a),d=u+c.nodeSize,f=s[a];if(f>0){let h="cell";c.firstChild&&(h=c.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const m=Pt(t.schema)[h].createAndFill();m&&p.push(m)}const g=(a==0||o==a-1)&&l==a?u+1:d-1;r.insert(r.mapping.map(g),p)}u=d}return r.setMeta(fz,{fixTables:!0})}function Rr(t){const e=t.selection,n=Dh(t),r=n.node(-1),i=n.start(-1),s=Ve.get(r);return{...e instanceof Oe?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function A3(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;oz(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,v3(u.attrs,i-e.colCount(a))),o+=u.attrs.rowspan-1}else{const a=s==null?Pt(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,u=e.positionAt(o,i,r);t.insert(t.mapping.map(n+u),a.createAndFill())}}return t}function pz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(A3(t.tr,n,n.left))}return!0}function gz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(A3(t.tr,n,n.right))}return!0}function mz(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,a=e.map[l],u=n.nodeAt(a),c=u.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(s).map(r+a),null,no(c,i-e.colCount(a)));else{const d=t.mapping.slice(s).map(r+a);t.delete(d,d+u.nodeSize)}o+=c.rowspan}}function bz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;mz(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ve.get(s)}e(r)}return!0}function yz(t,e,n){var r;const i=Pt(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function T3(t,{map:e,tableStart:n,table:r},i){let s=n;for(let u=0;u<i;u++)s+=r.child(u).nodeSize;const o=[];let l=i>0?-1:0;yz(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let u=0,c=e.width*i;u<e.width;u++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{var a;const d=l==null?Pt(r.type.schema).cell:(a=r.nodeAt(e.map[c+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&o.push(f)}return t.insert(s,Pt(r.type.schema).row.create(null,o)),t}function Ez(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(T3(t.tr,n,n.top))}return!0}function kz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(T3(t.tr,n,n.bottom))}return!0}function wz(t,{map:e,table:n,tableStart:r},i){let s=0;for(let u=0;u<i;u++)s+=n.child(u).nodeSize;const o=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,o+r);const a=new Set;for(let u=0,c=i*e.width;u<e.width;u++,c++){const d=e.map[c];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[c-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,u,n);t.insert(t.mapping.slice(l).map(r+g),p),u+=h.colspan-1}}}}function _z(t,e){if(!cr(t))return!1;if(e){const n=Rr(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;wz(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ve.get(n.table)}e(r)}return!0}function Bw(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function vz({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function zw(t,e){const n=t.selection;if(!(n instanceof Oe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Rr(t),{map:i}=r;if(vz(i,r))return!1;if(e){const s=t.tr,o={};let l=R.empty,a,u;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const f=i.map[c*i.width+d],h=r.table.nodeAt(f);if(!(o[f]||!h))if(o[f]=!0,a==null)a=f,u=h;else{Bw(h)||(l=l.append(h.content));const p=s.mapping.map(f+r.tableStart);s.delete(p,p+h.nodeSize)}}if(a==null||u==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...v3(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const c=a+1+u.content.size,d=Bw(u)?a+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,l)}s.setSelection(new Oe(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function $w(t,e){const n=Pt(t.schema);return xz(({node:r})=>n[r.type.spec.tableRole])(t,e)}function xz(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Oe){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=rz(r.$from),!i)return!1;s=(o=to(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const c=Rr(e),d=e.tr;for(let h=0;h<c.right-c.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let f;for(let h=c.top;h<c.bottom;h++){let p=c.map.positionAt(h,c.left,c.table);h==c.top&&(p+=i.nodeSize);for(let g=c.left,b=0;g<c.right;g++,b++)g==c.left&&h==c.top||d.insert(f=d.mapping.map(p+c.tableStart,1),t({node:i,row:h,col:g}).createAndFill(a[b]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),a[0]),r instanceof Oe&&d.setSelection(new Oe(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function Sz(t,e){return function(n,r){if(!cr(n))return!1;const i=Dh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Oe?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Cz(t){return function(e,n){if(!cr(e))return!1;if(n){const r=Pt(e.schema),i=Rr(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length===0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);n(s)}return!0}}function Uw(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Eu(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Cz(t):function(n,r){if(!cr(n))return!1;if(r){const i=Pt(n.schema),s=Rr(n),o=n.tr,l=Uw("row",s,i),a=Uw("column",s,i),u=(t==="column"?l:t==="row"&&a)?1:0,c=t=="column"?{left:0,top:u,right:1,bottom:s.map.height}:t=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?a?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}Eu("row",{useDeprecatedLogic:!0});Eu("column",{useDeprecatedLogic:!0});const Az=Eu("cell",{useDeprecatedLogic:!0});function Tz(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Hw(t){return function(e,n){if(!cr(e))return!1;const r=Tz(Dh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(X.between(i,sz(i))).scrollIntoView())}return!0}}function Nz(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Bc(t,e){const n=t.selection;if(!(n instanceof Oe))return!1;if(e){const r=t.tr,i=Pt(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new $(i,0,0))}),r.docChanged&&e(r)}return!0}function Mz(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const c=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(u=tm(Pt(o).row,new $(u,c,d)).content),l.push(u)}else if(s=="cell"||s=="header_cell")l.push(n||r?tm(Pt(o).row,new $(e,n,r)).content:e);else return null;return Oz(o,l)}function Oz(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let u=i;u<i+l;u++)n[u]=(n[u]||0)+a}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(R.empty),n[i]<r){const s=Pt(t).cell.createAndFill(),o=[];for(let l=n[i];l<r;l++)o.push(s);e[i]=e[i].append(R.from(o))}return{height:e.length,width:r,rows:e}}function tm(t,e){const n=t.createAndFill();return new h1(n).replace(0,n.content.size,e).doc}function Dz({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let l=0;l<n.length;l++){const a=n[l],u=[];for(let c=s[l]||0,d=0;c<r;d++){let f=a.child(d%a.childCount);c+f.attrs.colspan>r&&(f=f.type.createChecked(no(f.attrs,f.attrs.colspan,c+f.attrs.colspan-r),f.content)),u.push(f),c+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)s[l+h]=(s[l+h]||0)+f.attrs.colspan}o.push(R.from(u))}n=o,t=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const a=[],u=n[l%e];for(let c=0;c<u.childCount;c++){let d=u.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(R.from(a))}n=s,e=i}return{width:t,height:e,rows:n}}function Rz(t,e,n,r,i,s,o){const l=t.doc.type.schema,a=Pt(l);let u,c;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=c||(c=a.header_cell.createAndFill());for(let b=e.width;b<i;b++)p.push(g);t.insert(t.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const b=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==a.header_cell;d.push(b?c||(c=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const f=a.row.create(null,R.from(d)),h=[];for(let p=e.height;p<s;p++)h.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(u||c)}function Vw(t,e,n,r,i,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let u=i;u<s;u++){const c=o*e.width+u,d=e.map[c];if(e.map[c-e.width]==d){a=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:o-h}),t.insert(t.mapping.slice(l).map(e.positionAt(o,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-o})),u+=f.attrs.colspan-1}}return a}function Ww(t,e,n,r,i,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let u=i;u<s;u++){const c=u*e.width+o,d=e.map[c];if(e.map[c-1]==d){a=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,no(f.attrs,o-h,f.attrs.colspan-(o-h))),t.insert(p+f.nodeSize,f.type.createAndFill(no(f.attrs,0,o-h))),u+=f.attrs.rowspan-1}}return a}function Kw(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Ve.get(s);const{top:l,left:a}=r,u=a+i.width,c=l+i.height,d=t.tr;let f=0;function h(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Ve.get(s),f=d.mapping.maps.length}Rz(d,o,s,n,u,c,f)&&h(),Vw(d,o,s,n,a,u,l,f)&&h(),Vw(d,o,s,n,a,u,c,f)&&h(),Ww(d,o,s,n,l,c,a,f)&&h(),Ww(d,o,s,n,l,c,u,f)&&h();for(let p=l;p<c;p++){const g=o.positionAt(p,a,s),b=o.positionAt(p,u,s);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new $(i.rows[p-l],0,0))}h(),d.setSelection(new Oe(d.doc.resolve(n+o.positionAt(l,a,s)),d.doc.resolve(n+o.positionAt(c-1,u-1,s)))),e(d)}const Iz=C1({ArrowLeft:zc("horiz",-1),ArrowRight:zc("horiz",1),ArrowUp:zc("vert",-1),ArrowDown:zc("vert",1),"Shift-ArrowLeft":$c("horiz",-1),"Shift-ArrowRight":$c("horiz",1),"Shift-ArrowUp":$c("vert",-1),"Shift-ArrowDown":$c("vert",1),Backspace:Bc,"Mod-Backspace":Bc,Delete:Bc,"Mod-Delete":Bc});function ld(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function zc(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Oe)return ld(n,r,ne.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=N3(i,t,e);if(o==null)return!1;if(t=="horiz")return ld(n,r,ne.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(o),a=_3(l,t,e);let u;return a?u=ne.near(a,1):e<0?u=ne.near(n.doc.resolve(l.before(-1)),-1):u=ne.near(n.doc.resolve(l.after(-1)),1),ld(n,r,u)}}}function $c(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Oe)o=s;else{const a=N3(i,t,e);if(a==null)return!1;o=new Oe(n.doc.resolve(a))}const l=_3(o.$headCell,t,e);return l?ld(n,r,new Oe(o.$anchorCell,l)):!1}}function Lz(t,e){const n=t.state.doc,r=to(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Oe(r))),!0):!1}function Pz(t,e,n){if(!cr(t.state))return!1;let r=Mz(n);const i=t.state.selection;if(i instanceof Oe){r||(r={width:1,height:1,rows:[R.from(tm(Pt(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=Ve.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Dz(r,l.right-l.left,l.bottom-l.top),Kw(t.state,t.dispatch,o,l,r),!0}else if(r){const s=Dh(t.state),o=s.start(-1);return Kw(t.state,t.dispatch,o,Ve.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Fz(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=jw(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Oe)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=to(t.state.selection.$anchor))!=null&&((n=c0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,u){let c=c0(t,u);const d=Si.getState(t.state)==null;if(!c||!wb(a,c))if(d)c=a;else return;const f=new Oe(a,c);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(Si,a.pos),t.dispatch(h)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),Si.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Si,-1))}function l(a){const u=a,c=Si.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(jw(t,u.target)!=r&&(d=c0(t,e),!d))return o();d&&s(d,u)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function N3(t,e,n){if(!(t.state.selection instanceof X))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function jw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function c0(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&to(t.state.doc.resolve(r))||to(t.state.doc.resolve(i))}var Bz=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),nm(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,nm(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function nm(t,e,n,r,i,s){let o=0,l=!0,a=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let g=0;g<h;g++,f++){const b=i==f?s:p&&p[g],m=b?b+"px":"";if(o+=b||r,b||(l=!1),a)a.style.width!=m&&(a.style.width=m),a=a.nextSibling;else{const E=document.createElement("col");E.style.width=m,e.appendChild(E)}}}for(;a;){var c;const d=a.nextSibling;(c=a.parentNode)===null||c===void 0||c.removeChild(a),a=d}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const yn=new Le("tableColumnResizing");function zz({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Bz,lastColumnResizable:i=!0}={}){const s=new Ae({key:yn,state:{init(o,l){var a;const u=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,c=Pt(l.schema).table.name;return r&&u&&(u[c]=(d,f)=>new r(d,n,f)),new $z(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=yn.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Uz(o,l,t,i)},mouseleave:o=>{Hz(o)},mousedown:(o,l)=>{Vz(o,l,e,n)}},decorations:o=>{const l=yn.getState(o);if(l&&l.activeHandle>-1)return Gz(o,l.activeHandle)},nodeViews:{}}});return s}var $z=class ad{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(yn);if(r&&r.setHandle!=null)return new ad(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ad(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return em(e.doc.resolve(i))||(i=-1),new ad(i,n.dragging)}return n}};function Uz(t,e,n,r){if(!t.editable)return;const i=yn.getState(t.state);if(i&&!i.dragging){const s=Kz(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?o=qw(t,e,"left",n):a-e.clientX<=n&&(o=qw(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),a=l.node(-1),u=Ve.get(a),c=l.start(-1);if(u.colCount(l.pos-c)+l.nodeAfter.attrs.colspan-1==u.width-1)return}M3(t,o)}}}function Hz(t){if(!t.editable)return;const e=yn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&M3(t,-1)}function Vz(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=yn.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),a=Wz(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(yn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(d){s.removeEventListener("mouseup",u),s.removeEventListener("mousemove",c);const f=yn.getState(t.state);f?.dragging&&(jz(t,f.activeHandle,Gw(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(yn,{setDragging:null})))}function c(d){if(!d.which)return u(d);const f=yn.getState(t.state);if(f&&f.dragging){const h=Gw(f.dragging,d,n);Yw(t,f.activeHandle,h,r)}}return Yw(t,o.activeHandle,a,r),s.addEventListener("mouseup",u),s.addEventListener("mousemove",c),e.preventDefault(),!0}function Wz(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(o-=r[a],l--);return o/l}function Kz(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function qw(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=to(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const a=Ve.get(l.node(-1)),u=l.start(-1),c=a.map.indexOf(l.pos-u);return c%a.width==0?-1:u+a.map[c-1]}function Gw(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function M3(t,e){t.dispatch(t.state.tr.setMeta(yn,{setHandle:e}))}function jz(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ve.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let u=0;u<s.height;u++){const c=u*s.width+l;if(u&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-s.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():qz(f.colspan);p[h]=n,a.setNodeMarkup(o+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function Yw(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=Ve.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let a=t.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&nm(s,a.firstChild,a,r,l,n)}function qz(t){return Array(t).fill(0)}function Gz(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Te.empty;const s=Ve.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<s.height;u++){const c=l+u*s.width;if((l==s.width-1||s.map[c]!=s.map[c+1])&&(u==0||s.map[c]!=s.map[c-s.width])){var a;const d=s.map[c],f=o+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=yn.getState(t))===null||a===void 0)&&a.dragging&&n.push(ot.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ot.widget(f,h))}}return Te.create(t.doc,n)}function Yz({allowTableNodeSelection:t=!1}={}){return new Ae({key:Si,state:{init(){return null},apply(e,n){const r=e.getMeta(Si);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:az,handleDOMEvents:{mousedown:Fz},createSelectionBetween(e){return Si.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Lz,handleKeyDown:Iz,handlePaste:Pz},appendTransaction(e,n,r){return dz(r,C3(r,n),t)}})}function rm(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Jw(t,e,n,r,i,s){var o;let l=0,a=!0,u=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,f=0;d<c.childCount;d+=1){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const b=i===f?s:p&&p[g],m=b?`${b}px`:"";if(l+=b||r,b||(a=!1),u){if(u.style.width!==m){const[E,k]=rm(r,b);u.style.setProperty(E,k)}u=u.nextSibling}else{const E=document.createElement("col"),[k,y]=rm(r,b);E.style.setProperty(k,y),e.appendChild(E)}}}for(;u;){const d=u.nextSibling;(o=u.parentNode)===null||o===void 0||o.removeChild(u),u=d}a?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class Jz{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jw(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Jw(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function Zz(t,e,n,r){let i=0,s=!0;const o=[],l=t.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const b=n===f?r:p&&p[g];i+=b||e,b||(s=!1);const[m,E]=rm(e,b);o.push(["col",{style:`${m}: ${E}`}])}}const a=s?`${i}px`:"",u=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:a,tableMinWidth:u}}function Zw(t,e){return t.createAndFill()}function Xz(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function Qz(t,e,n,r,i){const s=Xz(t),o=[],l=[];for(let u=0;u<n;u+=1){const c=Zw(s.cell);if(c&&l.push(c),r){const d=Zw(s.header_cell);d&&o.push(d)}}const a=[];for(let u=0;u<e;u+=1)a.push(s.row.createChecked(null,r&&u===0?o:l));return s.table.createChecked(null,a)}function e$(t){return t instanceof Oe}const Uc=({editor:t})=>{const{selection:e}=t.state;if(!e$(e))return!1;let n=0;const r=dS(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},AW=Ke.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Jz,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=Zz(t,this.options.cellMinWidth),s=["table",Ce(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=Qz(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(X.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>pz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>gz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>bz(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Ez(t,e),addRowAfter:()=>({state:t,dispatch:e})=>kz(t,e),deleteRow:()=>({state:t,dispatch:e})=>_z(t,e),deleteTable:()=>({state:t,dispatch:e})=>Nz(t,e),mergeCells:()=>({state:t,dispatch:e})=>zw(t,e),splitCell:()=>({state:t,dispatch:e})=>$w(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Eu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Eu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Az(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>zw(t,e)?!0:$w(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Sz(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Hw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Hw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&C3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Oe.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Uc,"Mod-Backspace":Uc,Delete:Uc,"Mod-Delete":Uc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[zz({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Yz({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ae(K(t,"tableRole",e))}}}),TW=Ke.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ce(this.options.HTMLAttributes,t),0]}}),NW=Ke.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ce(this.options.HTMLAttributes,t),0]}}),MW=Ke.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ce(this.options.HTMLAttributes,t),0]}}),cn=()=>new Map,im=t=>{const e=cn();return t.forEach((n,r)=>{e.set(r,n)}),e},Ir=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},t$=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},n$=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},ts=()=>new Set,d0=t=>t[t.length-1],r$=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},ii=Array.from,_b=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},vb=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},i$=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},El=Array.isArray;class O3{constructor(){this._observers=cn()}on(e,n){return Ir(this._observers,e,ts).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return ii((this._observers.get(e)||cn()).values()).forEach(r=>r(...n))}destroy(){this._observers=cn()}}class s${constructor(){this._observers=cn()}on(e,n){Ir(this._observers,e,ts).add(n)}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return ii((this._observers.get(e)||cn()).values()).forEach(r=>r(...n))}destroy(){this._observers=cn()}}const Jn=Math.floor,ud=Math.abs,kl=(t,e)=>t<e?t:e,si=(t,e)=>t>e?t:e,D3=t=>t!==0?t<0:1/t<0,Xw=1,Qw=2,f0=4,h0=8,ku=32,Zr=64,Wt=128,o$=1<<29,Rh=31,sm=63,$s=127,l$=2147483647,Ff=Number.MAX_SAFE_INTEGER,e_=Number.MIN_SAFE_INTEGER,a$=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Jn(t)===t),R3=String.fromCharCode,u$=t=>t.toLowerCase(),c$=/^\s*/g,d$=t=>t.replace(c$,""),f$=/([A-Z])/g,t_=(t,e)=>d$(t.replace(f$,n=>`${e}${u$(n)}`)),h$=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},wu=typeof TextEncoder<"u"?new TextEncoder:null,p$=t=>wu.encode(t),g$=wu?p$:h$;let Da=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Da&&Da.decode(new Uint8Array).length===1&&(Da=null);const m$=(t,e)=>i$(e,()=>t).join("");class Gu{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const co=()=>new Gu,b$=t=>{const e=co();return t(e),_n(e)},y$=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},_n=t=>{const e=new Uint8Array(y$(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},E$=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(si(n,e)*2),t.cpos=0)},ct=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},om=ct,ue=(t,e)=>{for(;e>$s;)ct(t,Wt|$s&e),e=Jn(e/128);ct(t,$s&e)},xb=(t,e)=>{const n=D3(e);for(n&&(e=-e),ct(t,(e>sm?Wt:0)|(n?Zr:0)|sm&e),e=Jn(e/64);e>0;)ct(t,(e>$s?Wt:0)|$s&e),e=Jn(e/128)},lm=new Uint8Array(3e4),k$=lm.length/3,w$=(t,e)=>{if(e.length<k$){const n=wu.encodeInto(e,lm).written||0;ue(t,n);for(let r=0;r<n;r++)ct(t,lm[r])}else pn(t,g$(e))},_$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;ue(t,r);for(let i=0;i<r;i++)ct(t,n.codePointAt(i))},Gi=wu&&wu.encodeInto?w$:_$,Ih=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=kl(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(si(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},pn=(t,e)=>{ue(t,e.byteLength),Ih(t,e)},Sb=(t,e)=>{E$(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},v$=(t,e)=>Sb(t,4).setFloat32(0,e,!1),x$=(t,e)=>Sb(t,8).setFloat64(0,e,!1),S$=(t,e)=>Sb(t,8).setBigInt64(0,e,!1),n_=new DataView(new ArrayBuffer(4)),C$=t=>(n_.setFloat32(0,t),n_.getFloat32(0)===t),wl=(t,e)=>{switch(typeof e){case"string":ct(t,119),Gi(t,e);break;case"number":a$(e)&&ud(e)<=l$?(ct(t,125),xb(t,e)):C$(e)?(ct(t,124),v$(t,e)):(ct(t,123),x$(t,e));break;case"bigint":ct(t,122),S$(t,e);break;case"object":if(e===null)ct(t,126);else if(El(e)){ct(t,117),ue(t,e.length);for(let n=0;n<e.length;n++)wl(t,e[n])}else if(e instanceof Uint8Array)ct(t,116),pn(t,e);else{ct(t,118);const n=Object.keys(e);ue(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Gi(t,i),wl(t,e[i])}}break;case"boolean":ct(t,e?120:121);break;default:ct(t,127)}};class r_ extends Gu{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ue(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const i_=t=>{t.count>0&&(xb(t.encoder,t.count===1?t.s:-t.s),t.count>1&&ue(t.encoder,t.count-2))};class cd{constructor(){this.encoder=new Gu,this.s=0,this.count=0}write(e){this.s===e?this.count++:(i_(this),this.count=1,this.s=e)}toUint8Array(){return i_(this),_n(this.encoder)}}const s_=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);xb(t.encoder,e),t.count>1&&ue(t.encoder,t.count-2)}};class p0{constructor(){this.encoder=new Gu,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(s_(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return s_(this),_n(this.encoder)}}class A${constructor(){this.sarr=[],this.s="",this.lensE=new cd}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Gu;return this.sarr.push(this.s),this.s="",Gi(e,this.sarr.join("")),Ih(e,this.lensE.toUint8Array()),_n(e)}}const Mr=t=>new Error(t),Vn=()=>{throw Mr("Method unimplemented")},Ft=()=>{throw Mr("Unexpected case")},I3=Mr("Unexpected end of array"),L3=Mr("Integer out of Range");class Lh{constructor(e){this.arr=e,this.pos=0}}const hs=t=>new Lh(t),T$=t=>t.pos!==t.arr.length,N$=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},gn=t=>N$(t,le(t)),_l=t=>t.arr[t.pos++],le=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&$s)*n,n*=128,i<Wt)return e;if(e>Ff)throw L3}throw I3},Cb=t=>{let e=t.arr[t.pos++],n=e&sm,r=64;const i=(e&Zr)>0?-1:1;if(!(e&Wt))return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&$s)*r,r*=128,e<Wt)return i*n;if(n>Ff)throw L3}throw I3},M$=t=>{let e=le(t);if(e===0)return"";{let n=String.fromCodePoint(_l(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(_l(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},O$=t=>Da.decode(gn(t)),Yi=Da?O$:M$,Ab=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},D$=t=>Ab(t,4).getFloat32(0,!1),R$=t=>Ab(t,8).getFloat64(0,!1),I$=t=>Ab(t,8).getBigInt64(0,!1),L$=[t=>{},t=>null,Cb,D$,R$,I$,t=>!1,t=>!0,Yi,t=>{const e=le(t),n={};for(let r=0;r<e;r++){const i=Yi(t);n[i]=_u(t)}return n},t=>{const e=le(t),n=[];for(let r=0;r<e;r++)n.push(_u(t));return n},gn],_u=t=>L$[127-_l(t)](t);class o_ extends Lh{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),T$(this)?this.count=le(this)+1:this.count=-1),this.count--,this.s}}class dd extends Lh{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Cb(this);const e=D3(this.s);this.count=1,e&&(this.s=-this.s,this.count=le(this)+2)}return this.count--,this.s}}class g0 extends Lh{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Cb(this),n=e&1;this.diff=Jn(e/2),this.count=1,n&&(this.count=le(this)+2)}return this.s+=this.diff,this.count--,this.s}}class P${constructor(e){this.decoder=new dd(e),this.str=Yi(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const F$=crypto.getRandomValues.bind(crypto),B$=Math.random,P3=()=>F$(new Uint32Array(1))[0],z$=t=>t[Jn(B$()*t.length)],$$="10000000-1000-4000-8000"+-1e11,U$=()=>$$.replace(/[018]/g,t=>(t^P3()&15>>t/4).toString(16)),vu=Date.now,l_=t=>new Promise(t);Promise.all.bind(Promise);const a_=t=>t===void 0?null:t;class H${constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let F3=new H$,V$=!0;try{typeof localStorage<"u"&&localStorage&&(F3=localStorage,V$=!1)}catch{}const W$=F3,xu=Symbol("Equality"),B3=(t,e)=>t===e||!!t?.[xu]?.(e)||!1,K$=t=>typeof t=="object",j$=Object.assign,z3=Object.keys,q$=(t,e)=>{for(const n in t)e(t[n],n)},Bf=t=>z3(t).length,G$=t=>{for(const e in t)return!1;return!0},Dl=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Tb=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Y$=(t,e)=>t===e||Bf(t)===Bf(e)&&Dl(t,(n,r)=>(n!==void 0||Tb(e,r))&&B3(e[r],n)),J$=Object.freeze,$3=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&$3(t[e])}return J$(t)},Nb=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Nb(t,e,n+1)}},Z$=t=>t,Zo=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[xu]!=null)return t[xu](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Zo(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Bf(t)!==Bf(e))return!1;for(const n in t)if(!Tb(t,n)||!Zo(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Zo(t[n],e[n]))return!1;break;default:return!1}return!0},X$=(t,e)=>e.includes(t);var U3={};const vl=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",H3=typeof window<"u"&&typeof document<"u"&&!vl;let hr;const Q$=()=>{if(hr===void 0)if(vl){hr=cn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&hr.set(e,""),e=r):e!==null&&(hr.set(e,r),e=null)}e!==null&&hr.set(e,"")}else typeof location=="object"?(hr=cn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");hr.set(`--${t_(e,"-")}`,n),hr.set(`-${t_(e,"-")}`,n)}})):hr=cn();return hr},am=t=>Q$().has(t),zf=t=>a_(vl?U3[t.toUpperCase().replaceAll("-","_")]:W$.getItem(t)),V3=t=>am("--"+t)||zf(t)!==null,eU=V3("production"),tU=vl&&X$(U3.FORCE_COLOR,["true","1","2"]),nU=tU||!am("--no-colors")&&!V3("no-color")&&(!vl||process.stdout.isTTY)&&(!vl||am("--color")||zf("COLORTERM")!==null||(zf("TERM")||"").includes("color")),rU=t=>new Uint8Array(t),iU=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=R3(t[n]);return btoa(e)},sU=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),oU=H3?iU:sU,lU=t=>{const e=rU(t.byteLength);return e.set(t),e},aU=t=>b$(e=>wl(e,t));class uU{constructor(e,n){this.left=e,this.right=n}}const Br=(t,e)=>new uU(t,e),u_=t=>t.next()>=.5,m0=(t,e,n)=>Jn(t.next()*(n+1-e)+e),W3=(t,e,n)=>Jn(t.next()*(n+1-e)+e),Mb=(t,e,n)=>W3(t,e,n),cU=t=>R3(Mb(t,97,122)),dU=(t,e=0,n=20)=>{const r=Mb(t,e,n);let i="";for(let s=0;s<r;s++)i+=cU(t);return i},b0=(t,e)=>e[Mb(t,0,e.length-1)],fU=Symbol("0schema");class hU{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(m$(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
165
+ `,1;if(Et>1e5&&Et>N.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ee+=I,I.length}const Je=S(A);if(!Je)throw zs(s.replace("{}",A)),new Error('Unknown language: "'+A+'"');const oe=W7(Je);let Tt="",Y=T||oe;const Q={},ye=new l.__emitter(l);dr();let ee="",pe=0,Ze=0,Et=0,Mn=!1;try{if(Je.__emitTokens)Je.__emitTokens(C,ye);else{for(Y.matcher.considerAll();;){Et++,Mn?Mn=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=Ze;const z=Y.matcher.exec(C);if(!z)break;const N=C.substring(Ze,z.index),I=Xt(N,z);Ze=z.index+I}Xt(C.substring(Ze))}return ye.finalize(),Tt=ye.toHTML(),{language:A,value:Tt,relevance:pe,illegal:!1,_emitter:ye,_top:Y}}catch(z){if(z.message&&z.message.includes("Illegal"))return{language:A,value:u0(C),illegal:!0,relevance:0,_illegalBy:{message:z.message,index:Ze,context:C.slice(Ze-100,Ze+100),mode:z.mode,resultSoFar:Tt},_emitter:ye};if(i)return{language:A,value:u0(C),illegal:!1,relevance:0,errorRaised:z,_emitter:ye,_top:Y};throw z}}function f(A){const C={value:u0(A),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return C._emitter.addText(A),C}function h(A,C){C=C||l.languages||Object.keys(e);const v=f(A),T=C.filter(S).filter(L).map(fe=>d(fe,A,!1));T.unshift(v);const D=T.sort((fe,ie)=>{if(fe.relevance!==ie.relevance)return ie.relevance-fe.relevance;if(fe.language&&ie.language){if(S(fe.language).supersetOf===ie.language)return 1;if(S(ie.language).supersetOf===fe.language)return-1}return 0}),[B,V]=D,de=B;return de.secondBest=V,de}function p(A,C,v){const T=C&&n[C]||v;A.classList.add("hljs"),A.classList.add(`language-${T}`)}function g(A){let C=null;const v=u(A);if(a(v))return;if(te("before:highlightElement",{el:A,language:v}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new q7("One of your code blocks includes unescaped HTML.",A.innerHTML);C=A;const T=C.textContent,D=v?c(T,{language:v,ignoreIllegals:!0}):h(T);A.innerHTML=D.value,A.dataset.highlighted="yes",p(A,v,D.language),A.result={language:D.language,re:D.relevance,relevance:D.relevance},D.secondBest&&(A.secondBest={language:D.secondBest.language,relevance:D.secondBest.relevance}),te("after:highlightElement",{el:A,result:D,text:T})}function b(A){l=Lw(l,A)}const m=()=>{y(),ko("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){y(),ko("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function y(){function A(){y()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",A,!1),k=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function _(A,C){let v=null;try{v=C(t)}catch(T){if(zs("Language definition for '{}' could not be registered.".replace("{}",A)),i)zs(T);else throw T;v=o}v.name||(v.name=A),e[A]=v,v.rawDefinition=C.bind(null,t),v.aliases&&O(v.aliases,{languageName:A})}function w(A){delete e[A];for(const C of Object.keys(n))n[C]===A&&delete n[C]}function x(){return Object.keys(e)}function S(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function O(A,{languageName:C}){typeof A=="string"&&(A=[A]),A.forEach(v=>{n[v.toLowerCase()]=C})}function L(A){const C=S(A);return C&&!C.disableAutodetect}function G(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=C=>{A["before:highlightBlock"](Object.assign({block:C.el},C))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=C=>{A["after:highlightBlock"](Object.assign({block:C.el},C))})}function U(A){G(A),r.push(A)}function j(A){const C=r.indexOf(A);C!==-1&&r.splice(C,1)}function te(A,C){const v=A;r.forEach(function(T){T[v]&&T[v](C)})}function Z(A){return ko("10.7.0","highlightBlock will be removed entirely in v12.0"),ko("10.7.0","Please use highlightElement now."),g(A)}Object.assign(t,{highlight:c,highlightAuto:h,highlightAll:y,highlightElement:g,highlightBlock:Z,configure:b,initHighlighting:m,initHighlightingOnLoad:E,registerLanguage:_,unregisterLanguage:w,listLanguages:x,getLanguage:S,registerAliases:O,autoDetection:L,inherit:Lw,addPlugin:U,removePlugin:j}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=j7,t.regex={concat:uo,lookahead:f3,either:yb,optional:a7,anyNumberOfTimes:l7};for(const A in Fc)typeof Fc[A]=="object"&&c3(Fc[A]);return Object.assign(t,Fc),t},yl=w3({});yl.newInstance=()=>w3({});var Y7=yl;yl.HighlightJS=yl;yl.default=yl;const J7=A_(Y7),Fw={},Z7="hljs-";function SW(t){const e=J7.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:l};function n(a,u,c){const d=c||Fw,f=typeof d.prefix=="string"?d.prefix:Z7;if(!e.getLanguage(a))throw new Error("Unknown language: `"+a+"` is not registered");e.configure({__emitter:X7,classPrefix:f});const h=e.highlight(u,{ignoreIllegals:!0,language:a});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const p=h._emitter.root,g=p.data;return g.language=h.language,g.relevance=h.relevance,p}function r(a,u){const d=(u||Fw).subset||i();let f=-1,h=0,p;for(;++f<d.length;){const g=d[f];if(!e.getLanguage(g))continue;const b=n(g,a,u);b.data&&b.data.relevance!==void 0&&b.data.relevance>h&&(h=b.data.relevance,p=b)}return p||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return e.listLanguages()}function s(a,u){if(typeof a=="string")e.registerLanguage(a,u);else{let c;for(c in a)Object.hasOwn(a,c)&&e.registerLanguage(c,a[c])}}function o(a,u){if(typeof a=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:a});else{let c;for(c in a)if(Object.hasOwn(a,c)){const d=a[c];e.registerAliases(typeof d=="string"?d:[...d],{languageName:c})}}}function l(a){return!!e.getLanguage(a)}}class X7{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}let Xg,Qg;if(typeof WeakMap<"u"){let t=new WeakMap;Xg=e=>t.get(e),Qg=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Xg=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Qg=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ve=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(t){return Xg(t)||Qg(t,Q7(t))}};function Q7(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=ez(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=t.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:b,rowspan:m,colwidth:E}=g.attrs;for(let k=0;k<m;k++){if(k+u>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:m-k});break}const y=i+k*e;for(let _=0;_<b;_++){r[y+_]==0?r[y+_]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:b-_});const w=E&&E[_];if(w){const x=(y+_)%e*2,S=o[x];S==null||S!=w&&o[x+1]==1?(o[x]=w,o[x+1]=1):S==w&&o[x+1]++}}}i+=b,c+=g.nodeSize}const f=(u+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Ve(e,n,r,s);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(a=!0);return a&&tz(l,o,t),l}function ez(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function tz(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const c=e[(i+u)%t.width*2];c!=null&&(!a.colwidth||a.colwidth[u]!=c)&&((l||(l=nz(a)))[u]=c)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function nz(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Pt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Si=new Le("selectingCells");function to(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function rz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function cr(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Dh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=to(e.$head)||iz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function iz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function em(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function sz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function wb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function _3(t,e,n){const r=t.node(-1),i=Ve.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function no(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function v3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function oz(t,e,n){const r=Pt(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Oe=class $r extends ne{constructor(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(c=>c!=n.pos-s);a.unshift(n.pos-s);const u=a.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new o2(l.resolve(f),l.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(em(r)&&em(i)&&wb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?$r.rowSelection(r,i):s&&this.isColSelection()?$r.colSelection(r,i):new $r(r,i)}return X.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ve.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const u=[];for(let c=a*n.width+i.left,d=i.left;d<i.right;d++,c++){const f=n.map[c];if(s[f])continue;s[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,b=h.right-i.right;if(g>0||b>0){let m=p.attrs;if(g>0&&(m=no(m,0,g)),b>0&&(m=no(m,m.colspan-b,b)),h.left<i.left){if(p=p.type.createAndFill(m),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(m)}`)}else p=p.type.create(m,p.content)}if(h.top<i.top||h.bottom>i.bottom){const m={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(m):p=p.type.create(m,p.content)}u.push(p)}o.push(e.child(a).copy(R.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new $(R.from(l),1,1)}replace(e,n=$.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(a.pos),o?$.empty:n)}const s=ne.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new $(R.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ve.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new $r(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ve.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof $r&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ve.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new $r(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new $r(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new $r(e.resolve(n),e.resolve(r))}getBookmark(){return new lz(this.$anchorCell.pos,this.$headCell.pos)}};Oe.prototype.visible=!1;ne.jsonID("cell",Oe);var lz=class x3{constructor(e,n){this.anchor=e,this.head=n}map(e){return new x3(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&wb(n,r)?new Oe(n,r):ne.near(r,1)}};function az(t){if(!(t.selection instanceof Oe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ot.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Te.create(t.doc,e)}function uz({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function cz({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function dz(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof J&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Oe.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=Oe.rowSelection(l,l)}else if(!n){const l=Ve.get(r.node),a=r.from+1,u=a+l.map[l.width*l.height-1];s=Oe.create(i,a+1,u)}}else r instanceof X&&uz(r)?s=X.create(i,r.from):r instanceof X&&cz(r)&&(s=X.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const fz=new Le("fix-tables");function S3(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let u=l,c=Math.min(i,o+3);u<c;u++)if(t.child(u)==a){l=u+1,n+=a.nodeSize;continue e}r(a,n),l<i&&t.child(l).sameMarkup(a)?S3(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function C3(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=hz(t,i,s,n))};return e?e.doc!=t.doc&&S3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function hz(t,e,n,r){const i=Ve.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const u=i.problems[a];if(u.type=="collision"){const c=e.nodeAt(u.pos);if(!c)continue;const d=c.attrs;for(let f=0;f<d.rowspan;f++)s[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,no(d,d.colspan-u.n,u.n))}else if(u.type=="missing")s[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,u=n+1;a<i.height;a++){const c=e.child(a),d=u+c.nodeSize,f=s[a];if(f>0){let h="cell";c.firstChild&&(h=c.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const m=Pt(t.schema)[h].createAndFill();m&&p.push(m)}const g=(a==0||o==a-1)&&l==a?u+1:d-1;r.insert(r.mapping.map(g),p)}u=d}return r.setMeta(fz,{fixTables:!0})}function Rr(t){const e=t.selection,n=Dh(t),r=n.node(-1),i=n.start(-1),s=Ve.get(r);return{...e instanceof Oe?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function A3(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;oz(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,v3(u.attrs,i-e.colCount(a))),o+=u.attrs.rowspan-1}else{const a=s==null?Pt(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,u=e.positionAt(o,i,r);t.insert(t.mapping.map(n+u),a.createAndFill())}}return t}function pz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(A3(t.tr,n,n.left))}return!0}function gz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(A3(t.tr,n,n.right))}return!0}function mz(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,a=e.map[l],u=n.nodeAt(a),c=u.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(s).map(r+a),null,no(c,i-e.colCount(a)));else{const d=t.mapping.slice(s).map(r+a);t.delete(d,d+u.nodeSize)}o+=c.rowspan}}function bz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;mz(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ve.get(s)}e(r)}return!0}function yz(t,e,n){var r;const i=Pt(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function T3(t,{map:e,tableStart:n,table:r},i){let s=n;for(let u=0;u<i;u++)s+=r.child(u).nodeSize;const o=[];let l=i>0?-1:0;yz(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let u=0,c=e.width*i;u<e.width;u++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{var a;const d=l==null?Pt(r.type.schema).cell:(a=r.nodeAt(e.map[c+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&o.push(f)}return t.insert(s,Pt(r.type.schema).row.create(null,o)),t}function Ez(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(T3(t.tr,n,n.top))}return!0}function kz(t,e){if(!cr(t))return!1;if(e){const n=Rr(t);e(T3(t.tr,n,n.bottom))}return!0}function wz(t,{map:e,table:n,tableStart:r},i){let s=0;for(let u=0;u<i;u++)s+=n.child(u).nodeSize;const o=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,o+r);const a=new Set;for(let u=0,c=i*e.width;u<e.width;u++,c++){const d=e.map[c];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[c-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,u,n);t.insert(t.mapping.slice(l).map(r+g),p),u+=h.colspan-1}}}}function _z(t,e){if(!cr(t))return!1;if(e){const n=Rr(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;wz(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ve.get(n.table)}e(r)}return!0}function Bw(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function vz({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function zw(t,e){const n=t.selection;if(!(n instanceof Oe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Rr(t),{map:i}=r;if(vz(i,r))return!1;if(e){const s=t.tr,o={};let l=R.empty,a,u;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const f=i.map[c*i.width+d],h=r.table.nodeAt(f);if(!(o[f]||!h))if(o[f]=!0,a==null)a=f,u=h;else{Bw(h)||(l=l.append(h.content));const p=s.mapping.map(f+r.tableStart);s.delete(p,p+h.nodeSize)}}if(a==null||u==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...v3(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const c=a+1+u.content.size,d=Bw(u)?a+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,l)}s.setSelection(new Oe(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function $w(t,e){const n=Pt(t.schema);return xz(({node:r})=>n[r.type.spec.tableRole])(t,e)}function xz(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Oe){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=rz(r.$from),!i)return!1;s=(o=to(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const c=Rr(e),d=e.tr;for(let h=0;h<c.right-c.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let f;for(let h=c.top;h<c.bottom;h++){let p=c.map.positionAt(h,c.left,c.table);h==c.top&&(p+=i.nodeSize);for(let g=c.left,b=0;g<c.right;g++,b++)g==c.left&&h==c.top||d.insert(f=d.mapping.map(p+c.tableStart,1),t({node:i,row:h,col:g}).createAndFill(a[b]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),a[0]),r instanceof Oe&&d.setSelection(new Oe(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function Sz(t,e){return function(n,r){if(!cr(n))return!1;const i=Dh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Oe?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Cz(t){return function(e,n){if(!cr(e))return!1;if(n){const r=Pt(e.schema),i=Rr(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length===0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);n(s)}return!0}}function Uw(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Eu(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Cz(t):function(n,r){if(!cr(n))return!1;if(r){const i=Pt(n.schema),s=Rr(n),o=n.tr,l=Uw("row",s,i),a=Uw("column",s,i),u=(t==="column"?l:t==="row"&&a)?1:0,c=t=="column"?{left:0,top:u,right:1,bottom:s.map.height}:t=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?a?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}Eu("row",{useDeprecatedLogic:!0});Eu("column",{useDeprecatedLogic:!0});const Az=Eu("cell",{useDeprecatedLogic:!0});function Tz(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Hw(t){return function(e,n){if(!cr(e))return!1;const r=Tz(Dh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(X.between(i,sz(i))).scrollIntoView())}return!0}}function Nz(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Bc(t,e){const n=t.selection;if(!(n instanceof Oe))return!1;if(e){const r=t.tr,i=Pt(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new $(i,0,0))}),r.docChanged&&e(r)}return!0}function Mz(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const c=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(u=tm(Pt(o).row,new $(u,c,d)).content),l.push(u)}else if(s=="cell"||s=="header_cell")l.push(n||r?tm(Pt(o).row,new $(e,n,r)).content:e);else return null;return Oz(o,l)}function Oz(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let u=i;u<i+l;u++)n[u]=(n[u]||0)+a}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(R.empty),n[i]<r){const s=Pt(t).cell.createAndFill(),o=[];for(let l=n[i];l<r;l++)o.push(s);e[i]=e[i].append(R.from(o))}return{height:e.length,width:r,rows:e}}function tm(t,e){const n=t.createAndFill();return new h1(n).replace(0,n.content.size,e).doc}function Dz({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let l=0;l<n.length;l++){const a=n[l],u=[];for(let c=s[l]||0,d=0;c<r;d++){let f=a.child(d%a.childCount);c+f.attrs.colspan>r&&(f=f.type.createChecked(no(f.attrs,f.attrs.colspan,c+f.attrs.colspan-r),f.content)),u.push(f),c+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)s[l+h]=(s[l+h]||0)+f.attrs.colspan}o.push(R.from(u))}n=o,t=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const a=[],u=n[l%e];for(let c=0;c<u.childCount;c++){let d=u.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(R.from(a))}n=s,e=i}return{width:t,height:e,rows:n}}function Rz(t,e,n,r,i,s,o){const l=t.doc.type.schema,a=Pt(l);let u,c;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=c||(c=a.header_cell.createAndFill());for(let b=e.width;b<i;b++)p.push(g);t.insert(t.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const b=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==a.header_cell;d.push(b?c||(c=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const f=a.row.create(null,R.from(d)),h=[];for(let p=e.height;p<s;p++)h.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(u||c)}function Vw(t,e,n,r,i,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let u=i;u<s;u++){const c=o*e.width+u,d=e.map[c];if(e.map[c-e.width]==d){a=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:o-h}),t.insert(t.mapping.slice(l).map(e.positionAt(o,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-o})),u+=f.attrs.colspan-1}}return a}function Ww(t,e,n,r,i,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let u=i;u<s;u++){const c=u*e.width+o,d=e.map[c];if(e.map[c-1]==d){a=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,no(f.attrs,o-h,f.attrs.colspan-(o-h))),t.insert(p+f.nodeSize,f.type.createAndFill(no(f.attrs,0,o-h))),u+=f.attrs.rowspan-1}}return a}function Kw(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Ve.get(s);const{top:l,left:a}=r,u=a+i.width,c=l+i.height,d=t.tr;let f=0;function h(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Ve.get(s),f=d.mapping.maps.length}Rz(d,o,s,n,u,c,f)&&h(),Vw(d,o,s,n,a,u,l,f)&&h(),Vw(d,o,s,n,a,u,c,f)&&h(),Ww(d,o,s,n,l,c,a,f)&&h(),Ww(d,o,s,n,l,c,u,f)&&h();for(let p=l;p<c;p++){const g=o.positionAt(p,a,s),b=o.positionAt(p,u,s);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new $(i.rows[p-l],0,0))}h(),d.setSelection(new Oe(d.doc.resolve(n+o.positionAt(l,a,s)),d.doc.resolve(n+o.positionAt(c-1,u-1,s)))),e(d)}const Iz=C1({ArrowLeft:zc("horiz",-1),ArrowRight:zc("horiz",1),ArrowUp:zc("vert",-1),ArrowDown:zc("vert",1),"Shift-ArrowLeft":$c("horiz",-1),"Shift-ArrowRight":$c("horiz",1),"Shift-ArrowUp":$c("vert",-1),"Shift-ArrowDown":$c("vert",1),Backspace:Bc,"Mod-Backspace":Bc,Delete:Bc,"Mod-Delete":Bc});function ld(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function zc(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Oe)return ld(n,r,ne.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=N3(i,t,e);if(o==null)return!1;if(t=="horiz")return ld(n,r,ne.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(o),a=_3(l,t,e);let u;return a?u=ne.near(a,1):e<0?u=ne.near(n.doc.resolve(l.before(-1)),-1):u=ne.near(n.doc.resolve(l.after(-1)),1),ld(n,r,u)}}}function $c(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Oe)o=s;else{const a=N3(i,t,e);if(a==null)return!1;o=new Oe(n.doc.resolve(a))}const l=_3(o.$headCell,t,e);return l?ld(n,r,new Oe(o.$anchorCell,l)):!1}}function Lz(t,e){const n=t.state.doc,r=to(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Oe(r))),!0):!1}function Pz(t,e,n){if(!cr(t.state))return!1;let r=Mz(n);const i=t.state.selection;if(i instanceof Oe){r||(r={width:1,height:1,rows:[R.from(tm(Pt(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=Ve.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Dz(r,l.right-l.left,l.bottom-l.top),Kw(t.state,t.dispatch,o,l,r),!0}else if(r){const s=Dh(t.state),o=s.start(-1);return Kw(t.state,t.dispatch,o,Ve.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Fz(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=jw(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Oe)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=to(t.state.selection.$anchor))!=null&&((n=c0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,u){let c=c0(t,u);const d=Si.getState(t.state)==null;if(!c||!wb(a,c))if(d)c=a;else return;const f=new Oe(a,c);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(Si,a.pos),t.dispatch(h)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),Si.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Si,-1))}function l(a){const u=a,c=Si.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(jw(t,u.target)!=r&&(d=c0(t,e),!d))return o();d&&s(d,u)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function N3(t,e,n){if(!(t.state.selection instanceof X))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function jw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function c0(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&to(t.state.doc.resolve(r))||to(t.state.doc.resolve(i))}var Bz=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),nm(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,nm(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function nm(t,e,n,r,i,s){let o=0,l=!0,a=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let g=0;g<h;g++,f++){const b=i==f?s:p&&p[g],m=b?b+"px":"";if(o+=b||r,b||(l=!1),a)a.style.width!=m&&(a.style.width=m),a=a.nextSibling;else{const E=document.createElement("col");E.style.width=m,e.appendChild(E)}}}for(;a;){var c;const d=a.nextSibling;(c=a.parentNode)===null||c===void 0||c.removeChild(a),a=d}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const yn=new Le("tableColumnResizing");function zz({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Bz,lastColumnResizable:i=!0}={}){const s=new Ae({key:yn,state:{init(o,l){var a;const u=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,c=Pt(l.schema).table.name;return r&&u&&(u[c]=(d,f)=>new r(d,n,f)),new $z(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=yn.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Uz(o,l,t,i)},mouseleave:o=>{Hz(o)},mousedown:(o,l)=>{Vz(o,l,e,n)}},decorations:o=>{const l=yn.getState(o);if(l&&l.activeHandle>-1)return Gz(o,l.activeHandle)},nodeViews:{}}});return s}var $z=class ad{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(yn);if(r&&r.setHandle!=null)return new ad(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ad(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return em(e.doc.resolve(i))||(i=-1),new ad(i,n.dragging)}return n}};function Uz(t,e,n,r){if(!t.editable)return;const i=yn.getState(t.state);if(i&&!i.dragging){const s=Kz(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?o=qw(t,e,"left",n):a-e.clientX<=n&&(o=qw(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),a=l.node(-1),u=Ve.get(a),c=l.start(-1);if(u.colCount(l.pos-c)+l.nodeAfter.attrs.colspan-1==u.width-1)return}M3(t,o)}}}function Hz(t){if(!t.editable)return;const e=yn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&M3(t,-1)}function Vz(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=yn.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),a=Wz(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(yn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(d){s.removeEventListener("mouseup",u),s.removeEventListener("mousemove",c);const f=yn.getState(t.state);f?.dragging&&(jz(t,f.activeHandle,Gw(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(yn,{setDragging:null})))}function c(d){if(!d.which)return u(d);const f=yn.getState(t.state);if(f&&f.dragging){const h=Gw(f.dragging,d,n);Yw(t,f.activeHandle,h,r)}}return Yw(t,o.activeHandle,a,r),s.addEventListener("mouseup",u),s.addEventListener("mousemove",c),e.preventDefault(),!0}function Wz(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(o-=r[a],l--);return o/l}function Kz(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function qw(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=to(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const a=Ve.get(l.node(-1)),u=l.start(-1),c=a.map.indexOf(l.pos-u);return c%a.width==0?-1:u+a.map[c-1]}function Gw(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function M3(t,e){t.dispatch(t.state.tr.setMeta(yn,{setHandle:e}))}function jz(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ve.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let u=0;u<s.height;u++){const c=u*s.width+l;if(u&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-s.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():qz(f.colspan);p[h]=n,a.setNodeMarkup(o+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function Yw(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=Ve.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let a=t.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&nm(s,a.firstChild,a,r,l,n)}function qz(t){return Array(t).fill(0)}function Gz(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Te.empty;const s=Ve.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<s.height;u++){const c=l+u*s.width;if((l==s.width-1||s.map[c]!=s.map[c+1])&&(u==0||s.map[c]!=s.map[c-s.width])){var a;const d=s.map[c],f=o+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=yn.getState(t))===null||a===void 0)&&a.dragging&&n.push(ot.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ot.widget(f,h))}}return Te.create(t.doc,n)}function Yz({allowTableNodeSelection:t=!1}={}){return new Ae({key:Si,state:{init(){return null},apply(e,n){const r=e.getMeta(Si);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:az,handleDOMEvents:{mousedown:Fz},createSelectionBetween(e){return Si.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Lz,handleKeyDown:Iz,handlePaste:Pz},appendTransaction(e,n,r){return dz(r,C3(r,n),t)}})}function rm(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Jw(t,e,n,r,i,s){var o;let l=0,a=!0,u=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,f=0;d<c.childCount;d+=1){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const b=i===f?s:p&&p[g],m=b?`${b}px`:"";if(l+=b||r,b||(a=!1),u){if(u.style.width!==m){const[E,k]=rm(r,b);u.style.setProperty(E,k)}u=u.nextSibling}else{const E=document.createElement("col"),[k,y]=rm(r,b);E.style.setProperty(k,y),e.appendChild(E)}}}for(;u;){const d=u.nextSibling;(o=u.parentNode)===null||o===void 0||o.removeChild(u),u=d}a?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class Jz{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jw(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Jw(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function Zz(t,e,n,r){let i=0,s=!0;const o=[],l=t.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const b=n===f?r:p&&p[g];i+=b||e,b||(s=!1);const[m,E]=rm(e,b);o.push(["col",{style:`${m}: ${E}`}])}}const a=s?`${i}px`:"",u=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:a,tableMinWidth:u}}function Zw(t,e){return t.createAndFill()}function Xz(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function Qz(t,e,n,r,i){const s=Xz(t),o=[],l=[];for(let u=0;u<n;u+=1){const c=Zw(s.cell);if(c&&l.push(c),r){const d=Zw(s.header_cell);d&&o.push(d)}}const a=[];for(let u=0;u<e;u+=1)a.push(s.row.createChecked(null,r&&u===0?o:l));return s.table.createChecked(null,a)}function e$(t){return t instanceof Oe}const Uc=({editor:t})=>{const{selection:e}=t.state;if(!e$(e))return!1;let n=0;const r=dS(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},AW=Ke.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Jz,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=Zz(t,this.options.cellMinWidth),s=["table",Ce(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=Qz(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(X.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>pz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>gz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>bz(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Ez(t,e),addRowAfter:()=>({state:t,dispatch:e})=>kz(t,e),deleteRow:()=>({state:t,dispatch:e})=>_z(t,e),deleteTable:()=>({state:t,dispatch:e})=>Nz(t,e),mergeCells:()=>({state:t,dispatch:e})=>zw(t,e),splitCell:()=>({state:t,dispatch:e})=>$w(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Eu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Eu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Az(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>zw(t,e)?!0:$w(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Sz(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Hw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Hw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&C3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Oe.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Uc,"Mod-Backspace":Uc,Delete:Uc,"Mod-Delete":Uc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[zz({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Yz({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ae(K(t,"tableRole",e))}}}),TW=Ke.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ce(this.options.HTMLAttributes,t),0]}}),NW=Ke.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ce(this.options.HTMLAttributes,t),0]}}),MW=Ke.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ce(this.options.HTMLAttributes,t),0]}}),cn=()=>new Map,im=t=>{const e=cn();return t.forEach((n,r)=>{e.set(r,n)}),e},Ir=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},t$=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},n$=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},ts=()=>new Set,d0=t=>t[t.length-1],r$=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},ii=Array.from,_b=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},vb=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},i$=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},El=Array.isArray;class O3{constructor(){this._observers=cn()}on(e,n){return Ir(this._observers,e,ts).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return ii((this._observers.get(e)||cn()).values()).forEach(r=>r(...n))}destroy(){this._observers=cn()}}class s${constructor(){this._observers=cn()}on(e,n){Ir(this._observers,e,ts).add(n)}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return ii((this._observers.get(e)||cn()).values()).forEach(r=>r(...n))}destroy(){this._observers=cn()}}const Jn=Math.floor,ud=Math.abs,kl=(t,e)=>t<e?t:e,si=(t,e)=>t>e?t:e,D3=t=>t!==0?t<0:1/t<0,Xw=1,Qw=2,f0=4,h0=8,ku=32,Zr=64,Wt=128,o$=1<<29,Rh=31,sm=63,$s=127,l$=2147483647,Ff=Number.MAX_SAFE_INTEGER,e_=Number.MIN_SAFE_INTEGER,a$=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Jn(t)===t),R3=String.fromCharCode,u$=t=>t.toLowerCase(),c$=/^\s*/g,d$=t=>t.replace(c$,""),f$=/([A-Z])/g,t_=(t,e)=>d$(t.replace(f$,n=>`${e}${u$(n)}`)),h$=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},wu=typeof TextEncoder<"u"?new TextEncoder:null,p$=t=>wu.encode(t),g$=wu?p$:h$;let Da=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Da&&Da.decode(new Uint8Array).length===1&&(Da=null);const m$=(t,e)=>i$(e,()=>t).join("");class Gu{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const co=()=>new Gu,b$=t=>{const e=co();return t(e),_n(e)},y$=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},_n=t=>{const e=new Uint8Array(y$(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},E$=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(si(n,e)*2),t.cpos=0)},ct=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},om=ct,ue=(t,e)=>{for(;e>$s;)ct(t,Wt|$s&e),e=Jn(e/128);ct(t,$s&e)},xb=(t,e)=>{const n=D3(e);for(n&&(e=-e),ct(t,(e>sm?Wt:0)|(n?Zr:0)|sm&e),e=Jn(e/64);e>0;)ct(t,(e>$s?Wt:0)|$s&e),e=Jn(e/128)},lm=new Uint8Array(3e4),k$=lm.length/3,w$=(t,e)=>{if(e.length<k$){const n=wu.encodeInto(e,lm).written||0;ue(t,n);for(let r=0;r<n;r++)ct(t,lm[r])}else pn(t,g$(e))},_$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;ue(t,r);for(let i=0;i<r;i++)ct(t,n.codePointAt(i))},Gi=wu&&wu.encodeInto?w$:_$,Ih=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=kl(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(si(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},pn=(t,e)=>{ue(t,e.byteLength),Ih(t,e)},Sb=(t,e)=>{E$(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},v$=(t,e)=>Sb(t,4).setFloat32(0,e,!1),x$=(t,e)=>Sb(t,8).setFloat64(0,e,!1),S$=(t,e)=>Sb(t,8).setBigInt64(0,e,!1),n_=new DataView(new ArrayBuffer(4)),C$=t=>(n_.setFloat32(0,t),n_.getFloat32(0)===t),wl=(t,e)=>{switch(typeof e){case"string":ct(t,119),Gi(t,e);break;case"number":a$(e)&&ud(e)<=l$?(ct(t,125),xb(t,e)):C$(e)?(ct(t,124),v$(t,e)):(ct(t,123),x$(t,e));break;case"bigint":ct(t,122),S$(t,e);break;case"object":if(e===null)ct(t,126);else if(El(e)){ct(t,117),ue(t,e.length);for(let n=0;n<e.length;n++)wl(t,e[n])}else if(e instanceof Uint8Array)ct(t,116),pn(t,e);else{ct(t,118);const n=Object.keys(e);ue(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Gi(t,i),wl(t,e[i])}}break;case"boolean":ct(t,e?120:121);break;default:ct(t,127)}};class r_ extends Gu{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ue(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const i_=t=>{t.count>0&&(xb(t.encoder,t.count===1?t.s:-t.s),t.count>1&&ue(t.encoder,t.count-2))};class cd{constructor(){this.encoder=new Gu,this.s=0,this.count=0}write(e){this.s===e?this.count++:(i_(this),this.count=1,this.s=e)}toUint8Array(){return i_(this),_n(this.encoder)}}const s_=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);xb(t.encoder,e),t.count>1&&ue(t.encoder,t.count-2)}};class p0{constructor(){this.encoder=new Gu,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(s_(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return s_(this),_n(this.encoder)}}class A${constructor(){this.sarr=[],this.s="",this.lensE=new cd}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Gu;return this.sarr.push(this.s),this.s="",Gi(e,this.sarr.join("")),Ih(e,this.lensE.toUint8Array()),_n(e)}}const Mr=t=>new Error(t),Vn=()=>{throw Mr("Method unimplemented")},Ft=()=>{throw Mr("Unexpected case")},I3=Mr("Unexpected end of array"),L3=Mr("Integer out of Range");class Lh{constructor(e){this.arr=e,this.pos=0}}const hs=t=>new Lh(t),T$=t=>t.pos!==t.arr.length,N$=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},gn=t=>N$(t,le(t)),_l=t=>t.arr[t.pos++],le=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&$s)*n,n*=128,i<Wt)return e;if(e>Ff)throw L3}throw I3},Cb=t=>{let e=t.arr[t.pos++],n=e&sm,r=64;const i=(e&Zr)>0?-1:1;if(!(e&Wt))return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&$s)*r,r*=128,e<Wt)return i*n;if(n>Ff)throw L3}throw I3},M$=t=>{let e=le(t);if(e===0)return"";{let n=String.fromCodePoint(_l(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(_l(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},O$=t=>Da.decode(gn(t)),Yi=Da?O$:M$,Ab=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},D$=t=>Ab(t,4).getFloat32(0,!1),R$=t=>Ab(t,8).getFloat64(0,!1),I$=t=>Ab(t,8).getBigInt64(0,!1),L$=[t=>{},t=>null,Cb,D$,R$,I$,t=>!1,t=>!0,Yi,t=>{const e=le(t),n={};for(let r=0;r<e;r++){const i=Yi(t);n[i]=_u(t)}return n},t=>{const e=le(t),n=[];for(let r=0;r<e;r++)n.push(_u(t));return n},gn],_u=t=>L$[127-_l(t)](t);class o_ extends Lh{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),T$(this)?this.count=le(this)+1:this.count=-1),this.count--,this.s}}class dd extends Lh{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Cb(this);const e=D3(this.s);this.count=1,e&&(this.s=-this.s,this.count=le(this)+2)}return this.count--,this.s}}class g0 extends Lh{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Cb(this),n=e&1;this.diff=Jn(e/2),this.count=1,n&&(this.count=le(this)+2)}return this.s+=this.diff,this.count--,this.s}}class P${constructor(e){this.decoder=new dd(e),this.str=Yi(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const F$=crypto.getRandomValues.bind(crypto),B$=Math.random,P3=()=>F$(new Uint32Array(1))[0],z$=t=>t[Jn(B$()*t.length)],$$="10000000-1000-4000-8000"+-1e11,U$=()=>$$.replace(/[018]/g,t=>(t^P3()&15>>t/4).toString(16)),vu=Date.now,l_=t=>new Promise(t);Promise.all.bind(Promise);const a_=t=>t===void 0?null:t;class H${constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let F3=new H$,V$=!0;try{typeof localStorage<"u"&&localStorage&&(F3=localStorage,V$=!1)}catch{}const W$=F3,xu=Symbol("Equality"),B3=(t,e)=>t===e||!!t?.[xu]?.(e)||!1,K$=t=>typeof t=="object",j$=Object.assign,z3=Object.keys,q$=(t,e)=>{for(const n in t)e(t[n],n)},Bf=t=>z3(t).length,G$=t=>{for(const e in t)return!1;return!0},Dl=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Tb=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Y$=(t,e)=>t===e||Bf(t)===Bf(e)&&Dl(t,(n,r)=>(n!==void 0||Tb(e,r))&&B3(e[r],n)),J$=Object.freeze,$3=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&$3(t[e])}return J$(t)},Nb=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Nb(t,e,n+1)}},Z$=t=>t,Zo=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[xu]!=null)return t[xu](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Zo(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Bf(t)!==Bf(e))return!1;for(const n in t)if(!Tb(t,n)||!Zo(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Zo(t[n],e[n]))return!1;break;default:return!1}return!0},X$=(t,e)=>e.includes(t);var U3={NODE_ENV:"production",NEXT_PUBLIC_API_URL:"",NEXT_PUBLIC_ENABLE_COPILOT_FILES:"",NEXT_PUBLIC_CLI_ATTACH_ADDON:"",NEXT_PUBLIC_WS_URL:"",NEXT_PUBLIC_APP_VERSION:"",NEXT_PUBLIC_COMMIT_HASH:"",NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA:"",NEXT_PUBLIC_GIT_COMMIT_SHA:"",NEXT_PUBLIC_GIT_SHA:""};const vl=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",H3=typeof window<"u"&&typeof document<"u"&&!vl;let hr;const Q$=()=>{if(hr===void 0)if(vl){hr=cn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&hr.set(e,""),e=r):e!==null&&(hr.set(e,r),e=null)}e!==null&&hr.set(e,"")}else typeof location=="object"?(hr=cn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");hr.set(`--${t_(e,"-")}`,n),hr.set(`-${t_(e,"-")}`,n)}})):hr=cn();return hr},am=t=>Q$().has(t),zf=t=>a_(vl?U3[t.toUpperCase().replaceAll("-","_")]:W$.getItem(t)),V3=t=>am("--"+t)||zf(t)!==null,eU=V3("production"),tU=vl&&X$(U3.FORCE_COLOR,["true","1","2"]),nU=tU||!am("--no-colors")&&!V3("no-color")&&(!vl||process.stdout.isTTY)&&(!vl||am("--color")||zf("COLORTERM")!==null||(zf("TERM")||"").includes("color")),rU=t=>new Uint8Array(t),iU=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=R3(t[n]);return btoa(e)},sU=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),oU=H3?iU:sU,lU=t=>{const e=rU(t.byteLength);return e.set(t),e},aU=t=>b$(e=>wl(e,t));class uU{constructor(e,n){this.left=e,this.right=n}}const Br=(t,e)=>new uU(t,e),u_=t=>t.next()>=.5,m0=(t,e,n)=>Jn(t.next()*(n+1-e)+e),W3=(t,e,n)=>Jn(t.next()*(n+1-e)+e),Mb=(t,e,n)=>W3(t,e,n),cU=t=>R3(Mb(t,97,122)),dU=(t,e=0,n=20)=>{const r=Mb(t,e,n);let i="";for(let s=0;s<r;s++)i+=cU(t);return i},b0=(t,e)=>e[Mb(t,0,e.length-1)],fU=Symbol("0schema");class hU{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(m$(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
166
166
  `)}}const um=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[xu]?B3(t,e):El(t)?_b(t,n=>vb(e,r=>um(n,r))):K$(t)?Dl(t,(n,r)=>um(n,e[r])):!1;class Yt{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),um(n,r)}equals(e){return this.constructor===e.constructor&&Zo(this.shape,e.shape)}[fU](){return!0}[xu](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Vn()}get nullable(){return Rl(this,$h)}get optional(){return new q3(this)}cast(e){return c_(e,this),e}expect(e){return c_(e,this),e}}class Ob extends Yt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const tt=(t,e=null)=>new Ob(t,e);tt(Ob);class Db extends Yt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const yt=t=>new Db(t);tt(Db);class Ph extends Yt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const Fh=(...t)=>new Ph(t),K3=tt(Ph),pU=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),j3=t=>{if(xl.check(t))return[pU(t)];if(K3.check(t))return t.shape.map(e=>e+"");if(nA.check(t))return["[+-]?\\d+.?\\d*"];if(rA.check(t))return[".*"];if($f.check(t))return t.shape.map(j3).flat(1);Ft()};class gU extends Yt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(j3).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}tt(gU);const mU=Symbol("optional");class q3 extends Yt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[mU](){return!0}}const bU=tt(q3);class yU extends Yt{check(e,n){return n?.extend(null,"never",typeof e),!1}}tt(yU);class Bh extends Yt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Bh(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Dl(this.shape,(r,i)=>{const s=this._isPartial&&!Tb(e,i)||r.check(e[i],n);return!s&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const EU=t=>new Bh(t),kU=tt(Bh),wU=yt(t=>t!=null&&(t.constructor===Object||t.constructor==null));class G3 extends Yt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Dl(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&n?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,n)})}}const Y3=(t,e)=>new G3(t,e),_U=tt(G3);class J3 extends Yt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Dl(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&n?.extend(i.toString(),"Tuple",typeof r),s})}}const vU=(...t)=>new J3(t);tt(J3);class Z3 extends Yt{constructor(e){super(),this.shape=e.length===1?e[0]:new Rb(e)}check(e,n){const r=El(e)&&_b(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const X3=(...t)=>new Z3(t),xU=tt(Z3),SU=yt(t=>El(t));class Q3 extends Yt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const CU=(t,e=null)=>new Q3(t,e);tt(Q3);const AU=CU(Yt);class TU extends Yt{constructor(e){super(),this.len=e.length-1,this.args=vU(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const NU=tt(TU),MU=yt(t=>typeof t=="function");class OU extends Yt{constructor(e){super(),this.shape=e}check(e,n){const r=_b(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}tt(OU,t=>t.shape.length>0);class Rb extends Yt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=vb(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const Rl=(...t)=>t.findIndex(e=>$f.check(e))>=0?Rl(...t.map(e=>Su(e)).map(e=>$f.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Rb(t),$f=tt(Rb),eA=()=>!0,Uf=yt(eA),DU=tt(Db,t=>t.shape===eA),Ib=yt(t=>typeof t=="bigint"),RU=yt(t=>t===Ib),tA=yt(t=>typeof t=="symbol");yt(t=>t===tA);const Xo=yt(t=>typeof t=="number"),nA=yt(t=>t===Xo),xl=yt(t=>typeof t=="string"),rA=yt(t=>t===xl),zh=yt(t=>typeof t=="boolean"),IU=yt(t=>t===zh),iA=Fh(void 0);tt(Ph,t=>t.shape.length===1&&t.shape[0]===void 0);Fh(void 0);const $h=Fh(null),LU=tt(Ph,t=>t.shape.length===1&&t.shape[0]===null);tt(Uint8Array);tt(Ob,t=>t.shape===Uint8Array);const PU=Rl(Xo,xl,$h,iA,Ib,zh,tA);(()=>{const t=X3(Uf),e=Y3(xl,Uf),n=Rl(Xo,xl,$h,zh,t,e);return t.shape=n,e.shape.values=n,n})();const Su=t=>{if(AU.check(t))return t;if(wU.check(t)){const e={};for(const n in t)e[n]=Su(t[n]);return EU(e)}else{if(SU.check(t))return Rl(...t.map(Su));if(PU.check(t))return Fh(t);if(MU.check(t))return tt(t)}Ft()},c_=eU?()=>{}:(t,e)=>{const n=new hU;if(!e.check(t,n))throw Mr(`Expected value to be of type ${e.constructor.name}.
167
167
  ${n.toString()}`)};class FU{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Su(e),h:n}),this}else(e){return this.if(Uf,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw Mr("Unhandled pattern")}}}const BU=t=>new FU(t),sA=BU(Uf).if(nA,(t,e)=>m0(e,e_,Ff)).if(rA,(t,e)=>dU(e)).if(IU,(t,e)=>u_(e)).if(RU,(t,e)=>BigInt(m0(e,e_,Ff))).if($f,(t,e)=>wo(e,b0(e,t.shape))).if(kU,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(bU.check(i)){if(u_(e))continue;i=i.shape}n[r]=sA(i,e)}return n}).if(xU,(t,e)=>{const n=[],r=W3(e,0,42);for(let i=0;i<r;i++)n.push(wo(e,t.shape));return n}).if(K3,(t,e)=>b0(e,t.shape)).if(LU,(t,e)=>null).if(NU,(t,e)=>{const n=wo(e,t.res);return()=>n}).if(DU,(t,e)=>wo(e,b0(e,[Xo,xl,$h,iA,Ib,zh,X3(Xo),Y3(Rl("a","b","c"),Xo)]))).if(_U,(t,e)=>{const n={},r=m0(e,0,3);for(let i=0;i<r;i++){const s=wo(e,t.shape.keys),o=wo(e,t.shape.values);n[s]=o}return n}).done(),wo=(t,e)=>sA(Su(e),t),Yu=typeof document<"u"?document:{};yt(t=>t.nodeType===VU);typeof DOMParser<"u"&&new DOMParser;yt(t=>t.nodeType===$U);yt(t=>t.nodeType===UU);const zU=t=>t$(t,(e,n)=>`${n}:${e};`).join(""),$U=Yu.ELEMENT_NODE,UU=Yu.TEXT_NODE,HU=Yu.DOCUMENT_NODE,VU=Yu.DOCUMENT_FRAGMENT_NODE;yt(t=>t.nodeType===HU);const WU=t=>class{constructor(n){this._=n}destroy(){t(this._)}},KU=WU(clearTimeout),oA=(t,e)=>new KU(setTimeout(e,t)),ui=Symbol,lA=ui(),aA=ui(),jU=ui(),qU=ui(),GU=ui(),uA=ui(),YU=ui(),Lb=ui(),JU=ui(),ZU=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},XU={[lA]:Br("font-weight","bold"),[aA]:Br("font-weight","normal"),[jU]:Br("color","blue"),[GU]:Br("color","green"),[qU]:Br("color","grey"),[uA]:Br("color","red"),[YU]:Br("color","purple"),[Lb]:Br("color","orange"),[JU]:Br("color","black")},QU=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=cn();let i=[],s=0;for(;s<t.length;s++){const o=t[s],l=XU[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=zU(r);s>0||a.length>0?(e.push("%c"+o),n.push(a)):e.push(o)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const o=t[s];o instanceof Symbol||i.push(o)}return i},cA=nU?QU:ZU,eH=(...t)=>{console.log(...cA(t)),fA.forEach(e=>e.print(t))},dA=(...t)=>{console.warn(...cA(t)),t.unshift(Lb),fA.forEach(e=>e.print(t))},fA=ts(),hA=t=>({[Symbol.iterator](){return this},next:t}),tH=(t,e)=>hA(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),y0=(t,e)=>hA(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Pb{constructor(e,n){this.clock=e,this.len=n}}class Il{constructor(){this.clients=new Map}}const oi=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],l=o.id.clock+o.length;for(let a=0,u=r[a];a<r.length&&u.clock<l;u=r[++a])CA(t,s,u.clock,u.len,n)}}),nH=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=Jn((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},fo=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&nH(n,e.clock)!==null},Fb=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?i.len=si(i.len,s.clock+s.len-i.clock):(r<n&&(e[r]=s),r++)}e.length=r})},Hf=t=>{const e=new Il;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=n+1;o<t.length;o++)r$(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return Fb(e),e},Cu=(t,e,n,r)=>{Ir(t.clients,e,()=>[]).push(new Pb(n,r))},Bb=()=>new Il,zb=t=>{const e=Bb();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const l=o.id.clock;let a=o.length;if(s+1<n.length)for(let u=n[s+1];s+1<n.length&&u.deleted;u=n[++s+1])a+=u.length;i.push(new Pb(l,a))}}i.length>0&&e.clients.set(r,i)}),e},Ll=(t,e)=>{ue(t.restEncoder,e.clients.size),ii(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),ue(t.restEncoder,n);const i=r.length;ue(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},$b=t=>{const e=new Il,n=le(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=le(t.restDecoder),s=le(t.restDecoder);if(s>0){const o=Ir(e.clients,i,()=>[]);for(let l=0;l<s;l++)o.push(new Pb(t.readDsClock(),t.readDsLen()))}}return e},d_=(t,e,n)=>{const r=new Il,i=le(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=le(t.restDecoder),l=le(t.restDecoder),a=n.clients.get(o)||[],u=We(n,o);for(let c=0;c<l;c++){const d=t.readDsClock(),f=d+t.readDsLen();if(d<u){u<f&&Cu(r,o,u,f-u);let h=Zn(a,d),p=a[h];for(!p.deleted&&p.id.clock<d&&(a.splice(h+1,0,Kf(e,p,d-p.id.clock)),h++);h<a.length&&(p=a[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&a.splice(h,0,Kf(e,p,f-p.id.clock)),p.delete(e))}else Cu(r,o,d,f-d)}}if(r.clients.size>0){const s=new ns;return ue(s.restEncoder,0),Ll(s,r),s.toUint8Array()}return null},pA=P3;class ps extends O3{constructor({guid:e=U$(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=pA(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new xA,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=l_(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const a=()=>l_(u=>{const c=d=>{(d===void 0||d===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Se(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ii(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Se(this,e,n)}get(e,n=lt){const r=Ir(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==lt&&i!==n)if(i===lt){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Vs)}getText(e=""){return this.get(e,li)}getMap(e=""){return this.get(e,io)}getXmlElement(e=""){return this.get(e,St)}getXmlFragment(e=""){return this.get(e,rs)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,ii(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ps({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Se(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class gA{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return le(this.restDecoder)}readDsLen(){return le(this.restDecoder)}}class Ub extends gA{readLeftID(){return ce(le(this.restDecoder),le(this.restDecoder))}readRightID(){return ce(le(this.restDecoder),le(this.restDecoder))}readClient(){return le(this.restDecoder)}readInfo(){return _l(this.restDecoder)}readString(){return Yi(this.restDecoder)}readParentInfo(){return le(this.restDecoder)===1}readTypeRef(){return le(this.restDecoder)}readLen(){return le(this.restDecoder)}readAny(){return _u(this.restDecoder)}readBuf(){return lU(gn(this.restDecoder))}readJSON(){return JSON.parse(Yi(this.restDecoder))}readKey(){return Yi(this.restDecoder)}}class rH{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=le(this.restDecoder),this.dsCurrVal}readDsLen(){const e=le(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class ro extends rH{constructor(e){super(e),this.keys=[],le(e),this.keyClockDecoder=new g0(gn(e)),this.clientDecoder=new dd(gn(e)),this.leftClockDecoder=new g0(gn(e)),this.rightClockDecoder=new g0(gn(e)),this.infoDecoder=new o_(gn(e),_l),this.stringDecoder=new P$(gn(e)),this.parentInfoDecoder=new o_(gn(e),_l),this.typeRefDecoder=new dd(gn(e)),this.lenDecoder=new dd(gn(e))}readLeftID(){return new Us(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Us(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return _u(this.restDecoder)}readBuf(){return gn(this.restDecoder)}readJSON(){return _u(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class mA{constructor(){this.restEncoder=co()}toUint8Array(){return _n(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ue(this.restEncoder,e)}writeDsLen(e){ue(this.restEncoder,e)}}class Pl extends mA{writeLeftID(e){ue(this.restEncoder,e.client),ue(this.restEncoder,e.clock)}writeRightID(e){ue(this.restEncoder,e.client),ue(this.restEncoder,e.clock)}writeClient(e){ue(this.restEncoder,e)}writeInfo(e){om(this.restEncoder,e)}writeString(e){Gi(this.restEncoder,e)}writeParentInfo(e){ue(this.restEncoder,e?1:0)}writeTypeRef(e){ue(this.restEncoder,e)}writeLen(e){ue(this.restEncoder,e)}writeAny(e){wl(this.restEncoder,e)}writeBuf(e){pn(this.restEncoder,e)}writeJSON(e){Gi(this.restEncoder,JSON.stringify(e))}writeKey(e){Gi(this.restEncoder,e)}}class bA{constructor(){this.restEncoder=co(),this.dsCurrVal=0}toUint8Array(){return _n(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,ue(this.restEncoder,n)}writeDsLen(e){e===0&&Ft(),ue(this.restEncoder,e-1),this.dsCurrVal+=e}}class ns extends bA{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new p0,this.clientEncoder=new cd,this.leftClockEncoder=new p0,this.rightClockEncoder=new p0,this.infoEncoder=new r_(om),this.stringEncoder=new A$,this.parentInfoEncoder=new r_(om),this.typeRefEncoder=new cd,this.lenEncoder=new cd}toUint8Array(){const e=co();return ue(e,0),pn(e,this.keyClockEncoder.toUint8Array()),pn(e,this.clientEncoder.toUint8Array()),pn(e,this.leftClockEncoder.toUint8Array()),pn(e,this.rightClockEncoder.toUint8Array()),pn(e,_n(this.infoEncoder)),pn(e,this.stringEncoder.toUint8Array()),pn(e,_n(this.parentInfoEncoder)),pn(e,this.typeRefEncoder.toUint8Array()),pn(e,this.lenEncoder.toUint8Array()),Ih(e,_n(this.restEncoder)),_n(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){wl(this.restEncoder,e)}writeBuf(e){pn(this.restEncoder,e)}writeJSON(e){wl(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const iH=(t,e,n,r)=>{r=si(r,e[0].id.clock);const i=Zn(e,r);ue(t.restEncoder,e.length-i),t.writeClient(n),ue(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},Hb=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{We(e,s)>i&&r.set(s,i)}),Ju(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),ue(t.restEncoder,r.size),ii(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{iH(t,e.clients.get(i),i,s)})},sH=(t,e)=>{const n=cn(),r=le(t.restDecoder);for(let i=0;i<r;i++){const s=le(t.restDecoder),o=new Array(s),l=t.readClient();let a=le(t.restDecoder);n.set(l,{i:0,refs:o});for(let u=0;u<s;u++){const c=t.readInfo();switch(Rh&c){case 0:{const d=t.readLen();o[u]=new En(ce(l,a),d),a+=d;break}case 10:{const d=le(t.restDecoder);o[u]=new kn(ce(l,a),d),a+=d;break}default:{const d=(c&(Zr|Wt))===0,f=new ke(ce(l,a),null,(c&Wt)===Wt?t.readLeftID():null,null,(c&Zr)===Zr?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(c&ku)===ku?t.readString():null,nT(t,c));o[u]=f,a+=f.length}}}}return n},oH=(t,e,n)=>{const r=[];let i=ii(n.keys()).sort((h,p)=>h-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let h=n.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=n.get(i[i.length-1]);else return null;return h};let o=s();if(o===null)return null;const l=new xA,a=new Map,u=(h,p)=>{const g=a.get(h);(g==null||g>p)&&a.set(h,p)};let c=o.refs[o.i++];const d=new Map,f=()=>{for(const h of r){const p=h.id.client,g=n.get(p);g?(g.i--,l.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):l.clients.set(p,[h]),i=i.filter(b=>b!==p)}r.length=0};for(;;){if(c.constructor!==kn){const p=Ir(d,c.id.client,()=>We(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),f();else{const g=c.getMissing(t,e);if(g!==null){r.push(c);const b=n.get(g)||{refs:[],i:0};if(b.refs.length===b.i)u(g,We(e,g)),f();else{c=b.refs[b.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),d.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(o!==null&&o.i<o.refs.length)c=o.refs[o.i++];else{if(o=s(),o===null)break;c=o.refs[o.i++]}}if(l.clients.size>0){const h=new ns;return Hb(h,l,new Map),ue(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},lH=(t,e)=>Hb(t,e.doc.store,e.beforeState),yA=(t,e,n,r=new ro(t))=>Se(e,i=>{i.local=!1;let s=!1;const o=i.doc,l=o.store,a=sH(r,o),u=oH(i,l,a),c=l.pendingStructs;if(c){for(const[f,h]of c.missing)if(h<We(l,f)){s=!0;break}if(u){for(const[f,h]of u.missing){const p=c.missing.get(f);(p==null||p>h)&&c.missing.set(f,h)}c.update=Nu([c.update,u.update])}}else l.pendingStructs=u;const d=d_(r,i,l);if(l.pendingDs){const f=new ro(hs(l.pendingDs));le(f.restDecoder);const h=d_(f,i,l);d&&h?l.pendingDs=Nu([d,h]):l.pendingDs=d||h}else l.pendingDs=d;if(s){const f=l.pendingStructs.update;l.pendingStructs=null,Au(i.doc,f)}},n,!1),Au=(t,e,n,r=ro)=>{const i=hs(e);yA(i,t,n,new r(i))},aH=(t,e,n)=>Au(t,e,n,Ub),uH=(t,e,n=new Map)=>{Hb(t,e.store,n),Ll(t,zb(e.store))},EA=(t,e=new Uint8Array([0]),n=new ns)=>{const r=Vb(e);uH(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(MA(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Pl)return NA(i.map((s,o)=>o===0?s:DA(s)));if(n.constructor===ns)return Nu(i)}return i[0]},cH=(t,e)=>EA(t,e,new Pl),dH=t=>{const e=new Map,n=le(t.restDecoder);for(let r=0;r<n;r++){const i=le(t.restDecoder),s=le(t.restDecoder);e.set(i,s)}return e},Vb=t=>dH(new gA(hs(t))),kA=(t,e)=>(ue(t.restEncoder,e.size),ii(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{ue(t.restEncoder,n),ue(t.restEncoder,r)}),t),fH=(t,e)=>kA(t,Ju(e.store)),hH=(t,e=new bA)=>(t instanceof Map?kA(e,t):fH(e,t),e.toUint8Array()),pH=t=>hH(t,new mA);class gH{constructor(){this.l=[]}}const f_=()=>new gH,h_=(t,e)=>t.l.push(e),p_=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},wA=(t,e,n)=>Nb(t.l,[e,n]);class Us{constructor(e,n){this.client=e,this.clock=n}}const aa=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,ce=(t,e)=>new Us(t,e),Sl=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Ft()},Cl=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Tu{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}class _A{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const mH=(t,e,n=0)=>new _A(t,e,n),Hc=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Sl(t):r=ce(t._item.id.client,t._item.id.clock),new Tu(r,i,e,n)},fd=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Hc(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Hc(t,ce(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Hc(t,r.lastId,n);r=r.right}return Hc(t,null,n)},bH=(t,e)=>{const n=Hs(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},vA=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,l=t.assoc;let a=null,u=0;if(i!==null){if(We(r,i.client)<=i.clock)return null;const c=n?pm(r,i):bH(r,i),d=c.item;if(!(d instanceof ke))return null;if(a=d.parent,a._item===null||!a._item.deleted){u=d.deleted||!d.countable?0:c.diff+(l>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(u+=f.length),f=f.left}}else{if(o!==null)a=e.get(o);else if(s!==null){if(We(r,s.client)<=s.clock)return null;const{item:c}=n?pm(r,s):{item:Hs(r,s)};if(c instanceof ke&&c.content instanceof Qn)a=c.content.type;else return null}else throw Ft();l>=0?u=a._length:u=0}return mH(a,u,t.assoc)};class Uh{constructor(e,n){this.ds=e,this.sv=n}}const Wb=(t,e)=>new Uh(t,e),hd=t=>Wb(zb(t.store),Ju(t.store)),vs=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!fo(e.ds,t.id),cm=(t,e)=>{const n=Ir(t.meta,cm,ts),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<We(r,s)&&Ht(t,ce(s,i))}),oi(t,e.ds,i=>{}),n.add(e))};class xA{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ju=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},We=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},SA=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Ft()}n.push(e)},Zn=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=Jn(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=Jn((n+r)/2)}throw Ft()},yH=(t,e)=>{const n=t.clients.get(e.client);return n[Zn(n,e.clock)]},Hs=yH,dm=(t,e,n)=>{const r=Zn(e,n),i=e[r];return i.id.clock<n&&i instanceof ke?(e.splice(r+1,0,Kf(t,i,n-i.id.clock)),r+1):r},Ht=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[dm(t,n,e.clock)]},fm=(t,e,n)=>{const r=e.clients.get(n.client),i=Zn(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==En&&r.splice(i+1,0,Kf(t,s,n.clock-s.id.clock+1)),s},EH=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Zn(r,e.id.clock)]=n},CA=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=dm(t,e,n),l;do l=e[o++],s<l.id.clock+l.length&&dm(t,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class AA{constructor(e,n,r){this.doc=e,this.deleteSet=new Il,this.beforeState=Ju(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const g_=(t,e)=>e.deleteSet.clients.size===0&&!n$(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Fb(e.deleteSet),lH(t,e),Ll(t,e.deleteSet),!0),m_=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ir(t.changed,e,ts).add(n)},pd=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof ke&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},kH=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let u=Zn(s,l.clock),c=s[u];u<s.length&&c.id.clock<a;c=s[++u]){const d=s[u];if(l.clock+l.len<=d.id.clock)break;d instanceof ke&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},wH=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],l=kl(i.length-1,1+Zn(i,o.clock+o.len-1));for(let a=l,u=i[a];a>0&&u.id.clock>=o.clock;u=i[a])a-=1+pd(i,a)}})},TA=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{Fb(s),n.afterState=Ju(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const l=[];n.changed.forEach((a,u)=>l.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,a)})),l.push(()=>{n.changedParentTypes.forEach((a,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(a=a.filter(c=>c.target._item===null||!c.target._item.deleted),a.forEach(c=>{c.currentTarget=u,c._path=null}),a.sort((c,d)=>c.path.length-d.path.length),l.push(()=>{wA(u._dEH,a,n)}))}),l.push(()=>r.emit("afterTransaction",[n,r])),l.push(()=>{n._needFormattingCleanup&&LH(n)})}),Nb(l,[])}finally{r.gc&&kH(s,i,r.gcFilter),wH(s,i),n.afterState.forEach((c,d)=>{const f=n.beforeState.get(d)||0;if(f!==c){const h=i.clients.get(d),p=si(Zn(h,f),1);for(let g=h.length-1;g>=p;)g-=1+pd(h,g)}});for(let c=o.length-1;c>=0;c--){const{client:d,clock:f}=o[c].id,h=i.clients.get(d),p=Zn(h,f);p+1<h.length&&pd(h,p+1)>1||p>0&&pd(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(eH(Lb,lA,"[yjs] ",aA,uA,"Changed the client-id because another client seems to be using it."),r.clientID=pA()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Pl;g_(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new ns;g_(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:u}=n;(l.size>0||u.size>0||a.size>0)&&(l.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:a,added:l,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):TA(t,e+1)}}},Se=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new AA(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const l=t._transaction===i[0];t._transaction=null,l&&TA(i,0)}}return o};class _H{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const b_=(t,e,n)=>{oi(t,n.deletions,r=>{r instanceof ke&&e.scope.some(i=>i===t.doc||Cl(i,r))&&Qb(r,!1)})},y_=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;Se(i,l=>{for(;e.length>0&&t.currStackItem===null;){const a=i.store,u=e.pop(),c=new Set,d=[];let f=!1;oi(l,u.insertions,h=>{if(h instanceof ke){if(h.redone!==null){let{item:p,diff:g}=pm(a,h.id);g>0&&(p=Ht(l,ce(p.id.client,p.id.clock+g))),h=p}!h.deleted&&s.some(p=>p===l.doc||Cl(p,h))&&d.push(h)}}),oi(l,u.deletions,h=>{h instanceof ke&&s.some(p=>p===l.doc||Cl(p,h))&&!fo(u.insertions,h.id)&&c.add(h)}),c.forEach(h=>{f=tT(l,h,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){const p=d[h];t.deleteFilter(p)&&(p.delete(l),f=!0)}t.currStackItem=f?u:null}l.changed.forEach((a,u)=>{a.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=l},t);const o=t.currStackItem;if(o!=null){const l=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return o};class Kb extends O3{constructor(e,{captureTimeout:n=500,captureTransaction:r=a=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=El(e)?e[0].doc:e instanceof ps?e:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(b=>a.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;const u=this.undoing,c=this.redoing,d=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const f=new Il;a.afterState.forEach((b,m)=>{const E=a.beforeState.get(m)||0,k=b-E;k>0&&Cu(f,m,E,k)});const h=vu();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!u&&!c){const b=d[d.length-1];b.deletions=Hf([b.deletions,a.deleteSet]),b.insertions=Hf([b.insertions,f])}else d.push(new _H(a.deleteSet,f)),p=!0;!u&&!c&&(this.lastChange=h),oi(a,a.deleteSet,b=>{b instanceof ke&&this.scope.some(m=>m===a.doc||Cl(m,b))&&Qb(b,!0)});const g=[{stackItem:d[d.length-1],origin:a.origin,type:u?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=El(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof lt?r.doc!==this.doc:r!==this.doc)&&dA("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>b_(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>b_(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=y_(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=y_(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*vH(t){const e=le(t.restDecoder);for(let n=0;n<e;n++){const r=le(t.restDecoder),i=t.readClient();let s=le(t.restDecoder);for(let o=0;o<r;o++){const l=t.readInfo();if(l===10){const a=le(t.restDecoder);yield new kn(ce(i,s),a),s+=a}else if(Rh&l){const a=(l&(Zr|Wt))===0,u=new ke(ce(i,s),null,(l&Wt)===Wt?t.readLeftID():null,null,(l&Zr)===Zr?t.readRightID():null,a?t.readParentInfo()?t.readString():t.readLeftID():null,a&&(l&ku)===ku?t.readString():null,nT(t,l));yield u,s+=u.length}else{const a=t.readLen();yield new En(ce(i,s),a),s+=a}}}}class jb{constructor(e,n){this.gen=vH(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===kn);return this.curr}}class qb{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const NA=t=>Nu(t,Ub,Pl),xH=(t,e)=>{if(t.constructor===En){const{client:n,clock:r}=t.id;return new En(ce(n,r+e),t.length-e)}else if(t.constructor===kn){const{client:n,clock:r}=t.id;return new kn(ce(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new ke(ce(r,i+e),null,ce(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Nu=(t,e=ro,n=ns)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(hs(c)));let i=r.map(c=>new jb(c,!0)),s=null;const o=new n,l=new qb(o);for(;i=i.filter(f=>f.curr!==null),i.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){const p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===kn?1:-1:p}else return h.curr.id.client-f.curr.id.client}),i.length!==0;){const c=i[0],d=c.curr.id.client;if(s!==null){let f=c.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=c.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)Ci(l,s.struct,s.offset),s={struct:f,offset:0},c.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===kn)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{Ci(l,s.struct,s.offset);const p=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new kn(ce(d,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-f.id.clock;p>0&&(s.struct.constructor===kn?s.struct.length-=p:f=xH(f,p)),s.struct.mergeWith(f)||(Ci(l,s.struct,s.offset),s={struct:f,offset:0},c.next())}}else s={struct:c.curr,offset:0},c.next();for(let f=c.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==kn;f=c.next())Ci(l,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(Ci(l,s.struct,s.offset),s=null),Gb(l);const a=r.map(c=>$b(c)),u=Hf(a);return Ll(o,u),o.toUint8Array()},MA=(t,e,n=ro,r=ns)=>{const i=Vb(e),s=new r,o=new qb(s),l=new n(hs(t)),a=new jb(l,!1);for(;a.curr;){const c=a.curr,d=c.id.client,f=i.get(d)||0;if(a.curr.constructor===kn){a.next();continue}if(c.id.clock+c.length>f)for(Ci(o,c,si(f-c.id.clock,0)),a.next();a.curr&&a.curr.id.client===d;)Ci(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===d&&a.curr.id.clock+a.curr.length<=f;)a.next()}Gb(o);const u=$b(l);return Ll(s,u),s.toUint8Array()},OA=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:_n(t.encoder.restEncoder)}),t.encoder.restEncoder=co(),t.written=0)},Ci=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&OA(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),ue(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Gb=t=>{OA(t);const e=t.encoder.restEncoder;ue(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];ue(e,r.written),Ih(e,r.restEncoder)}},SH=(t,e,n,r)=>{const i=new n(hs(t)),s=new jb(i,!1),o=new r,l=new qb(o);for(let u=s.curr;u!==null;u=s.next())Ci(l,e(u),0);Gb(l);const a=$b(i);return Ll(o,a),o.toUint8Array()},DA=t=>SH(t,Z$,ro,Pl),E_="You must not compute changes after the event-handler fired.";class Zu{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=CH(this.currentTarget,this.target))}deletes(e){return fo(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Mr(E_);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=d0(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=d0(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=d0(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Mr(E_);const n=this.target,r=ts(),i=ts(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=u.length,i.add(u)):this.adds(u)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(u.content.getContent()),r.add(u)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=u.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const CH=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},Rt=()=>{dA("Invalid access: Add Yjs type to a document before reading data.")},RA=80;let Yb=0;class AH{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Yb++}}const TH=t=>{t.timestamp=Yb++},IA=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Yb++},NH=(t,e,n)=>{if(t.length>=RA){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return IA(r,e,n),r}else{const r=new AH(e,n);return t.push(r),r}},Hh=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>ud(e-s.index)<ud(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,TH(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&ud(n.index-i)<r.parent.length/RA?(IA(n,r,i),n):NH(t._searchMarker,r,i)},Mu=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=si(e,i.index+n))}},Vh=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Ir(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;wA(r._eH,n,e)};class lt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=f_(),this._dEH=f_(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Vn()}clone(){throw Vn()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){h_(this._eH,e)}observeDeep(e){h_(this._dEH,e)}unobserve(e){p_(this._eH,e)}unobserveDeep(e){p_(this._dEH,e)}toJSON(){}}const LA=(t,e,n)=>{t.doc??Rt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},PA=t=>{t.doc??Rt();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},Jb=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&vs(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Ou=(t,e)=>{let n=0,r=t._start;for(t.doc??Rt();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},FA=(t,e)=>{const n=[];return Ou(t,(r,i)=>{n.push(e(r,i,t))}),n},MH=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},BA=(t,e)=>{t.doc??Rt();const n=Hh(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Vf=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,l=s.store,a=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(i=new ke(ce(o,We(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new is(u)),i.integrate(t,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(c(),d.constructor){case Uint8Array:case ArrayBuffer:i=new ke(ce(o,We(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Bl(new Uint8Array(d))),i.integrate(t,0);break;case ps:i=new ke(ce(o,We(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new zl(d)),i.integrate(t,0);break;default:if(d instanceof lt)i=new ke(ce(o,We(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Qn(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},zA=()=>Mr("Length exceeded!"),$A=(t,e,n,r)=>{if(n>e._length)throw zA();if(n===0)return e._searchMarker&&Mu(e._searchMarker,n,r.length),Vf(t,e,null,r);const i=n,s=Hh(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Ht(t,ce(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&Mu(e._searchMarker,i,r.length),Vf(t,e,o,r)},OH=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Vf(t,e,i,n)},UA=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=Hh(e,n);let l=e._start;for(o!==null&&(l=o.p,n-=o.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&Ht(t,ce(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&Ht(t,ce(l.id.client,l.id.clock+r)),l.delete(t),r-=l.length),l=l.right;if(r>0)throw zA();e._searchMarker&&Mu(e._searchMarker,i,-s+r)},Wf=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},Zb=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let l;if(r==null)l=new is([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new is([r]);break;case Uint8Array:l=new Bl(r);break;case ps:l=new zl(r);break;default:if(r instanceof lt)l=new Qn(r);else throw new Error("Unexpected content type")}new ke(ce(o,We(s.store,o)),i,i&&i.lastId,null,null,e,n,l).integrate(t,0)},Xb=(t,e)=>{t.doc??Rt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},HA=t=>{const e={};return t.doc??Rt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},VA=(t,e)=>{t.doc??Rt();const n=t._map.get(e);return n!==void 0&&!n.deleted},WA=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&vs(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Vc=t=>(t.doc??Rt(),tH(t._map.entries(),e=>!e[1].deleted));class KA extends Zu{}class Vs extends lt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Vs;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Vs}clone(){const e=new Vs;return e.insert(0,this.toArray().map(n=>n instanceof lt?n.clone():n)),e}get length(){return this.doc??Rt(),this._length}_callObserver(e,n){super._callObserver(e,n),Vh(this,e,new KA(this,e))}insert(e,n){this.doc!==null?Se(this.doc,r=>{$A(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Se(this.doc,n=>{OH(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Se(this.doc,r=>{UA(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return BA(this,e)}toArray(){return PA(this)}slice(e=0,n=this.length){return LA(this,e,n)}toJSON(){return this.map(e=>e instanceof lt?e.toJSON():e)}map(e){return FA(this,e)}forEach(e){Ou(this,e)}[Symbol.iterator](){return MH(this)}_write(e){e.writeTypeRef(XH)}}const DH=t=>new Vs;class jA extends Zu{constructor(e,n,r){super(e,n),this.keysChanged=r}}class io extends lt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new io}clone(){const e=new io;return this.forEach((n,r)=>{e.set(r,n instanceof lt?n.clone():n)}),e}_callObserver(e,n){Vh(this,e,new jA(this,e,n))}toJSON(){this.doc??Rt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof lt?i.toJSON():i}}),e}get size(){return[...Vc(this)].length}keys(){return y0(Vc(this),e=>e[0])}values(){return y0(Vc(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return y0(Vc(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Rt(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Se(this.doc,n=>{Wf(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Se(this.doc,r=>{Zb(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Xb(this,e)}has(e){return VA(this,e)}clear(){this.doc!==null?Se(this.doc,e=>{this.forEach(function(n,r,i){Wf(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(QH)}}const RH=t=>new io,Li=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&Y$(t,e);class hm{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Ft(),this.right.content.constructor){case Ye:this.right.deleted||Fl(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const k_=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Ye:e.right.deleted||Fl(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&Ht(t,ce(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Wc=(t,e,n,r)=>{const i=new Map,s=r?Hh(e,n):null;if(s){const o=new hm(s.p.left,s.p,s.index,i);return k_(t,o,n-s.index)}else{const o=new hm(null,e._start,0,i);return k_(t,o,n)}},qA=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ye&&Li(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,l)=>{const a=n.left,u=n.right,c=new ke(ce(s,We(i.store,s)),a,a&&a.lastId,u,u&&u.id,e,null,new Ye(l,o));c.integrate(t,0),n.right=c,n.forward()})},Fl=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},GA=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Ye&&Li(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},YA=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],u=n.currentAttributes.get(l)??null;if(!Li(u,a)){o.set(l,u);const{left:c,right:d}=n;n.right=new ke(ce(s,We(i.store,s)),c,c&&c.lastId,d,d&&d.id,e,null,new Ye(l,a)),n.right.integrate(t,0),n.forward()}}return o},E0=(t,e,n,r,i)=>{n.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=t.doc,o=s.clientID;GA(n,i);const l=YA(t,e,n,i),a=r.constructor===String?new Xn(r):r instanceof lt?new Qn(r):new gs(r);let{left:u,right:c,index:d}=n;e._searchMarker&&Mu(e._searchMarker,n.index,a.getLength()),c=new ke(ce(o,We(s.store,o)),u,u&&u.lastId,c,c&&c.id,e,null,a),c.integrate(t,0),n.right=c,n.index=d,n.forward(),qA(t,e,n,l)},w_=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;GA(n,i);const l=YA(t,e,n,i);e:for(;n.right!==null&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===Ye));){if(!n.right.deleted)switch(n.right.content.constructor){case Ye:{const{key:a,value:u}=n.right.content,c=i[a];if(c!==void 0){if(Li(c,u))l.delete(a);else{if(r===0)break e;l.set(a,u)}n.right.delete(t)}else n.currentAttributes.set(a,u);break}default:r<n.right.length&&Ht(t,ce(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
168
168
  `;n.right=new ke(ce(o,We(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new Xn(a)),n.right.integrate(t,0),n.forward()}qA(t,e,n,l)},JA=(t,e,n,r,i)=>{let s=e;const o=cn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Ye){const u=s.content;o.set(u.key,u)}s=s.right}let l=0,a=!1;for(;e!==s;){if(n===e&&(a=!0),!e.deleted){const u=e.content;switch(u.constructor){case Ye:{const{key:c,value:d}=u,f=r.get(c)??null;(o.get(c)!==u||f===d)&&(e.delete(t),l++,!a&&(i.get(c)??null)===d&&f!==d&&(f===null?i.delete(c):i.set(c,f))),!a&&!e.deleted&&Fl(i,u);break}}}e=e.right}return l},IH=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Ye){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},ZA=t=>{let e=0;return Se(t.doc,n=>{let r=t._start,i=t._start,s=cn();const o=im(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Ye:Fl(o,i.content);break;default:e+=JA(n,r,i,s,o),s=im(o),r=i;break}i=i.right}}),e},LH=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&CA(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Ye&&o.constructor!==En&&e.add(o.parent)})}Se(n,r=>{oi(t,t.deleteSet,i=>{if(i instanceof En||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Ye?e.add(s):IH(r,i)});for(const i of e)ZA(i)})},__=(t,e,n)=>{const r=n,i=im(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Qn:case gs:case Xn:n<e.right.length&&Ht(t,ce(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&JA(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Mu(o._searchMarker,e.index,-r+n),e};class XA extends Zu{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Se(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let u="",c=0,d=0;const f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof u=="object"||u.length>0)&&(h={insert:u},i.size>0&&(h.attributes={},i.forEach((p,g)=>{p!==null&&(h.attributes[g]=p)}))),u="";break;case"retain":c>0&&(h={retain:c},G$(a)||(h.attributes=j$({},a))),c=0;break}h&&n.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case Qn:case gs:this.adds(o)?this.deletes(o)||(f(),l="insert",u=o.content.getContent()[0],f()):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=1):o.deleted||(l!=="retain"&&(f(),l="retain"),c+=1);break;case Xn:this.adds(o)?this.deletes(o)||(l!=="insert"&&(f(),l="insert"),u+=o.content.str):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=o.length):o.deleted||(l!=="retain"&&(f(),l="retain"),c+=o.length);break;case Ye:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=i.get(h)??null;Li(g,p)?p!==null&&o.delete(r):(l==="retain"&&f(),Li(p,s.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(o)){s.set(h,p);const g=i.get(h)??null;Li(g,p)||(l==="retain"&&f(),a[h]=g)}else if(!o.deleted){s.set(h,p);const g=a[h];g!==void 0&&(Li(g,p)?g!==null&&o.delete(r):(l==="retain"&&f(),p===null?delete a[h]:a[h]=p))}o.deleted||(l==="insert"&&f(),Fl(i,o.content));break}}o=o.right}for(f();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class li extends lt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Rt(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new li}clone(){const e=new li;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new XA(this,e,n);Vh(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Rt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Xn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Se(this.doc,r=>{const i=new hm(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const l=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
169
- `?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&E0(r,this,i,l,o.attributes||{})}else o.retain!==void 0?w_(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&__(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Rt();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function u(){if(l.length>0){const d={};let f=!1;s.forEach((p,g)=>{f=!0,d[g]=p});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const c=()=>{for(;a!==null;){if(vs(a,e)||n!==void 0&&vs(a,n))switch(a.content.constructor){case Xn:{const d=s.get("ychange");e!==void 0&&!vs(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(u(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!vs(a,n)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(u(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),l+=a.content.str;break}case Qn:case gs:{u();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,p)=>{f[p]=h})}i.push(d);break}case Ye:vs(a,e)&&(u(),Fl(s,a.content));break}a=a.right}u()};return e||n?Se(o,d=>{e&&cm(d,e),n&&cm(d,n),c()},"cleanup"):c(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),E0(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!r);E0(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Se(r,i=>{__(i,Wc(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!1);o.right!==null&&w_(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Se(this.doc,n=>{Wf(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Se(this.doc,r=>{Zb(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Xb(this,e)}getAttributes(){return HA(this)}_write(e){e.writeTypeRef(eV)}}const PH=t=>new li;class k0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Rt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===St||n.constructor===rs)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class rs extends lt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new rs}clone(){const e=new rs;return e.insert(0,this.toArray().map(n=>n instanceof lt?n.clone():n)),e}get length(){return this.doc??Rt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new k0(this,e)}querySelector(e){e=e.toUpperCase();const r=new k0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ii(new k0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Vh(this,e,new QA(this,n,e))}toString(){return FA(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Ou(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Se(this.doc,r=>{$A(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Se(this.doc,r=>{const i=e&&e instanceof lt?e._item:e;Vf(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Mr("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Se(this.doc,r=>{UA(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return PA(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return BA(this,e)}slice(e=0,n=this.length){return LA(this,e,n)}forEach(e){Ou(this,e)}_write(e){e.writeTypeRef(nV)}}const FH=t=>new rs;class St extends rs{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new St(this.nodeName)}clone(){const e=new St(this.nodeName),n=this.getAttributes();return q$(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof lt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];n.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Se(this.doc,n=>{Wf(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Se(this.doc,r=>{Zb(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Xb(this,e)}hasAttribute(e){return VA(this,e)}getAttributes(e){return e?WA(this,e):HA(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return Ou(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(tV),e.writeKey(this.nodeName)}}const BH=t=>new St(t.readKey());class QA extends Zu{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Du extends io{constructor(e){super(),this.hookName=e}_copy(){return new Du(this.hookName)}clone(){const e=new Du(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(rV),e.writeKey(this.hookName)}}const zH=t=>new Du(t.readKey());class Kt extends li{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Kt}clone(){const e=new Kt;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(iV)}}const $H=t=>new Kt;class Wh{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Vn()}mergeWith(e){return!1}write(e,n,r){throw Vn()}integrate(e,n){throw Vn()}}const UH=0;class En extends Wh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),SA(e.doc.store,this)}write(e,n){e.writeInfo(UH),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Bl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Bl(this.content)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const HH=t=>new Bl(t.readBuf());class Al{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Al(this.len)}splice(e){const n=new Al(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Cu(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const VH=t=>new Al(t.readLen()),eT=(t,e)=>new ps({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class zl{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new zl(eT(this.doc.guid,this.opts))}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const WH=t=>new zl(eT(t.readString(),t.readAny()));class gs{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new gs(this.embed)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const KH=t=>new gs(t.readJSON());class Ye{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ye(this.key,this.value)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const jH=t=>new Ye(t.readKey(),t.readJSON());class Ru{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ru(this.arr)}splice(e){const n=new Ru(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const qH=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Ru(n)},GH=zf("node_env")==="development";class is{constructor(e){this.arr=e,GH&&$3(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new is(this.arr)}splice(e){const n=new is(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const YH=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new is(n)};class Xn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Xn(this.str)}splice(e){const n=new Xn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const JH=t=>new Xn(t.readString()),ZH=[DH,RH,PH,BH,FH,zH,$H],XH=0,QH=1,eV=2,tV=3,nV=4,rV=5,iV=6;class Qn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Qn(this.type._copy())}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const sV=t=>new Qn(ZH[t.readTypeRef()](t)),pm=(t,e)=>{let n=e,r=0,i;do r>0&&(n=ce(n.client,n.clock+r)),i=Hs(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof ke);return{item:i,diff:r}},Qb=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Kf=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new ke(ce(r,i+n),e,ce(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=ce(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},v_=(t,e)=>vb(t,n=>fo(n.deletions,e)),tT=(t,e,n,r,i,s)=>{const o=t.doc,l=o.store,a=o.clientID,u=e.redone;if(u!==null)return Ht(t,u);let c=e.parent._item,d=null,f;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||tT(t,c,n,r,i,s)===null))return null;for(;c.redone!==null;)c=Ht(t,c.redone)}const h=c===null?e.parent:c.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let m=d;for(;m!==null&&m.parent._item!==c;)m=m.redone===null?null:Ht(t,m.redone);if(m!==null&&m.parent._item===c){d=m;break}d=d.left}for(;f!==null;){let m=f;for(;m!==null&&m.parent._item!==c;)m=m.redone===null?null:Ht(t,m.redone);if(m!==null&&m.parent._item===c){f=m;break}f=f.right}}else if(f=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||fo(r,d.right.id)||v_(s.undoStack,d.right.id)||v_(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Ht(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;const p=We(l,a),g=ce(a,p),b=new ke(g,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=g,Qb(b,!0),b.integrate(t,0),b};class ke extends Wh{constructor(e,n,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?Qw:0}set marker(e){(this.info&h0)>0!==e&&(this.info^=h0)}get marker(){return(this.info&h0)>0}get keep(){return(this.info&Xw)>0}set keep(e){this.keep!==e&&(this.info^=Xw)}get countable(){return(this.info&Qw)>0}get deleted(){return(this.info&f0)>0}set deleted(e){this.deleted!==e&&(this.info^=f0)}markDeleted(){this.info|=f0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=We(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=We(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Us&&this.id.client!==this.parent.client&&this.parent.clock>=We(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=fm(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Ht(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===En||this.right&&this.right.constructor===En)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ke?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ke&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Us){const r=Hs(n,this.parent);r.constructor===En?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=fm(e,e.doc.store,ce(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),aa(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(aa(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Hs(e.doc.store,i.origin)))s.has(Hs(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),SA(e.doc.store,this),this.content.integrate(e,this),m_(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new En(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ce(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&aa(e.origin,this.lastId)&&this.right===e&&aa(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Cu(e.deleteSet,this.id.client,this.id.clock,this.length),m_(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Ft();this.content.gc(e),n?EH(e,this,new En(this.id,this.length)):this.content=new Al(this.length)}write(e,n){const r=n>0?ce(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Rh|(r===null?0:Wt)|(i===null?0:Zr)|(s===null?0:ku);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const u=Sl(l);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===Us?(e.writeParentInfo(!1),e.writeLeftID(l)):Ft();s!==null&&e.writeString(s)}this.content.write(e,n)}}const nT=(t,e)=>oV[e&Rh](t),oV=[()=>{Ft()},VH,qH,HH,JH,KH,jH,sV,YH,WH,()=>{Ft()}],lV=10;class kn extends Wh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Ft()}write(e,n){e.writeInfo(lV),ue(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const rT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},iT="__ $YJS$ __";rT[iT]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");rT[iT]=!0;const DW=Object.freeze(Object.defineProperty({__proto__:null,AbsolutePosition:_A,AbstractStruct:Wh,AbstractType:lt,Array:Vs,ContentAny:is,ContentBinary:Bl,ContentDeleted:Al,ContentDoc:zl,ContentEmbed:gs,ContentFormat:Ye,ContentJSON:Ru,ContentString:Xn,ContentType:Qn,Doc:ps,GC:En,ID:Us,Item:ke,Map:io,RelativePosition:Tu,Skip:kn,Snapshot:Uh,Text:li,Transaction:AA,UndoManager:Kb,UpdateDecoderV1:Ub,UpdateDecoderV2:ro,UpdateEncoderV1:Pl,UpdateEncoderV2:ns,XmlElement:St,XmlFragment:rs,XmlHook:Du,XmlText:Kt,YArrayEvent:KA,YEvent:Zu,YMapEvent:jA,YTextEvent:XA,YXmlEvent:QA,applyUpdate:aH,applyUpdateV2:Au,cleanupYTextFormatting:ZA,compareIDs:aa,convertUpdateFormatV2ToV1:DA,createAbsolutePositionFromRelativePosition:vA,createDeleteSet:Bb,createDeleteSetFromStructStore:zb,createID:ce,createRelativePositionFromTypeIndex:fd,createSnapshot:Wb,decodeStateVector:Vb,diffUpdateV2:MA,encodeStateAsUpdate:cH,encodeStateAsUpdateV2:EA,encodeStateVector:pH,findIndexSS:Zn,findRootTypeKey:Sl,getItem:Hs,getItemCleanEnd:fm,getItemCleanStart:Ht,getState:We,isDeleted:fo,isParentOf:Cl,iterateDeletedStructs:oi,mergeDeleteSets:Hf,mergeUpdates:NA,mergeUpdatesV2:Nu,readUpdateV2:yA,snapshot:hd,transact:Se,typeListToArraySnapshot:Jb,typeMapGetAllSnapshot:WA},Symbol.toStringTag,{value:"Module"})),gd=3e4;class aV extends s${constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=vu();this.getLocalState()!==null&&gd/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&gd<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&sT(this,r,"timeout")},Jn(gd/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:vu()});const o=[],l=[],a=[],u=[];e===null?u.push(n):s==null?e!=null&&o.push(n):(l.push(n),Zo(s,e)||a.push(n)),(o.length>0||a.length>0||u.length>0)&&this.emit("change",[{added:o,updated:a,removed:u},"local"]),this.emit("update",[{added:o,updated:l,removed:u},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const sT=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const o=t.meta.get(s);t.meta.set(s,{clock:o.clock+1,lastUpdated:vu()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},uV=(t,e,n=t.states)=>{const r=e.length,i=co();ue(i,r);for(let s=0;s<r;s++){const o=e[s],l=n.get(o)||null,a=t.meta.get(o).clock;ue(i,o),ue(i,a),Gi(i,JSON.stringify(l))}return _n(i)},cV=(t,e)=>{const n=hs(t),r=co(),i=le(n);ue(r,i);for(let s=0;s<i;s++){const o=le(n),l=le(n),a=JSON.parse(Yi(n)),u=e(a);ue(r,o),ue(r,l),Gi(r,JSON.stringify(u))}return _n(r)},dV=(t,e,n)=>{const r=hs(e),i=vu(),s=[],o=[],l=[],a=[],u=le(r);for(let c=0;c<u;c++){const d=le(r);let f=le(r);const h=JSON.parse(Yi(r)),p=t.meta.get(d),g=t.states.get(d),b=p===void 0?0:p.clock;(b<f||b===f&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?f++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:f,lastUpdated:i}),p===void 0&&h!==null?s.push(d):p!==void 0&&h===null?a.push(d):h!==null&&(Zo(h,g)||l.push(d),o.push(d)))}(s.length>0||l.length>0||a.length>0)&&t.emit("change",[{added:s,updated:l,removed:a},n]),(s.length>0||o.length>0||a.length>0)&&t.emit("update",[{added:s,updated:o,removed:a},n])},RW=Object.freeze(Object.defineProperty({__proto__:null,Awareness:aV,applyAwarenessUpdate:dV,encodeAwarenessUpdate:uV,modifyAwarenessUpdate:cV,outdatedTimeout:gd,removeAwarenessStates:sT},Symbol.toStringTag,{value:"Module"})),fV=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},hV=/[\uD800-\uDBFF]/,pV=/[\uDC00-\uDFFF]/,gV=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&hV.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&pV.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},mV=gV,it=new Le("y-sync"),Xr=new Le("y-undo");new Le("yjs-cursor");const Cr=(t,e)=>t>>>e|t<<32-e,bV=t=>Cr(t,2)^Cr(t,13)^Cr(t,22),yV=t=>Cr(t,6)^Cr(t,11)^Cr(t,25),EV=t=>Cr(t,7)^Cr(t,18)^t>>>3,kV=t=>Cr(t,17)^Cr(t,19)^t>>>10,wV=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_V=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class vV{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(_V),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=kV(n[d-2])+n[d-7]+EV(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],l=e[4],a=e[5],u=e[6],c=e[7];for(let d=0,f,h;d<64;d++)f=c+yV(l)+(l&a^~l&u)+wV[d]+n[d]>>>0,h=bV(r)+(r&i^r&s^i&s)>>>0,c=u,u=a,a=l,l=o+f>>>0,o=s,s=i,i=r,r=f+h>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=l,e[5]+=a,e[6]+=u,e[7]+=c}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=Wt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=Wt<<(3-n%4)*8),this._W[14]=e.byteLength/o$,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let l=0;l<4;l++)s[o*4+l]=this._H[o]>>>(3-l)*8;return s}}const xV=t=>new vV().digest(t),SV=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},CV=t=>oU(SV(xV(aU(t)))),jf=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!fo(e.ds,t.id),AV=[{light:"#ecd44433",dark:"#ecd444"}],TV=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=ts();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,z$(e))}return t.get(n)},NV=(t,{colors:e=AV,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const l=new OV(t,s),a=new Ae({props:{editable:u=>{const c=it.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:it,state:{init:(u,c)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const d=u.getMeta(it);if(d!==void 0){c=Object.assign({},c);for(const f in d)c[f]=d[f]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,l.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&oA(0,()=>{l.prosemirrorView!=null&&(d.restore==null?l._renderSnapshot(d.snapshot,d.prevSnapshot,c):(l._renderSnapshot(d.snapshot,d.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),c}},view:u=>(l.initView(u),s==null&&l._forceRerender(),i(),{update:()=>{const c=a.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(o||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(o=!0,c.addToHistory===!1&&!c.isChangeOrigin){const d=Xr.getState(u.state),f=d&&d.undoManager;f&&f.stopCapturing()}l.mux(()=>{c.doc.transact(d=>{d.meta.set("addToHistory",c.addToHistory),l._prosemirrorChanged(u.state.doc)},it)})}},destroy:()=>{l.destroy()}})});return a},MV=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new on(t.doc));else if(e.type==="node"){const r=w0(n.doc,n.type,e.anchor,n.mapping);t.setSelection(J.create(t.doc,r))}else{const r=w0(n.doc,n.type,e.anchor,n.mapping),i=w0(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=X.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},gm=(t,e)=>({type:e.selection.jsonID,anchor:C_(e.selection.anchor,t.type,t.mapping),head:C_(e.selection.head,t.type,t.mapping)});class OV{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=fV(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=gm(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(H3&&this._domSelectionInView===null&&(oA(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=Yu.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=Wb(Bb(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(it,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>md(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(e),0,0));n.setMeta(it,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>md(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(n),0,0));if(e){const i=kl(si(e.anchor,0),r.doc.content.size),s=kl(si(e.head,0),r.doc.content.size);r.setSelection(X.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(it,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=hd(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Ft(),i=new ps({gc:!1}),Au(i,n),n=hd(i),Au(i,e),e=hd(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],l=Zn(o,s._item.id.clock);s=o[l].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const l=r.permanentUserData;l&&l.dss.forEach(d=>{oi(o,d,f=>{})});const a=(d,f)=>{const h=d==="added"?l.getUserByClientId(f.client):l.getUserByDeletedId(f);return{user:h,type:d,color:TV(r.colorMapping,r.colors,h)}},u=Jb(s,new Uh(n.ds,e.sv)).map(d=>!d._item.deleted||jf(d._item,e)||jf(d._item,n)?md(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,a):null).filter(d=>d!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(u),0,0));this.prosemirrorView.dispatch(c.setMeta(it,{isChangeOrigin:!0}))},it)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=it.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(l,a)=>this.mapping.delete(a);oi(n,n.deleteSet,l=>{if(l.constructor===ke){const a=l.content.type;a&&this.mapping.delete(a)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(l=>oT(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(s),0,0));MV(o,this.beforeTransactionSelection,this),o=o.setMeta(it,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Kb}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{bm(this.doc,this.type,e,this),this.beforeTransactionSelection=gm(this,this.prosemirrorView.state)},it)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const oT=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof St)return md(t,e,n,r,i,s);throw Vn()}return o},md=(t,e,n,r,i,s)=>{const o=[],l=a=>{if(a instanceof St){const u=oT(a,e,n,r,i,s);u!==null&&o.push(u)}else{const u=a._item.right?.content?.type;u instanceof li&&!u._item.deleted&&u._item.id.client===u.doc.clientID&&(a.applyDelta([{retain:a.length},...u.toDelta()]),u.doc.transact(d=>{u._item.delete(d)}));const c=DV(a,e,n,r,i,s);c!==null&&c.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(l):Jb(t,new Uh(i.ds,r.sv)).forEach(l);try{const a=t.getAttributes(r);r!==void 0&&(jf(t._item,r)?jf(t._item,i)||(a.ychange=s?s("added",t._item.id):{type:"added"}):a.ychange=s?s("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,a,o);return n.mapping.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},it),n.mapping.delete(t),null}},DV=(t,e,n,r,i,s)=>{const o=[],l=t.toDelta(r,i,s);try{for(let a=0;a<l.length;a++){const u=l[a];o.push(e.text(u.insert,BV(u.attributes,e)))}}catch{return t.doc.transact(u=>{t._item.delete(u)},it),null}return o},RV=(t,e)=>{const n=new Kt,r=t.map(i=>({insert:i.text,attributes:aT(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},IV=(t,e)=>{const n=new St(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,Kh(t).map(r=>mm(r,e))),e.mapping.set(n,t),n},mm=(t,e)=>t instanceof Array?RV(t,e):IV(t,e),x_=t=>typeof t=="object"&&t!==null,ey=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],l=e[s];r=s==="ychange"||o===l||x_(o)&&x_(l)&&ey(o,l)}return r},Kh=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},lT=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&z3(r.attributes||{}).length===e[i].marks.length&&Dl(r.attributes,(s,o)=>{const l=ty(o),a=e[i].marks;return ey(s,a.find(u=>u.type.name===l)?.attrs)}))},Iu=(t,e)=>{if(t instanceof St&&!(e instanceof Array)&&ym(t,e)){const n=Kh(e);return t._length===n.length&&ey(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Iu(r,n[i]))}return t instanceof Kt&&e instanceof Array&&lT(t,e)},qf=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),S_=(t,e,n)=>{const r=t.toArray(),i=Kh(e),s=i.length,o=r.length,l=kl(o,s);let a=0,u=0,c=!1;for(;a<l;a++){const d=r[a],f=i[a];if(qf(n.mapping.get(d),f))c=!0;else if(!Iu(d,f))break}for(;a+u<l;u++){const d=r[o-u-1],f=i[s-u-1];if(qf(n.mapping.get(d),f))c=!0;else if(!Iu(d,f))break}return{equalityFactor:a+u,foundMappedChild:c}},LV=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Xn?e+=n.content.str:n.content instanceof Ye&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},PV=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=LV(t),s=e.map(u=>({insert:u.text,attributes:Object.assign({},r,aT(u.marks,n))})),{insert:o,remove:l,index:a}=mV(i,s.map(u=>u.insert).join(""));t.delete(a,l),t.insert(a,o),t.applyDelta(s.map(u=>({retain:u.insert.length,attributes:u.attributes})))},FV=/(.*)(--[a-zA-Z0-9+/=]{8})$/,ty=t=>FV.exec(t)?.[1]??t,BV=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(ty(r),t[r]));return n},aT=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Ir(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${CV(r.toJSON())}`:r.type.name]=r.attrs}}),n},bm=(t,e,n,r)=>{if(e instanceof St&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof St){const d=e.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&e.setAttribute(h,f[h]):e.removeAttribute(h);for(const h in d)f[h]===void 0&&e.removeAttribute(h)}const i=Kh(n),s=i.length,o=e.toArray(),l=o.length,a=kl(s,l);let u=0,c=0;for(;u<a;u++){const d=o[u],f=i[u];if(!qf(r.mapping.get(d),f))if(Iu(d,f))r.mapping.set(d,f);else break}for(;c+u<a;c++){const d=o[l-c-1],f=i[s-c-1];if(!qf(r.mapping.get(d),f))if(Iu(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;l-u-c>0&&s-u-c>0;){const f=o[u],h=i[u],p=o[l-c-1],g=i[s-c-1];if(f instanceof Kt&&h instanceof Array)lT(f,h)||PV(f,h,r),u+=1;else{let b=f instanceof St&&ym(f,h),m=p instanceof St&&ym(p,g);if(b&&m){const E=S_(f,h,r),k=S_(p,g,r);E.foundMappedChild&&!k.foundMappedChild?m=!1:!E.foundMappedChild&&k.foundMappedChild||E.equalityFactor<k.equalityFactor?b=!1:m=!1}b?(bm(t,f,h,r),u+=1):m?(bm(t,p,g,r),c+=1):(r.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[mm(h,r)]),u+=1)}}const d=l-u-c;if(l===1&&s===0&&o[0]instanceof Kt?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(u,u+d).forEach(f=>r.mapping.delete(f)),e.delete(u,d)),u+c<s){const f=[];for(let h=u;h<s-c;h++)f.push(mm(i[h],r));e.insert(u,f)}},it)},ym=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,C_=(t,e,n)=>{if(t===0)return fd(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Kt){if(r._length>=t)return fd(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Tu(r._item===null?null:r._item.id,r._item===null?Sl(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Tu(r._item===null?null:r._item.id,r._item===null?Sl(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Ft();if(t===0&&r.constructor!==Kt&&r!==e)return zV(r._item.parent,r._item)}return fd(e,e._length,e.length===0?-1:0)},zV=(t,e)=>{let n=null,r=null;return t._item===null?r=Sl(t):n=ce(t._item.id.client,t._item.id.clock),new Tu(n,r,e.id)},w0=(t,e,n,r)=>{const i=vA(n,t);if(i===null||i.type!==e&&!Cl(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Kt)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a<s._length&&a<i.index&&l!==null;){if(!l.deleted){const u=l.content.type;a++,u instanceof Kt?o+=u._length:o+=r.get(u).nodeSize}l=l.right}o+=1}for(;s!==e&&s._item!==null;){const l=s._item.parent;if(l._item===null||!l._item.deleted){o+=1;let a=l._first;for(;a!==null;){const u=a.content.type;if(u===s)break;a.deleted||(u instanceof Kt?o+=u._length:o+=r.get(u).nodeSize),a=a.right}}s=l}return o-1};function $V(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Kt)i=r.toDelta().map(o=>{const l={type:"text",text:o.insert};return o.attributes&&(l.marks=Object.keys(o.attributes).map(a=>{const u=o.attributes[a],d={type:ty(a)};return Object.keys(u)&&(d.attrs=u),d})),l});else if(r instanceof St){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const o=r.toArray();o.length&&(i.content=o.map(n).flat())}else Ft();return i};return{type:"doc",content:e.map(n)}}const UV=t=>Xr.getState(t)?.undoManager?.undo()!=null,HV=t=>Xr.getState(t)?.undoManager?.redo()!=null,VV=new Set(["paragraph"]),WV=(t,e)=>!(t instanceof ke)||!(t.content instanceof Qn)||!(t.content.type instanceof li||t.content.type instanceof St&&e.has(t.content.type.nodeName))||t.content.type._length===0,KV=({protectedNodes:t=VV,trackedOrigins:e=[],undoManager:n=null}={})=>new Ae({key:Xr,state:{init:(r,i)=>{const s=it.getState(i),o=n||new Kb(s.type,{trackedOrigins:new Set([it].concat(e)),deleteFilter:l=>WV(l,t),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const l=it.getState(o).binding,a=i.undoManager,u=a.undoStack.length>0,c=a.redoStack.length>0;return l?{undoManager:a,prevSel:gm(l,s),hasUndoOps:u,hasRedoOps:c}:u!==i.hasUndoOps||c!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):i}},view:r=>{const i=it.getState(r.state),s=Xr.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,Xr.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const l=i.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),IW=et.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Xr.getState(e).undoManager.undoStack.length===0?!1:n?UV(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Xr.getState(e).undoManager.redoStack.length===0?!1:n?HV(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=KV(this.options.yUndoOptions),r=n.spec.view;n.spec.view=o=>{const{undoManager:l}=Xr.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=r?r(o):void 0;return{destroy:()=>{const u=l.trackedOrigins.has(l),c=l._observers;l.restore=()=>{u&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=c},a?.destroy&&a.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=NV(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const o=$V(e);if(o.content.length===0)return;this.editor.schema.nodeFromJSON(o).check()}catch(o){return this.editor.emit("contentError",{error:o,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)===null||l===void 0||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new Ae({key:new Le("filterInvalidContent"),filterTransaction:()=>{var o;return this.storage.isDisabled&&((o=e.doc)===null||o===void 0||o.destroy()),!0}})].filter(Boolean)}});export{cW as $,hS as A,tW as B,IW as C,ps as D,et as E,R as F,nW as G,oW as H,lW as I,Qi as J,Qs as K,AW as L,Yn as M,Ke as N,MW as O,Ae as P,TW as Q,rW as R,$ as S,X as T,NW as U,fW as V,iW as W,sW as X,hW as Y,aW as Z,dW as _,aH as a,wW as a0,SW as a1,_W as a2,mW as a3,xW as a4,GV as a5,YV as a6,pM as a7,DW as a8,RW as a9,Le as b,Ea as c,MP as d,pH as e,dS as f,jn as g,D1 as h,QV as i,pW as j,J as k,uW as l,NA as m,eW as n,ot as o,XV as p,Te as q,Nx as r,h8 as s,Eh as t,r8 as u,Ce as v,l4 as w,vW as x,a8 as y,Wu as z};
169
+ `?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&E0(r,this,i,l,o.attributes||{})}else o.retain!==void 0?w_(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&__(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Rt();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function u(){if(l.length>0){const d={};let f=!1;s.forEach((p,g)=>{f=!0,d[g]=p});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const c=()=>{for(;a!==null;){if(vs(a,e)||n!==void 0&&vs(a,n))switch(a.content.constructor){case Xn:{const d=s.get("ychange");e!==void 0&&!vs(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(u(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!vs(a,n)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(u(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),l+=a.content.str;break}case Qn:case gs:{u();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,p)=>{f[p]=h})}i.push(d);break}case Ye:vs(a,e)&&(u(),Fl(s,a.content));break}a=a.right}u()};return e||n?Se(o,d=>{e&&cm(d,e),n&&cm(d,n),c()},"cleanup"):c(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),E0(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!r);E0(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Se(r,i=>{__(i,Wc(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Se(i,s=>{const o=Wc(s,this,e,!1);o.right!==null&&w_(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Se(this.doc,n=>{Wf(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Se(this.doc,r=>{Zb(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Xb(this,e)}getAttributes(){return HA(this)}_write(e){e.writeTypeRef(eV)}}const PH=t=>new li;class k0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Rt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===St||n.constructor===rs)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class rs extends lt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new rs}clone(){const e=new rs;return e.insert(0,this.toArray().map(n=>n instanceof lt?n.clone():n)),e}get length(){return this.doc??Rt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new k0(this,e)}querySelector(e){e=e.toUpperCase();const r=new k0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ii(new k0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Vh(this,e,new QA(this,n,e))}toString(){return FA(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Ou(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Se(this.doc,r=>{$A(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Se(this.doc,r=>{const i=e&&e instanceof lt?e._item:e;Vf(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Mr("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Se(this.doc,r=>{UA(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return PA(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return BA(this,e)}slice(e=0,n=this.length){return LA(this,e,n)}forEach(e){Ou(this,e)}_write(e){e.writeTypeRef(nV)}}const FH=t=>new rs;class St extends rs{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new St(this.nodeName)}clone(){const e=new St(this.nodeName),n=this.getAttributes();return q$(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof lt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];n.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Se(this.doc,n=>{Wf(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Se(this.doc,r=>{Zb(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Xb(this,e)}hasAttribute(e){return VA(this,e)}getAttributes(e){return e?WA(this,e):HA(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return Ou(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(tV),e.writeKey(this.nodeName)}}const BH=t=>new St(t.readKey());class QA extends Zu{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Du extends io{constructor(e){super(),this.hookName=e}_copy(){return new Du(this.hookName)}clone(){const e=new Du(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(rV),e.writeKey(this.hookName)}}const zH=t=>new Du(t.readKey());class Kt extends li{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Kt}clone(){const e=new Kt;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(iV)}}const $H=t=>new Kt;class Wh{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Vn()}mergeWith(e){return!1}write(e,n,r){throw Vn()}integrate(e,n){throw Vn()}}const UH=0;class En extends Wh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),SA(e.doc.store,this)}write(e,n){e.writeInfo(UH),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Bl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Bl(this.content)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const HH=t=>new Bl(t.readBuf());class Al{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Al(this.len)}splice(e){const n=new Al(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Cu(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const VH=t=>new Al(t.readLen()),eT=(t,e)=>new ps({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class zl{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new zl(eT(this.doc.guid,this.opts))}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const WH=t=>new zl(eT(t.readString(),t.readAny()));class gs{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new gs(this.embed)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const KH=t=>new gs(t.readJSON());class Ye{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ye(this.key,this.value)}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const jH=t=>new Ye(t.readKey(),t.readJSON());class Ru{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ru(this.arr)}splice(e){const n=new Ru(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const qH=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Ru(n)},GH=zf("node_env")==="development";class is{constructor(e){this.arr=e,GH&&$3(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new is(this.arr)}splice(e){const n=new is(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const YH=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new is(n)};class Xn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Xn(this.str)}splice(e){const n=new Xn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const JH=t=>new Xn(t.readString()),ZH=[DH,RH,PH,BH,FH,zH,$H],XH=0,QH=1,eV=2,tV=3,nV=4,rV=5,iV=6;class Qn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Qn(this.type._copy())}splice(e){throw Vn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const sV=t=>new Qn(ZH[t.readTypeRef()](t)),pm=(t,e)=>{let n=e,r=0,i;do r>0&&(n=ce(n.client,n.clock+r)),i=Hs(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof ke);return{item:i,diff:r}},Qb=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Kf=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new ke(ce(r,i+n),e,ce(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=ce(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},v_=(t,e)=>vb(t,n=>fo(n.deletions,e)),tT=(t,e,n,r,i,s)=>{const o=t.doc,l=o.store,a=o.clientID,u=e.redone;if(u!==null)return Ht(t,u);let c=e.parent._item,d=null,f;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||tT(t,c,n,r,i,s)===null))return null;for(;c.redone!==null;)c=Ht(t,c.redone)}const h=c===null?e.parent:c.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let m=d;for(;m!==null&&m.parent._item!==c;)m=m.redone===null?null:Ht(t,m.redone);if(m!==null&&m.parent._item===c){d=m;break}d=d.left}for(;f!==null;){let m=f;for(;m!==null&&m.parent._item!==c;)m=m.redone===null?null:Ht(t,m.redone);if(m!==null&&m.parent._item===c){f=m;break}f=f.right}}else if(f=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||fo(r,d.right.id)||v_(s.undoStack,d.right.id)||v_(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Ht(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;const p=We(l,a),g=ce(a,p),b=new ke(g,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=g,Qb(b,!0),b.integrate(t,0),b};class ke extends Wh{constructor(e,n,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?Qw:0}set marker(e){(this.info&h0)>0!==e&&(this.info^=h0)}get marker(){return(this.info&h0)>0}get keep(){return(this.info&Xw)>0}set keep(e){this.keep!==e&&(this.info^=Xw)}get countable(){return(this.info&Qw)>0}get deleted(){return(this.info&f0)>0}set deleted(e){this.deleted!==e&&(this.info^=f0)}markDeleted(){this.info|=f0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=We(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=We(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Us&&this.id.client!==this.parent.client&&this.parent.clock>=We(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=fm(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Ht(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===En||this.right&&this.right.constructor===En)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ke?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ke&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Us){const r=Hs(n,this.parent);r.constructor===En?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=fm(e,e.doc.store,ce(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),aa(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(aa(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Hs(e.doc.store,i.origin)))s.has(Hs(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),SA(e.doc.store,this),this.content.integrate(e,this),m_(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new En(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ce(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&aa(e.origin,this.lastId)&&this.right===e&&aa(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Cu(e.deleteSet,this.id.client,this.id.clock,this.length),m_(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Ft();this.content.gc(e),n?EH(e,this,new En(this.id,this.length)):this.content=new Al(this.length)}write(e,n){const r=n>0?ce(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Rh|(r===null?0:Wt)|(i===null?0:Zr)|(s===null?0:ku);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const u=Sl(l);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===Us?(e.writeParentInfo(!1),e.writeLeftID(l)):Ft();s!==null&&e.writeString(s)}this.content.write(e,n)}}const nT=(t,e)=>oV[e&Rh](t),oV=[()=>{Ft()},VH,qH,HH,JH,KH,jH,sV,YH,WH,()=>{Ft()}],lV=10;class kn extends Wh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Ft()}write(e,n){e.writeInfo(lV),ue(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const rT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},iT="__ $YJS$ __";rT[iT]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");rT[iT]=!0;const DW=Object.freeze(Object.defineProperty({__proto__:null,AbsolutePosition:_A,AbstractStruct:Wh,AbstractType:lt,Array:Vs,ContentAny:is,ContentBinary:Bl,ContentDeleted:Al,ContentDoc:zl,ContentEmbed:gs,ContentFormat:Ye,ContentJSON:Ru,ContentString:Xn,ContentType:Qn,Doc:ps,GC:En,ID:Us,Item:ke,Map:io,RelativePosition:Tu,Skip:kn,Snapshot:Uh,Text:li,Transaction:AA,UndoManager:Kb,UpdateDecoderV1:Ub,UpdateDecoderV2:ro,UpdateEncoderV1:Pl,UpdateEncoderV2:ns,XmlElement:St,XmlFragment:rs,XmlHook:Du,XmlText:Kt,YArrayEvent:KA,YEvent:Zu,YMapEvent:jA,YTextEvent:XA,YXmlEvent:QA,applyUpdate:aH,applyUpdateV2:Au,cleanupYTextFormatting:ZA,compareIDs:aa,convertUpdateFormatV2ToV1:DA,createAbsolutePositionFromRelativePosition:vA,createDeleteSet:Bb,createDeleteSetFromStructStore:zb,createID:ce,createRelativePositionFromTypeIndex:fd,createSnapshot:Wb,decodeStateVector:Vb,diffUpdateV2:MA,encodeStateAsUpdate:cH,encodeStateAsUpdateV2:EA,encodeStateVector:pH,findIndexSS:Zn,findRootTypeKey:Sl,getItem:Hs,getItemCleanEnd:fm,getItemCleanStart:Ht,getState:We,isDeleted:fo,isParentOf:Cl,iterateDeletedStructs:oi,mergeDeleteSets:Hf,mergeUpdates:NA,mergeUpdatesV2:Nu,readUpdateV2:yA,snapshot:hd,transact:Se,typeListToArraySnapshot:Jb,typeMapGetAllSnapshot:WA},Symbol.toStringTag,{value:"Module"})),gd=3e4;class aV extends s${constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=vu();this.getLocalState()!==null&&gd/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&gd<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&sT(this,r,"timeout")},Jn(gd/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:vu()});const o=[],l=[],a=[],u=[];e===null?u.push(n):s==null?e!=null&&o.push(n):(l.push(n),Zo(s,e)||a.push(n)),(o.length>0||a.length>0||u.length>0)&&this.emit("change",[{added:o,updated:a,removed:u},"local"]),this.emit("update",[{added:o,updated:l,removed:u},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const sT=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const o=t.meta.get(s);t.meta.set(s,{clock:o.clock+1,lastUpdated:vu()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},uV=(t,e,n=t.states)=>{const r=e.length,i=co();ue(i,r);for(let s=0;s<r;s++){const o=e[s],l=n.get(o)||null,a=t.meta.get(o).clock;ue(i,o),ue(i,a),Gi(i,JSON.stringify(l))}return _n(i)},cV=(t,e)=>{const n=hs(t),r=co(),i=le(n);ue(r,i);for(let s=0;s<i;s++){const o=le(n),l=le(n),a=JSON.parse(Yi(n)),u=e(a);ue(r,o),ue(r,l),Gi(r,JSON.stringify(u))}return _n(r)},dV=(t,e,n)=>{const r=hs(e),i=vu(),s=[],o=[],l=[],a=[],u=le(r);for(let c=0;c<u;c++){const d=le(r);let f=le(r);const h=JSON.parse(Yi(r)),p=t.meta.get(d),g=t.states.get(d),b=p===void 0?0:p.clock;(b<f||b===f&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?f++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:f,lastUpdated:i}),p===void 0&&h!==null?s.push(d):p!==void 0&&h===null?a.push(d):h!==null&&(Zo(h,g)||l.push(d),o.push(d)))}(s.length>0||l.length>0||a.length>0)&&t.emit("change",[{added:s,updated:l,removed:a},n]),(s.length>0||o.length>0||a.length>0)&&t.emit("update",[{added:s,updated:o,removed:a},n])},RW=Object.freeze(Object.defineProperty({__proto__:null,Awareness:aV,applyAwarenessUpdate:dV,encodeAwarenessUpdate:uV,modifyAwarenessUpdate:cV,outdatedTimeout:gd,removeAwarenessStates:sT},Symbol.toStringTag,{value:"Module"})),fV=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},hV=/[\uD800-\uDBFF]/,pV=/[\uDC00-\uDFFF]/,gV=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&hV.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&pV.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},mV=gV,it=new Le("y-sync"),Xr=new Le("y-undo");new Le("yjs-cursor");const Cr=(t,e)=>t>>>e|t<<32-e,bV=t=>Cr(t,2)^Cr(t,13)^Cr(t,22),yV=t=>Cr(t,6)^Cr(t,11)^Cr(t,25),EV=t=>Cr(t,7)^Cr(t,18)^t>>>3,kV=t=>Cr(t,17)^Cr(t,19)^t>>>10,wV=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_V=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class vV{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(_V),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=kV(n[d-2])+n[d-7]+EV(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],l=e[4],a=e[5],u=e[6],c=e[7];for(let d=0,f,h;d<64;d++)f=c+yV(l)+(l&a^~l&u)+wV[d]+n[d]>>>0,h=bV(r)+(r&i^r&s^i&s)>>>0,c=u,u=a,a=l,l=o+f>>>0,o=s,s=i,i=r,r=f+h>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=l,e[5]+=a,e[6]+=u,e[7]+=c}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=Wt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=Wt<<(3-n%4)*8),this._W[14]=e.byteLength/o$,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let l=0;l<4;l++)s[o*4+l]=this._H[o]>>>(3-l)*8;return s}}const xV=t=>new vV().digest(t),SV=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},CV=t=>oU(SV(xV(aU(t)))),jf=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!fo(e.ds,t.id),AV=[{light:"#ecd44433",dark:"#ecd444"}],TV=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=ts();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,z$(e))}return t.get(n)},NV=(t,{colors:e=AV,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const l=new OV(t,s),a=new Ae({props:{editable:u=>{const c=it.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:it,state:{init:(u,c)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const d=u.getMeta(it);if(d!==void 0){c=Object.assign({},c);for(const f in d)c[f]=d[f]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,l.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&oA(0,()=>{l.prosemirrorView!=null&&(d.restore==null?l._renderSnapshot(d.snapshot,d.prevSnapshot,c):(l._renderSnapshot(d.snapshot,d.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),c}},view:u=>(l.initView(u),s==null&&l._forceRerender(),i(),{update:()=>{const c=a.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(o||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(o=!0,c.addToHistory===!1&&!c.isChangeOrigin){const d=Xr.getState(u.state),f=d&&d.undoManager;f&&f.stopCapturing()}l.mux(()=>{c.doc.transact(d=>{d.meta.set("addToHistory",c.addToHistory),l._prosemirrorChanged(u.state.doc)},it)})}},destroy:()=>{l.destroy()}})});return a},MV=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new on(t.doc));else if(e.type==="node"){const r=w0(n.doc,n.type,e.anchor,n.mapping);t.setSelection(J.create(t.doc,r))}else{const r=w0(n.doc,n.type,e.anchor,n.mapping),i=w0(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=X.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},gm=(t,e)=>({type:e.selection.jsonID,anchor:C_(e.selection.anchor,t.type,t.mapping),head:C_(e.selection.head,t.type,t.mapping)});class OV{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=fV(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=gm(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(H3&&this._domSelectionInView===null&&(oA(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=Yu.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=Wb(Bb(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(it,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>md(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(e),0,0));n.setMeta(it,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>md(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(n),0,0));if(e){const i=kl(si(e.anchor,0),r.doc.content.size),s=kl(si(e.head,0),r.doc.content.size);r.setSelection(X.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(it,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=hd(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Ft(),i=new ps({gc:!1}),Au(i,n),n=hd(i),Au(i,e),e=hd(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],l=Zn(o,s._item.id.clock);s=o[l].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const l=r.permanentUserData;l&&l.dss.forEach(d=>{oi(o,d,f=>{})});const a=(d,f)=>{const h=d==="added"?l.getUserByClientId(f.client):l.getUserByDeletedId(f);return{user:h,type:d,color:TV(r.colorMapping,r.colors,h)}},u=Jb(s,new Uh(n.ds,e.sv)).map(d=>!d._item.deleted||jf(d._item,e)||jf(d._item,n)?md(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,a):null).filter(d=>d!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(u),0,0));this.prosemirrorView.dispatch(c.setMeta(it,{isChangeOrigin:!0}))},it)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=it.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(l,a)=>this.mapping.delete(a);oi(n,n.deleteSet,l=>{if(l.constructor===ke){const a=l.content.type;a&&this.mapping.delete(a)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(l=>oT(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new $(R.from(s),0,0));MV(o,this.beforeTransactionSelection,this),o=o.setMeta(it,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Kb}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{bm(this.doc,this.type,e,this),this.beforeTransactionSelection=gm(this,this.prosemirrorView.state)},it)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const oT=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof St)return md(t,e,n,r,i,s);throw Vn()}return o},md=(t,e,n,r,i,s)=>{const o=[],l=a=>{if(a instanceof St){const u=oT(a,e,n,r,i,s);u!==null&&o.push(u)}else{const u=a._item.right?.content?.type;u instanceof li&&!u._item.deleted&&u._item.id.client===u.doc.clientID&&(a.applyDelta([{retain:a.length},...u.toDelta()]),u.doc.transact(d=>{u._item.delete(d)}));const c=DV(a,e,n,r,i,s);c!==null&&c.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(l):Jb(t,new Uh(i.ds,r.sv)).forEach(l);try{const a=t.getAttributes(r);r!==void 0&&(jf(t._item,r)?jf(t._item,i)||(a.ychange=s?s("added",t._item.id):{type:"added"}):a.ychange=s?s("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,a,o);return n.mapping.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},it),n.mapping.delete(t),null}},DV=(t,e,n,r,i,s)=>{const o=[],l=t.toDelta(r,i,s);try{for(let a=0;a<l.length;a++){const u=l[a];o.push(e.text(u.insert,BV(u.attributes,e)))}}catch{return t.doc.transact(u=>{t._item.delete(u)},it),null}return o},RV=(t,e)=>{const n=new Kt,r=t.map(i=>({insert:i.text,attributes:aT(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},IV=(t,e)=>{const n=new St(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,Kh(t).map(r=>mm(r,e))),e.mapping.set(n,t),n},mm=(t,e)=>t instanceof Array?RV(t,e):IV(t,e),x_=t=>typeof t=="object"&&t!==null,ey=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],l=e[s];r=s==="ychange"||o===l||x_(o)&&x_(l)&&ey(o,l)}return r},Kh=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},lT=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&z3(r.attributes||{}).length===e[i].marks.length&&Dl(r.attributes,(s,o)=>{const l=ty(o),a=e[i].marks;return ey(s,a.find(u=>u.type.name===l)?.attrs)}))},Iu=(t,e)=>{if(t instanceof St&&!(e instanceof Array)&&ym(t,e)){const n=Kh(e);return t._length===n.length&&ey(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Iu(r,n[i]))}return t instanceof Kt&&e instanceof Array&&lT(t,e)},qf=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),S_=(t,e,n)=>{const r=t.toArray(),i=Kh(e),s=i.length,o=r.length,l=kl(o,s);let a=0,u=0,c=!1;for(;a<l;a++){const d=r[a],f=i[a];if(qf(n.mapping.get(d),f))c=!0;else if(!Iu(d,f))break}for(;a+u<l;u++){const d=r[o-u-1],f=i[s-u-1];if(qf(n.mapping.get(d),f))c=!0;else if(!Iu(d,f))break}return{equalityFactor:a+u,foundMappedChild:c}},LV=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Xn?e+=n.content.str:n.content instanceof Ye&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},PV=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=LV(t),s=e.map(u=>({insert:u.text,attributes:Object.assign({},r,aT(u.marks,n))})),{insert:o,remove:l,index:a}=mV(i,s.map(u=>u.insert).join(""));t.delete(a,l),t.insert(a,o),t.applyDelta(s.map(u=>({retain:u.insert.length,attributes:u.attributes})))},FV=/(.*)(--[a-zA-Z0-9+/=]{8})$/,ty=t=>FV.exec(t)?.[1]??t,BV=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(ty(r),t[r]));return n},aT=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Ir(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${CV(r.toJSON())}`:r.type.name]=r.attrs}}),n},bm=(t,e,n,r)=>{if(e instanceof St&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof St){const d=e.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&e.setAttribute(h,f[h]):e.removeAttribute(h);for(const h in d)f[h]===void 0&&e.removeAttribute(h)}const i=Kh(n),s=i.length,o=e.toArray(),l=o.length,a=kl(s,l);let u=0,c=0;for(;u<a;u++){const d=o[u],f=i[u];if(!qf(r.mapping.get(d),f))if(Iu(d,f))r.mapping.set(d,f);else break}for(;c+u<a;c++){const d=o[l-c-1],f=i[s-c-1];if(!qf(r.mapping.get(d),f))if(Iu(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;l-u-c>0&&s-u-c>0;){const f=o[u],h=i[u],p=o[l-c-1],g=i[s-c-1];if(f instanceof Kt&&h instanceof Array)lT(f,h)||PV(f,h,r),u+=1;else{let b=f instanceof St&&ym(f,h),m=p instanceof St&&ym(p,g);if(b&&m){const E=S_(f,h,r),k=S_(p,g,r);E.foundMappedChild&&!k.foundMappedChild?m=!1:!E.foundMappedChild&&k.foundMappedChild||E.equalityFactor<k.equalityFactor?b=!1:m=!1}b?(bm(t,f,h,r),u+=1):m?(bm(t,p,g,r),c+=1):(r.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[mm(h,r)]),u+=1)}}const d=l-u-c;if(l===1&&s===0&&o[0]instanceof Kt?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(u,u+d).forEach(f=>r.mapping.delete(f)),e.delete(u,d)),u+c<s){const f=[];for(let h=u;h<s-c;h++)f.push(mm(i[h],r));e.insert(u,f)}},it)},ym=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,C_=(t,e,n)=>{if(t===0)return fd(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Kt){if(r._length>=t)return fd(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Tu(r._item===null?null:r._item.id,r._item===null?Sl(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Tu(r._item===null?null:r._item.id,r._item===null?Sl(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Ft();if(t===0&&r.constructor!==Kt&&r!==e)return zV(r._item.parent,r._item)}return fd(e,e._length,e.length===0?-1:0)},zV=(t,e)=>{let n=null,r=null;return t._item===null?r=Sl(t):n=ce(t._item.id.client,t._item.id.clock),new Tu(n,r,e.id)},w0=(t,e,n,r)=>{const i=vA(n,t);if(i===null||i.type!==e&&!Cl(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Kt)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a<s._length&&a<i.index&&l!==null;){if(!l.deleted){const u=l.content.type;a++,u instanceof Kt?o+=u._length:o+=r.get(u).nodeSize}l=l.right}o+=1}for(;s!==e&&s._item!==null;){const l=s._item.parent;if(l._item===null||!l._item.deleted){o+=1;let a=l._first;for(;a!==null;){const u=a.content.type;if(u===s)break;a.deleted||(u instanceof Kt?o+=u._length:o+=r.get(u).nodeSize),a=a.right}}s=l}return o-1};function $V(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Kt)i=r.toDelta().map(o=>{const l={type:"text",text:o.insert};return o.attributes&&(l.marks=Object.keys(o.attributes).map(a=>{const u=o.attributes[a],d={type:ty(a)};return Object.keys(u)&&(d.attrs=u),d})),l});else if(r instanceof St){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const o=r.toArray();o.length&&(i.content=o.map(n).flat())}else Ft();return i};return{type:"doc",content:e.map(n)}}const UV=t=>Xr.getState(t)?.undoManager?.undo()!=null,HV=t=>Xr.getState(t)?.undoManager?.redo()!=null,VV=new Set(["paragraph"]),WV=(t,e)=>!(t instanceof ke)||!(t.content instanceof Qn)||!(t.content.type instanceof li||t.content.type instanceof St&&e.has(t.content.type.nodeName))||t.content.type._length===0,KV=({protectedNodes:t=VV,trackedOrigins:e=[],undoManager:n=null}={})=>new Ae({key:Xr,state:{init:(r,i)=>{const s=it.getState(i),o=n||new Kb(s.type,{trackedOrigins:new Set([it].concat(e)),deleteFilter:l=>WV(l,t),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const l=it.getState(o).binding,a=i.undoManager,u=a.undoStack.length>0,c=a.redoStack.length>0;return l?{undoManager:a,prevSel:gm(l,s),hasUndoOps:u,hasRedoOps:c}:u!==i.hasUndoOps||c!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):i}},view:r=>{const i=it.getState(r.state),s=Xr.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,Xr.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const l=i.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),IW=et.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Xr.getState(e).undoManager.undoStack.length===0?!1:n?UV(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Xr.getState(e).undoManager.redoStack.length===0?!1:n?HV(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=KV(this.options.yUndoOptions),r=n.spec.view;n.spec.view=o=>{const{undoManager:l}=Xr.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=r?r(o):void 0;return{destroy:()=>{const u=l.trackedOrigins.has(l),c=l._observers;l.restore=()=>{u&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=c},a?.destroy&&a.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=NV(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const o=$V(e);if(o.content.length===0)return;this.editor.schema.nodeFromJSON(o).check()}catch(o){return this.editor.emit("contentError",{error:o,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)===null||l===void 0||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new Ae({key:new Le("filterInvalidContent"),filterTransaction:()=>{var o;return this.storage.isDisabled&&((o=e.doc)===null||o===void 0||o.destroy()),!0}})].filter(Boolean)}});export{cW as $,hS as A,tW as B,IW as C,ps as D,et as E,R as F,nW as G,oW as H,lW as I,Qi as J,Qs as K,AW as L,Yn as M,Ke as N,MW as O,Ae as P,TW as Q,a8 as R,$ as S,X as T,NW as U,fW as V,iW as W,sW as X,hW as Y,aW as Z,dW as _,aH as a,wW as a0,SW as a1,_W as a2,mW as a3,xW as a4,GV as a5,YV as a6,pM as a7,DW as a8,RW as a9,Le as b,Ea as c,MP as d,pH as e,dS as f,jn as g,D1 as h,QV as i,pW as j,J as k,eW as l,NA as m,vW as n,uW as o,XV as p,ot as q,Nx as r,Te as s,Wu as t,r8 as u,h8 as v,Eh as w,Ce as x,l4 as y,rW as z};