visual-living-plan 0.1.0 → 2.32.1

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 (608) hide show
  1. package/DESIGN.md +213 -0
  2. package/README.md +155 -28
  3. package/dist/AuthScreen.d.ts +9 -0
  4. package/dist/AuthScreen.js +7 -0
  5. package/dist/DesktopModeSwitch.d.ts +13 -0
  6. package/dist/DesktopModeSwitch.js +14 -0
  7. package/dist/OAuthMark.d.ts +6 -0
  8. package/dist/OAuthMark.js +8 -0
  9. package/dist/accountInitials.d.ts +5 -0
  10. package/dist/accountInitials.js +20 -0
  11. package/dist/accountLinking.d.ts +26 -0
  12. package/dist/accountLinking.js +46 -0
  13. package/dist/agentEvents.d.ts +31 -0
  14. package/dist/agentEvents.js +260 -0
  15. package/dist/agentPresence.d.ts +42 -0
  16. package/dist/agentPresence.js +69 -0
  17. package/dist/agentSkills.d.ts +35 -0
  18. package/dist/agentSkills.js +89 -0
  19. package/dist/agentStream.d.ts +35 -0
  20. package/dist/agentStream.js +133 -0
  21. package/dist/appearanceDom.d.ts +13 -0
  22. package/dist/appearanceDom.js +24 -0
  23. package/dist/appearanceSettings.d.ts +29 -0
  24. package/dist/appearanceSettings.js +293 -0
  25. package/dist/assets.d.ts +14 -0
  26. package/dist/assets.js +72 -0
  27. package/dist/authSearch.d.ts +11 -0
  28. package/dist/authSearch.js +30 -0
  29. package/dist/changelog.d.ts +11 -0
  30. package/dist/changelog.js +63 -0
  31. package/dist/changelogParse.d.ts +53 -0
  32. package/dist/changelogParse.js +226 -0
  33. package/dist/cli.d.ts +2 -0
  34. package/dist/cli.js +1684 -0
  35. package/dist/cliLauncher.d.ts +40 -0
  36. package/dist/cliLauncher.js +170 -0
  37. package/dist/cliToken.d.ts +11 -0
  38. package/dist/cliToken.js +15 -0
  39. package/dist/client/.vite/manifest.json +1780 -0
  40. package/dist/client/assets/BarChart-DtV3dIq4.js +1 -0
  41. package/dist/client/assets/BlockEditor-BklSUBjk.js +168 -0
  42. package/dist/client/assets/BlockEditor-K5h6xc4_.css +1 -0
  43. package/dist/client/assets/CodeBlock-BbI08MlQ.js +1 -0
  44. package/dist/client/assets/CodeBlock-BxRMnldw.js +175 -0
  45. package/dist/client/assets/LineChart-CQYMEbD6.js +1 -0
  46. package/dist/client/assets/Mermaid-Ciu9eIoG.js +1 -0
  47. package/dist/client/assets/Mermaid-jPWLXX7e.js +1 -0
  48. package/dist/client/assets/Popover-DbE4vUPG.js +1 -0
  49. package/dist/client/assets/ReactFlowExecutionCanvas-BhVs-adc.js +7 -0
  50. package/dist/client/assets/ReactFlowExecutionCanvas-DLioOiRN.css +1 -0
  51. package/dist/client/assets/StatusIcon-C_-Lm9b4.js +1 -0
  52. package/dist/client/assets/Workflow-C92OpLyf.js +1 -0
  53. package/dist/client/assets/agentPresence-D8asHrTp.js +1 -0
  54. package/dist/client/assets/andromeeda-DW8vo71h.js +1 -0
  55. package/dist/client/assets/andromeeda-vGVdxbeo.js +1 -0
  56. package/dist/client/assets/arrow-up-CEVVOXD5.js +1 -0
  57. package/dist/client/assets/arrow-up-down-BSjnQK2I.js +1 -0
  58. package/dist/client/assets/aurora-x-CDeNXAV0.js +1 -0
  59. package/dist/client/assets/aurora-x-rMvKqtYI.js +1 -0
  60. package/dist/client/assets/ayu-dark-CwczpL8O.js +1 -0
  61. package/dist/client/assets/ayu-dark-DluEY0Gj.js +1 -0
  62. package/dist/client/assets/ayu-light-C3h-C4tm.js +1 -0
  63. package/dist/client/assets/ayu-light-DSh22xiD.js +1 -0
  64. package/dist/client/assets/ayu-mirage-Bqwy1Gya.js +1 -0
  65. package/dist/client/assets/ayu-mirage-JE6hAyHG.js +1 -0
  66. package/dist/client/assets/browserStore-BDGKYoJj.js +435 -0
  67. package/dist/client/assets/button-BI07wqbi.css +1 -0
  68. package/dist/client/assets/button-DJWAGApe.js +1 -0
  69. package/dist/client/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
  70. package/dist/client/assets/catppuccin-frappe-pyXErRRU.js +1 -0
  71. package/dist/client/assets/catppuccin-latte-BILSUICr.js +1 -0
  72. package/dist/client/assets/catppuccin-latte-CtsyrtPq.js +1 -0
  73. package/dist/client/assets/catppuccin-macchiato-Ck60ZZQE.js +1 -0
  74. package/dist/client/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
  75. package/dist/client/assets/catppuccin-mocha-C_2G67cS.js +1 -0
  76. package/dist/client/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
  77. package/dist/client/assets/ccount-nzzEXTrh.js +1 -0
  78. package/dist/client/assets/chartRows-CNjjLsAH.js +2 -0
  79. package/dist/client/assets/circle-x-BLGxA3gi.js +1 -0
  80. package/dist/client/assets/client-BsE_buVT.js +9 -0
  81. package/dist/client/assets/constants-CmGPilXJ.js +1 -0
  82. package/dist/client/assets/dark-plus-CHgc6GYj.js +1 -0
  83. package/dist/client/assets/dark-plus-Cs2F2srj.js +1 -0
  84. package/dist/client/assets/default-5FplaXL4.js +7 -0
  85. package/dist/client/assets/diffsTheme-PJJTu2Rq.js +1 -0
  86. package/dist/client/assets/dracula-BHWKrbxM.js +1 -0
  87. package/dist/client/assets/dracula-Cf1PG3MT.js +1 -0
  88. package/dist/client/assets/dracula-soft-5eyTD99u.js +1 -0
  89. package/dist/client/assets/dracula-soft-DXuNm1Kq.js +1 -0
  90. package/dist/client/assets/editSource-DQfw4nRm.js +1 -0
  91. package/dist/client/assets/editSource-U5AoD-Wo.js +14 -0
  92. package/dist/client/assets/engine-CLTPZlti.js +1 -0
  93. package/dist/client/assets/engine-DUyaiAMV.js +2 -0
  94. package/dist/client/assets/everforest-dark-CjdfwUBe.js +1 -0
  95. package/dist/client/assets/everforest-dark-sB-x3p7T.js +1 -0
  96. package/dist/client/assets/everforest-light-CfVwwCBP.js +1 -0
  97. package/dist/client/assets/everforest-light-Df2xbC6M.js +1 -0
  98. package/dist/client/assets/forgetDocuments-CIUBitCs.js +1 -0
  99. package/dist/client/assets/formatCSSVariablePrefix-KRh9vnZf.js +1 -0
  100. package/dist/client/assets/github-dark-BL6HSl_n.js +1 -0
  101. package/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
  102. package/dist/client/assets/github-dark-default-DXG-b-1a.js +1 -0
  103. package/dist/client/assets/github-dark-default-zacuWV-M.js +1 -0
  104. package/dist/client/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
  105. package/dist/client/assets/github-dark-dimmed-Mc0P9idi.js +1 -0
  106. package/dist/client/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
  107. package/dist/client/assets/github-dark-high-contrast-IMKX2AVF.js +1 -0
  108. package/dist/client/assets/github-light-EUqPIrTm.js +1 -0
  109. package/dist/client/assets/github-light-default-BXViO-2h.js +1 -0
  110. package/dist/client/assets/github-light-default-DVlCqP3X.js +1 -0
  111. package/dist/client/assets/github-light-high-contrast-B68TUdTA.js +1 -0
  112. package/dist/client/assets/github-light-high-contrast-Dj6zTyWR.js +1 -0
  113. package/dist/client/assets/github-light-mYhEBkPo.js +1 -0
  114. package/dist/client/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
  115. package/dist/client/assets/gruvbox-dark-hard-QTgQQZn-.js +1 -0
  116. package/dist/client/assets/gruvbox-dark-medium-9d5YdCTx.js +1 -0
  117. package/dist/client/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
  118. package/dist/client/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  119. package/dist/client/assets/gruvbox-dark-soft-XCkqeBhR.js +1 -0
  120. package/dist/client/assets/gruvbox-light-hard--5-nXqNp.js +1 -0
  121. package/dist/client/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
  122. package/dist/client/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
  123. package/dist/client/assets/gruvbox-light-medium-COA1PZW2.js +1 -0
  124. package/dist/client/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
  125. package/dist/client/assets/gruvbox-light-soft-CIJpzjAO.js +1 -0
  126. package/dist/client/assets/hastToHtml-Dj8rXue9.js +11 -0
  127. package/dist/client/assets/highlight-cB-PkhyE.js +1 -0
  128. package/dist/client/assets/highlights-LLBF1DTm.js +1 -0
  129. package/dist/client/assets/horizon-Ba2cwkSy.js +1 -0
  130. package/dist/client/assets/horizon-CE9ld1lL.js +1 -0
  131. package/dist/client/assets/horizon-bright-DSNQnXHK.js +1 -0
  132. package/dist/client/assets/horizon-bright-DaEDgBmR.js +1 -0
  133. package/dist/client/assets/houston-B6x0XVpU.js +1 -0
  134. package/dist/client/assets/houston-CsvMBhTu.js +1 -0
  135. package/dist/client/assets/jsx-runtime-DKj5X9O4.js +1 -0
  136. package/dist/client/assets/kanagawa-dragon-Bozd7klA.js +1 -0
  137. package/dist/client/assets/kanagawa-dragon-DhTFvBMT.js +1 -0
  138. package/dist/client/assets/kanagawa-lotus--m8sdOxn.js +1 -0
  139. package/dist/client/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
  140. package/dist/client/assets/kanagawa-wave-BML5mF2J.js +1 -0
  141. package/dist/client/assets/kanagawa-wave-D-tTv4k2.js +1 -0
  142. package/dist/client/assets/laserwave-C_8bwKvT.js +1 -0
  143. package/dist/client/assets/laserwave-HSLx0L75.js +1 -0
  144. package/dist/client/assets/lib-COgu-QLX.js +33 -0
  145. package/dist/client/assets/lib-CdRiGVUZ.js +1 -0
  146. package/dist/client/assets/light-plus-CUjWrTSi.js +1 -0
  147. package/dist/client/assets/light-plus-DVQuIRkW.js +1 -0
  148. package/dist/client/assets/loader-CjL04K29.js +1 -0
  149. package/dist/client/assets/main-BGMX_GnZ.js +2 -0
  150. package/dist/client/assets/main-BTko4EvJ.css +1 -0
  151. package/dist/client/assets/material-theme-Bm3Qr25_.js +1 -0
  152. package/dist/client/assets/material-theme-CnthUGfg.js +1 -0
  153. package/dist/client/assets/material-theme-darker-2IIEA8gg.js +1 -0
  154. package/dist/client/assets/material-theme-darker-DUi03Qre.js +1 -0
  155. package/dist/client/assets/material-theme-lighter-D2-qr5Vw.js +1 -0
  156. package/dist/client/assets/material-theme-lighter-uhdI0v04.js +1 -0
  157. package/dist/client/assets/material-theme-ocean-CHQ94UKr.js +1 -0
  158. package/dist/client/assets/material-theme-ocean-CWR-LogA.js +1 -0
  159. package/dist/client/assets/material-theme-palenight-B5W6OYN7.js +1 -0
  160. package/dist/client/assets/material-theme-palenight-Cnv8m1ra.js +1 -0
  161. package/dist/client/assets/mdxEntries-BNTMP8ct.css +1 -0
  162. package/dist/client/assets/mdxEntries-L-V7bB6i.js +1 -0
  163. package/dist/client/assets/mermaid-Bjhs-krb.js +1 -0
  164. package/dist/client/assets/mermaid-Di4j-zgD.js +146 -0
  165. package/dist/client/assets/min-dark-BSWPekZh.js +1 -0
  166. package/dist/client/assets/min-dark-EXoM-6Xo.js +1 -0
  167. package/dist/client/assets/min-light-DDpmG2fV.js +1 -0
  168. package/dist/client/assets/min-light-DVOTDhnA.js +1 -0
  169. package/dist/client/assets/monokai-BscAjiQZ.js +1 -0
  170. package/dist/client/assets/monokai-DkggTbGy.js +1 -0
  171. package/dist/client/assets/mountChrome-BVWpsDCy.js +122 -0
  172. package/dist/client/assets/mountChrome-DhTDH3YM.css +1 -0
  173. package/dist/client/assets/night-owl-Bdcs0PMi.js +1 -0
  174. package/dist/client/assets/night-owl-DhmEMT88.js +1 -0
  175. package/dist/client/assets/night-owl-light-RoU30LE0.js +1 -0
  176. package/dist/client/assets/night-owl-light-eJ-hLW7d.js +1 -0
  177. package/dist/client/assets/noShiki-DB8hQ_W3.js +1 -0
  178. package/dist/client/assets/noShiki-GTG3tT8x.js +1 -0
  179. package/dist/client/assets/nord-Cb4Vim4T.js +1 -0
  180. package/dist/client/assets/nord-u7hMircQ.js +1 -0
  181. package/dist/client/assets/offlineSync-Cv3FVIlJ.js +1 -0
  182. package/dist/client/assets/one-dark-pro-08PdtLzi.js +1 -0
  183. package/dist/client/assets/one-dark-pro-C6YyR8OD.js +1 -0
  184. package/dist/client/assets/one-light-D7Lr4KcI.js +1 -0
  185. package/dist/client/assets/one-light-DgvUEtgI.js +1 -0
  186. package/dist/client/assets/opfs-worker-DuTOCgWR.js +5919 -0
  187. package/dist/client/assets/pierre-dark-B2jZWvHG.js +1 -0
  188. package/dist/client/assets/pierre-dark-CpLgRqie.js +1 -0
  189. package/dist/client/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
  190. package/dist/client/assets/pierre-dark-protanopia-deuteranopia-CebgQdRf.js +1 -0
  191. package/dist/client/assets/pierre-dark-soft-DdE7dyP3.js +1 -0
  192. package/dist/client/assets/pierre-dark-soft-kZQmAZld.js +1 -0
  193. package/dist/client/assets/pierre-dark-tritanopia-CXimiT7X.js +1 -0
  194. package/dist/client/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
  195. package/dist/client/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
  196. package/dist/client/assets/pierre-dark-vibrant-DzBsxHvQ.js +1 -0
  197. package/dist/client/assets/pierre-light-CoaEpmwp.js +1 -0
  198. package/dist/client/assets/pierre-light-Vf__O3ev.js +1 -0
  199. package/dist/client/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
  200. package/dist/client/assets/pierre-light-protanopia-deuteranopia-BUtWcCQC.js +1 -0
  201. package/dist/client/assets/pierre-light-soft-C3QCXKvN.js +1 -0
  202. package/dist/client/assets/pierre-light-soft-lWLdNTOI.js +1 -0
  203. package/dist/client/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
  204. package/dist/client/assets/pierre-light-tritanopia-CKLy6XvA.js +1 -0
  205. package/dist/client/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
  206. package/dist/client/assets/pierre-light-vibrant-DDuTEIhH.js +1 -0
  207. package/dist/client/assets/planEditButton-CbWGczbi.js +45 -0
  208. package/dist/client/assets/planEvents-cuzv9ELr.js +1 -0
  209. package/dist/client/assets/planMdx-Db1ze_nN.js +110 -0
  210. package/dist/client/assets/plastic-B8mE6BxX.js +1 -0
  211. package/dist/client/assets/plastic-DQwYfKfQ.js +1 -0
  212. package/dist/client/assets/poimandres-DRFjx7u4.js +1 -0
  213. package/dist/client/assets/poimandres-DUFjrgxT.js +1 -0
  214. package/dist/client/assets/preload-helper-Dx0-lKy1.js +1 -0
  215. package/dist/client/assets/queryClient-Bs5tSUJh.js +1 -0
  216. package/dist/client/assets/react-dom-DpzJPrWF.js +1 -0
  217. package/dist/client/assets/rebaseDraft-B2--cj1c.js +19 -0
  218. package/dist/client/assets/red-BJvdDEUx.js +1 -0
  219. package/dist/client/assets/red-CYlAq2b0.js +1 -0
  220. package/dist/client/assets/register-hZEIk3A9.css +1 -0
  221. package/dist/client/assets/register-htm5s8o9.js +1 -0
  222. package/dist/client/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  223. package/dist/client/assets/rose-pine-BSqRqUae.js +1 -0
  224. package/dist/client/assets/rose-pine-aMsaMD1D.js +1 -0
  225. package/dist/client/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
  226. package/dist/client/assets/rose-pine-dawn-U6TBE82u.js +1 -0
  227. package/dist/client/assets/rose-pine-moon-CAU7u1h4.js +1 -0
  228. package/dist/client/assets/rose-pine-moon-DO-qXg-I.js +1 -0
  229. package/dist/client/assets/routeEdges-B2z8v0di.js +24 -0
  230. package/dist/client/assets/selector-CDsXW7SO.css +1 -0
  231. package/dist/client/assets/selector-tlBGWtQl.js +1 -0
  232. package/dist/client/assets/settingsChrome-NGUDtEIp.js +1 -0
  233. package/dist/client/assets/shiki-BOXJeUHI.js +2 -0
  234. package/dist/client/assets/slack-dark-CMu0smFa.js +1 -0
  235. package/dist/client/assets/slack-dark-DnToyrRv.js +1 -0
  236. package/dist/client/assets/slack-ochin-B2OO5cIa.js +1 -0
  237. package/dist/client/assets/slack-ochin-BBne7cjw.js +1 -0
  238. package/dist/client/assets/snazzy-light-4G7pJPwS.js +1 -0
  239. package/dist/client/assets/snazzy-light-CV8HUEmk.js +1 -0
  240. package/dist/client/assets/solarized-dark-CmYmhSgI.js +1 -0
  241. package/dist/client/assets/solarized-dark-b97czJOk.js +1 -0
  242. package/dist/client/assets/solarized-light-CjLLwxRp.js +1 -0
  243. package/dist/client/assets/solarized-light-DFPxpIYQ.js +1 -0
  244. package/dist/client/assets/stampPlanParts-DVXYCykw.js +15 -0
  245. package/dist/client/assets/stampPlanParts-ctZzxWdw.css +1 -0
  246. package/dist/client/assets/stream-tokenizer-C3n8hi1h.js +4 -0
  247. package/dist/client/assets/synthwave-84-nFMaYfgc.js +1 -0
  248. package/dist/client/assets/synthwave-84-wQeDKbzQ.js +1 -0
  249. package/dist/client/assets/textChildren-ZDSs1dod.js +1 -0
  250. package/dist/client/assets/themes-CdTJhjZf.js +2 -0
  251. package/dist/client/assets/tokyo-night-D4ZgDiA7.js +1 -0
  252. package/dist/client/assets/tokyo-night-oM2G3aXe.js +1 -0
  253. package/dist/client/assets/triangle-alert-C9Sgr3jF.js +1 -0
  254. package/dist/client/assets/unwrapDefault-ByDmBtHB.js +1 -0
  255. package/dist/client/assets/utils-C9Glzetk.js +2 -0
  256. package/dist/client/assets/versionView-zkSROPw7.js +1 -0
  257. package/dist/client/assets/vesper-DdrHHSXu.js +1 -0
  258. package/dist/client/assets/vesper-sUHevyKv.js +1 -0
  259. package/dist/client/assets/vitesse-black-CfklMpOb.js +1 -0
  260. package/dist/client/assets/vitesse-black-fwtXNY1n.js +1 -0
  261. package/dist/client/assets/vitesse-dark-BZCL-v6S.js +1 -0
  262. package/dist/client/assets/vitesse-dark-CJkzwmKT.js +1 -0
  263. package/dist/client/assets/vitesse-light-BxMp8E1Y.js +1 -0
  264. package/dist/client/assets/vitesse-light-VbXTXTou.js +1 -0
  265. package/dist/client/assets/wa-sqlite-Ba70bhIr.wasm +0 -0
  266. package/dist/client/assets/warmPlans-CYFrLwcX.js +1 -0
  267. package/dist/client/assets/with-selector-HIcjK0_d.js +1 -0
  268. package/dist/client/assets/workflowSource-LMsRuqF_.js +3 -0
  269. package/dist/client/favicon.png +0 -0
  270. package/dist/client/icons/apple-touch-icon-180x180.png +0 -0
  271. package/dist/client/icons/favicon.ico +0 -0
  272. package/dist/client/icons/maskable-icon-192x192.png +0 -0
  273. package/dist/client/icons/maskable-icon-512x512.png +0 -0
  274. package/dist/client/icons/pwa-16x16.png +0 -0
  275. package/dist/client/icons/pwa-192x192.png +0 -0
  276. package/dist/client/icons/pwa-32x32.png +0 -0
  277. package/dist/client/icons/pwa-512x512.png +0 -0
  278. package/dist/client/icons/pwa-64x64.png +0 -0
  279. package/dist/clientLog.d.ts +5 -0
  280. package/dist/clientLog.js +64 -0
  281. package/dist/cloudClient.d.ts +38 -0
  282. package/dist/cloudClient.js +185 -0
  283. package/dist/cloudCommand.d.ts +23 -0
  284. package/dist/cloudCommand.js +159 -0
  285. package/dist/cloudFrontmatter.d.ts +4 -0
  286. package/dist/cloudFrontmatter.js +30 -0
  287. package/dist/cloudStore.d.ts +28 -0
  288. package/dist/cloudStore.js +70 -0
  289. package/dist/cloudWatch.d.ts +12 -0
  290. package/dist/cloudWatch.js +103 -0
  291. package/dist/commentReply.d.ts +25 -0
  292. package/dist/commentReply.js +17 -0
  293. package/dist/configHome.d.ts +34 -0
  294. package/dist/configHome.js +136 -0
  295. package/dist/dashboard.d.ts +67 -0
  296. package/dist/dashboard.js +86 -0
  297. package/dist/dashboardClientScript.d.ts +2 -0
  298. package/dist/dashboardClientScript.js +1006 -0
  299. package/dist/dashboardDocument.d.ts +13 -0
  300. package/dist/dashboardDocument.js +40 -0
  301. package/dist/dashboardFormat.d.ts +98 -0
  302. package/dist/dashboardFormat.js +199 -0
  303. package/dist/dashboardLoading.d.ts +19 -0
  304. package/dist/dashboardLoading.js +94 -0
  305. package/dist/dashboardOverview.d.ts +28 -0
  306. package/dist/dashboardOverview.js +333 -0
  307. package/dist/dashboardPage.d.ts +2 -0
  308. package/dist/dashboardPage.js +11 -0
  309. package/dist/dashboardParts.d.ts +4 -0
  310. package/dist/dashboardParts.js +367 -0
  311. package/dist/dashboardSearchView.d.ts +38 -0
  312. package/dist/dashboardSearchView.js +255 -0
  313. package/dist/desktopApp.d.ts +23 -0
  314. package/dist/desktopApp.js +110 -0
  315. package/dist/desktopBridge.d.ts +21 -0
  316. package/dist/desktopBridge.js +78 -0
  317. package/dist/desktopCommand.d.ts +61 -0
  318. package/dist/desktopCommand.js +172 -0
  319. package/dist/desktopConfig.d.ts +54 -0
  320. package/dist/desktopConfig.js +164 -0
  321. package/dist/desktopNotices.d.ts +105 -0
  322. package/dist/desktopNotices.js +427 -0
  323. package/dist/diff.d.ts +2 -0
  324. package/dist/diff.js +46 -0
  325. package/dist/diffsTheme.d.ts +51 -0
  326. package/dist/diffsTheme.js +86 -0
  327. package/dist/diffsThemeCatalog.d.ts +3 -0
  328. package/dist/diffsThemeCatalog.js +78 -0
  329. package/dist/elkRuntime.node.d.ts +7 -0
  330. package/dist/elkRuntime.node.js +63 -0
  331. package/dist/execution.d.ts +78 -0
  332. package/dist/execution.js +139 -0
  333. package/dist/expectedWorkflow.d.ts +11 -0
  334. package/dist/expectedWorkflow.js +99 -0
  335. package/dist/favicon.d.ts +4 -0
  336. package/dist/favicon.js +40 -0
  337. package/dist/favicon.png +0 -0
  338. package/dist/faviconBase64.d.ts +1 -0
  339. package/dist/faviconBase64.js +1 -0
  340. package/dist/fileVersion.d.ts +8 -0
  341. package/dist/fileVersion.js +20 -0
  342. package/dist/formatBytes.d.ts +2 -0
  343. package/dist/formatBytes.js +13 -0
  344. package/dist/gitStatus.d.ts +12 -0
  345. package/dist/gitStatus.js +88 -0
  346. package/dist/hostToolbar.d.ts +38 -0
  347. package/dist/hostToolbar.js +249 -0
  348. package/dist/http.d.ts +8 -0
  349. package/dist/http.js +38 -0
  350. package/dist/httpServer.d.ts +13 -0
  351. package/dist/httpServer.js +40 -0
  352. package/dist/icons/apple-touch-icon-180x180.png +0 -0
  353. package/dist/icons/favicon.ico +0 -0
  354. package/dist/icons/maskable-icon-192x192.png +0 -0
  355. package/dist/icons/maskable-icon-512x512.png +0 -0
  356. package/dist/icons/pwa-16x16.png +0 -0
  357. package/dist/icons/pwa-192x192.png +0 -0
  358. package/dist/icons/pwa-32x32.png +0 -0
  359. package/dist/icons/pwa-512x512.png +0 -0
  360. package/dist/icons/pwa-64x64.png +0 -0
  361. package/dist/lanAccess.d.ts +31 -0
  362. package/dist/lanAccess.js +110 -0
  363. package/dist/lanAddress.d.ts +24 -0
  364. package/dist/lanAddress.js +174 -0
  365. package/dist/lanCommand.d.ts +25 -0
  366. package/dist/lanCommand.js +159 -0
  367. package/dist/lanConfig.d.ts +40 -0
  368. package/dist/lanConfig.js +130 -0
  369. package/dist/lanFirewall.d.ts +17 -0
  370. package/dist/lanFirewall.js +221 -0
  371. package/dist/layoutGraph.d.ts +13 -0
  372. package/dist/layoutGraph.js +55 -0
  373. package/dist/localName.d.ts +9 -0
  374. package/dist/localName.js +28 -0
  375. package/dist/lockBanner.d.ts +2 -0
  376. package/dist/lockBanner.js +2 -0
  377. package/dist/mdnsPacket.d.ts +44 -0
  378. package/dist/mdnsPacket.js +384 -0
  379. package/dist/mdnsPublish.d.ts +12 -0
  380. package/dist/mdnsPublish.js +290 -0
  381. package/dist/offlineSync.d.ts +249 -0
  382. package/dist/offlineSync.js +477 -0
  383. package/dist/openUrl.d.ts +40 -0
  384. package/dist/openUrl.js +147 -0
  385. package/dist/openedPages.d.ts +14 -0
  386. package/dist/openedPages.js +48 -0
  387. package/dist/pageEditPull.d.ts +9 -0
  388. package/dist/pageEditPull.js +29 -0
  389. package/dist/pageRoutes.d.ts +3 -0
  390. package/dist/pageRoutes.js +34 -0
  391. package/dist/parse.d.ts +7 -0
  392. package/dist/parse.js +100 -0
  393. package/dist/pid.d.ts +2 -0
  394. package/dist/pid.js +13 -0
  395. package/dist/planArchive.d.ts +4 -0
  396. package/dist/planArchive.js +28 -0
  397. package/dist/planEntries.d.ts +12 -0
  398. package/dist/planEntries.js +117 -0
  399. package/dist/planHost.d.ts +31 -0
  400. package/dist/planHost.js +286 -0
  401. package/dist/planId.d.ts +2 -0
  402. package/dist/planId.js +6 -0
  403. package/dist/planMdx/blockEdit.d.ts +41 -0
  404. package/dist/planMdx/blockEdit.js +60 -0
  405. package/dist/planMdx/cellPart.d.ts +14 -0
  406. package/dist/planMdx/cellPart.js +26 -0
  407. package/dist/planMdx/compilePlanMdx.d.ts +3 -0
  408. package/dist/planMdx/compilePlanMdx.js +22 -0
  409. package/dist/planMdx/editSource.d.ts +39 -0
  410. package/dist/planMdx/editSource.js +327 -0
  411. package/dist/planMdx/frontmatter.d.ts +5 -0
  412. package/dist/planMdx/frontmatter.js +15 -0
  413. package/dist/planMdx/markdown.d.ts +6 -0
  414. package/dist/planMdx/markdown.js +470 -0
  415. package/dist/planMdx/outline.d.ts +8 -0
  416. package/dist/planMdx/outline.js +548 -0
  417. package/dist/planMdx/payload.d.ts +4 -0
  418. package/dist/planMdx/payload.js +18 -0
  419. package/dist/planMdx/rebaseDraft.d.ts +54 -0
  420. package/dist/planMdx/rebaseDraft.js +675 -0
  421. package/dist/planMdx/recmaPlanComponents.d.ts +18 -0
  422. package/dist/planMdx/recmaPlanComponents.js +52 -0
  423. package/dist/planMdx/remarkBlockRanges.d.ts +104 -0
  424. package/dist/planMdx/remarkBlockRanges.js +275 -0
  425. package/dist/planMdx/remarkCodeMeta.d.ts +16 -0
  426. package/dist/planMdx/remarkCodeMeta.js +25 -0
  427. package/dist/planMdx/remarkGfmTable.d.ts +5 -0
  428. package/dist/planMdx/remarkGfmTable.js +15 -0
  429. package/dist/planMdx/remarkGfmTaskList.d.ts +5 -0
  430. package/dist/planMdx/remarkGfmTaskList.js +15 -0
  431. package/dist/planMdx/remarkMermaid.d.ts +16 -0
  432. package/dist/planMdx/remarkMermaid.js +56 -0
  433. package/dist/planMdx/source.d.ts +11 -0
  434. package/dist/planMdx/source.js +131 -0
  435. package/dist/planMdx/titleEdit.d.ts +35 -0
  436. package/dist/planMdx/titleEdit.js +112 -0
  437. package/dist/planPage.css +2125 -0
  438. package/dist/planProgress.d.ts +17 -0
  439. package/dist/planProgress.js +78 -0
  440. package/dist/planReady.d.ts +8 -0
  441. package/dist/planReady.js +20 -0
  442. package/dist/planRefNavigation.d.ts +4 -0
  443. package/dist/planRefNavigation.js +8 -0
  444. package/dist/planRoutes.d.ts +12 -0
  445. package/dist/planRoutes.js +141 -0
  446. package/dist/planSearch.d.ts +166 -0
  447. package/dist/planSearch.js +462 -0
  448. package/dist/planSession.d.ts +130 -0
  449. package/dist/planSession.js +1182 -0
  450. package/dist/planSnapshots.d.ts +34 -0
  451. package/dist/planSnapshots.js +113 -0
  452. package/dist/planStatus.d.ts +26 -0
  453. package/dist/planStatus.js +46 -0
  454. package/dist/planStepHeading.d.ts +16 -0
  455. package/dist/planStepHeading.js +34 -0
  456. package/dist/planTarget.d.ts +16 -0
  457. package/dist/planTarget.js +92 -0
  458. package/dist/planToc.d.ts +24 -0
  459. package/dist/planToc.js +258 -0
  460. package/dist/planVersionMenu.d.ts +12 -0
  461. package/dist/planVersionMenu.js +23 -0
  462. package/dist/processRecord.d.ts +108 -0
  463. package/dist/processRecord.js +68 -0
  464. package/dist/processesPanel.d.ts +7 -0
  465. package/dist/processesPanel.js +636 -0
  466. package/dist/pwaIconFile.d.ts +2 -0
  467. package/dist/pwaIconFile.js +42 -0
  468. package/dist/pwaIcons.d.ts +28 -0
  469. package/dist/pwaIcons.js +46 -0
  470. package/dist/registerServiceWorker.d.ts +25 -0
  471. package/dist/registerServiceWorker.js +26 -0
  472. package/dist/registryClient.d.ts +94 -0
  473. package/dist/registryClient.js +490 -0
  474. package/dist/registryConstants.d.ts +9 -0
  475. package/dist/registryConstants.js +9 -0
  476. package/dist/registryLock.d.ts +19 -0
  477. package/dist/registryLock.js +48 -0
  478. package/dist/registryPage.d.ts +2 -0
  479. package/dist/registryPage.js +284 -0
  480. package/dist/registryService.d.ts +21 -0
  481. package/dist/registryService.js +562 -0
  482. package/dist/registryStore.d.ts +63 -0
  483. package/dist/registryStore.js +398 -0
  484. package/dist/releaseNotes.d.ts +35 -0
  485. package/dist/releaseNotes.js +62 -0
  486. package/dist/render.d.ts +50 -0
  487. package/dist/render.js +1506 -0
  488. package/dist/requestGuard.d.ts +21 -0
  489. package/dist/requestGuard.js +42 -0
  490. package/dist/reviewRound.d.ts +12 -0
  491. package/dist/reviewRound.js +19 -0
  492. package/dist/runFollow.d.ts +28 -0
  493. package/dist/runFollow.js +33 -0
  494. package/dist/searchMatch.d.ts +35 -0
  495. package/dist/searchMatch.js +270 -0
  496. package/dist/server.d.ts +24 -0
  497. package/dist/server.js +114 -0
  498. package/dist/serviceLog.d.ts +56 -0
  499. package/dist/serviceLog.js +481 -0
  500. package/dist/shellCache.d.ts +69 -0
  501. package/dist/shellCache.js +289 -0
  502. package/dist/shellWorker.js +322 -0
  503. package/dist/shellWorkerResponse.d.ts +4 -0
  504. package/dist/shellWorkerResponse.js +15 -0
  505. package/dist/startServer.d.ts +2 -0
  506. package/dist/startServer.js +2 -0
  507. package/dist/store/meta.d.ts +53 -0
  508. package/dist/store/meta.js +140 -0
  509. package/dist/store/migrate.d.ts +3 -0
  510. package/dist/store/migrate.js +408 -0
  511. package/dist/store/rows.d.ts +4 -0
  512. package/dist/store/rows.js +100 -0
  513. package/dist/store/schema.d.ts +5 -0
  514. package/dist/store/schema.js +5 -0
  515. package/dist/store/sqlite.d.ts +19 -0
  516. package/dist/store/sqlite.js +57 -0
  517. package/dist/store/tables.d.ts +1892 -0
  518. package/dist/store/tables.js +136 -0
  519. package/dist/theme.d.ts +174 -0
  520. package/dist/theme.js +444 -0
  521. package/dist/themeBootstrap.d.ts +2 -0
  522. package/dist/themeBootstrap.js +11 -0
  523. package/dist/tui/DashboardApp.d.ts +19 -0
  524. package/dist/tui/DashboardApp.js +237 -0
  525. package/dist/tui/PaletteProvider.d.ts +12 -0
  526. package/dist/tui/PaletteProvider.js +36 -0
  527. package/dist/tui/PlanActions.d.ts +7 -0
  528. package/dist/tui/PlanActions.js +9 -0
  529. package/dist/tui/PlanCard.d.ts +13 -0
  530. package/dist/tui/PlanCard.js +31 -0
  531. package/dist/tui/PlanRow.d.ts +13 -0
  532. package/dist/tui/PlanRow.js +31 -0
  533. package/dist/tui/PlanTable.d.ts +13 -0
  534. package/dist/tui/PlanTable.js +24 -0
  535. package/dist/tui/ProcessCard.d.ts +9 -0
  536. package/dist/tui/ProcessCard.js +24 -0
  537. package/dist/tui/ProcessList.d.ts +9 -0
  538. package/dist/tui/ProcessList.js +12 -0
  539. package/dist/tui/SegmentButton.d.ts +7 -0
  540. package/dist/tui/SegmentButton.js +18 -0
  541. package/dist/tui/StatCard.d.ts +6 -0
  542. package/dist/tui/StatCard.js +17 -0
  543. package/dist/tui/dashboardView.d.ts +45 -0
  544. package/dist/tui/dashboardView.js +192 -0
  545. package/dist/tui/openExternal.d.ts +2 -0
  546. package/dist/tui/openExternal.js +5 -0
  547. package/dist/tui/palette.d.ts +27 -0
  548. package/dist/tui/palette.js +66 -0
  549. package/dist/tui/planColumns.d.ts +38 -0
  550. package/dist/tui/planColumns.js +14 -0
  551. package/dist/tui/readDashboard.d.ts +3 -0
  552. package/dist/tui/readDashboard.js +15 -0
  553. package/dist/tui/readProcesses.d.ts +3 -0
  554. package/dist/tui/readProcesses.js +23 -0
  555. package/dist/tui/registryView.d.ts +11 -0
  556. package/dist/tui/registryView.js +56 -0
  557. package/dist/tui/runTui.d.ts +21 -0
  558. package/dist/tui/runTui.js +86 -0
  559. package/dist/tui/systemTheme.d.ts +28 -0
  560. package/dist/tui/systemTheme.js +141 -0
  561. package/dist/types.d.ts +191 -0
  562. package/dist/types.js +0 -0
  563. package/dist/webManifest.d.ts +39 -0
  564. package/dist/webManifest.js +48 -0
  565. package/dist/workflow.d.ts +8 -0
  566. package/dist/workflow.js +42 -0
  567. package/dist/workflowLayoutShared.d.ts +25 -0
  568. package/dist/workflowLayoutShared.js +33 -0
  569. package/dist/workflowSource.d.ts +31 -0
  570. package/dist/workflowSource.js +90 -0
  571. package/docs/changelogs/changelog-2026-10-27.md +203 -0
  572. package/docs/changelogs/changelog-2026-10-28.md +181 -0
  573. package/docs/changelogs/changelog-2026-10-29.md +349 -0
  574. package/docs/changelogs/changelog-2026-10-30.md +303 -0
  575. package/docs/changelogs/changelog-2026-10-31.md +129 -0
  576. package/docs/changelogs/changelog-2026-11-01.md +155 -0
  577. package/docs/changelogs/changelog-2026-11-02.md +195 -0
  578. package/docs/changelogs/changelog-2026-11-03.md +209 -0
  579. package/docs/changelogs/changelog-2026-11-04.md +243 -0
  580. package/docs/changelogs/changelog-2026-11-05.md +172 -0
  581. package/docs/changelogs/changelog-2026-11-06.md +123 -0
  582. package/docs/changelogs/changelog-2026-11-07.md +138 -0
  583. package/docs/changelogs/changelog-2026-11-08.md +47 -0
  584. package/docs/changelogs/changelog-2026-11-10.md +219 -0
  585. package/docs/changelogs/changelog-2026-11-11.md +205 -0
  586. package/docs/changelogs/changelog-2026-11-12.md +44 -0
  587. package/docs/changelogs/changelog-2026-11-13.md +48 -0
  588. package/docs/changelogs/changelog-2026-11-14.md +116 -0
  589. package/docs/changelogs/changelog-2026-11-15.md +31 -0
  590. package/docs/changelogs/changelog-2026-11-16.md +41 -0
  591. package/docs/changelogs/changelog-2026-11-17.md +25 -0
  592. package/docs/changelogs/changelog-2026-11-18.md +71 -0
  593. package/docs/changelogs/changelog-2026-11-19.md +19 -0
  594. package/examples/cloud-showcase.plan.md +181 -0
  595. package/examples/component-showcase.plan.md +378 -0
  596. package/examples/component-tour.plan.md +168 -0
  597. package/examples/data-table.plan.md +917 -0
  598. package/examples/execution-graph.json +15 -5
  599. package/examples/form-controls.plan.md +51 -0
  600. package/examples/live-plan.config.json +5 -0
  601. package/examples/rate-limit.plan.md +110 -78
  602. package/examples/submission-delivery-runbook.md +122 -0
  603. package/examples/submission-delivery.plan.md +107 -0
  604. package/examples/tables.plan.md +61 -0
  605. package/package.json +86 -15
  606. package/skills/live-plan/SKILL.md +381 -0
  607. package/skills/live-plan/primitives.md +738 -0
  608. package/skills/living-plan/SKILL.md +0 -71
@@ -0,0 +1,168 @@
1
+ import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{n,t as r}from"./jsx-runtime-DKj5X9O4.js";import{t as i}from"./react-dom-DpzJPrWF.js";import{A as a,C as o,D as s,E as c,O as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,k as x,l as S,m as C,n as w,o as T,p as E,r as ee,s as D,u as te,v as ne,w as re,x as ie,y as ae}from"./CodeBlock-BxRMnldw.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./lib-CdRiGVUZ.js";import{A as pe,C as me,D as he,E as ge,F as _e,G as ve,I as ye,K as be,L as xe,M as Se,N as Ce,O as we,P as Te,R as Ee,S as De,T as Oe,U as ke,W as Ae,_ as je,c as Me,d as Ne,f as Pe,g as Fe,j as Ie,k as Le,o as Re,p as ze,s as Be,u as Ve,v as He,w as Ue}from"./planEditButton-CbWGczbi.js";import{r as We}from"./with-selector-HIcjK0_d.js";import{n as Ge,t as Ke}from"./arrow-up-down-BSjnQK2I.js";import{t as qe}from"./arrow-up-CEVVOXD5.js";import{a as Je,n as Ye,t as Xe}from"./StatusIcon-C_-Lm9b4.js";import{C as Ze,E as Qe,G as $e,O as et,S as tt,T as nt,U as rt,_ as it,c as at,f as ot,i as st,l as ct,n as lt,o as ut,p as dt,r as ft,s as pt,t as mt,u as ht,v as gt,w as _t,y as vt}from"./mdxEntries-L-V7bB6i.js";import{B as yt,F as bt,H as xt,I as St,L as Ct,R as wt,U as Tt,V as Et,br as Dt,t as Ot,yr as kt,z as At}from"./button-DJWAGApe.js";import{n as jt,o as Mt,t as Nt}from"./Popover-DbE4vUPG.js";import{C as Pt,O as Ft,S as It,T as Lt,_ as Rt,b as zt,c as Bt,d as Vt,i as Ht,l as Ut,n as Wt,p as Gt,s as Kt,t as qt,u as Jt,x as Yt}from"./lib-COgu-QLX.js";import{a as Xt,c as Zt,d as Qt,l as $t,r as en,t as tn,u as nn}from"./editSource-U5AoD-Wo.js";import{a as rn,c as an,d as on,l as O,n as sn,o as cn,r as ln,s as un,t as dn,u as fn}from"./utils-C9Glzetk.js";import{r as pn}from"./default-5FplaXL4.js";import{n as mn}from"./Mermaid-jPWLXX7e.js";var hn={compositeOverBg:y,contrastRatio:v,deriveMutedFg:f,hoverWouldEraseText:ne,isDarkSurface:ae,isFullyTransparent:m,pickReadableForeground:ie,relativeLuminance:u,surfacesMatch:o},gn=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})})),_n={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};_n.node;var vn=We(_n),yn={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};yn.node;var bn=We(yn),xn={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};xn.node;var Sn=We(xn),Cn={name:`heading-1`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]};Cn.node;var wn=We(Cn),Tn={name:`heading-2`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]};Tn.node;var En=We(Tn),Dn={name:`heading-3`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2`,key:`68ncm8`}],[`path`,{d:`M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2`,key:`1ejuhz`}]]};Dn.node;var On=We(Dn),kn={name:`heading-4`,size:24,node:[[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17 10v3a1 1 0 0 0 1 1h3`,key:`tj5zdr`}],[`path`,{d:`M21 10v8`,key:`1kdml4`}],[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}]]};kn.node;var An=We(kn),jn={name:`heading-5`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17 13v-3h4`,key:`1nvgqp`}],[`path`,{d:`M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17`,key:`2nebdn`}]]};jn.node;var Mn=We(jn),Nn={name:`heading-6`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`circle`,{cx:`19`,cy:`16`,r:`2`,key:`15mx69`}],[`path`,{d:`M20 10c-2 2-3 3.5-3 6`,key:`f35dl0`}]]};Nn.node;var Pn=We(Nn),Fn={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Fn.node;var In=We(Fn),Ln={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Ln.node;var Rn=We(Ln),zn={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};zn.node;var Bn=We(zn),Vn={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};Vn.node;var Hn=We(Vn),Un={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Un.node;var Wn=We(Un),Gn={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};Gn.node;var Kn=We(Gn),qn={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};qn.node;var Jn=We(qn),Yn={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Yn.node;var Xn=We(Yn),Zn={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Zn.node;var Qn=We(Zn),$n={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};$n.node;var er=We($n),tr={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};tr.node;var nr=We(tr),rr={}.hasOwnProperty;function ir(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)ir(e,t.extensions[n]);for(r in t)if(rr.call(t,r))switch(r){case`extensions`:break;case`unsafe`:ar(e[r],t[r]);break;case`join`:ar(e[r],t[r]);break;case`handlers`:or(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function ar(e,t){t&&e.push(...t)}function or(e,t){t&&Object.assign(e,t)}var sr=[cr];function cr(e,t,n,r){if(t.type===`code`&&ye(t,r)&&(e.type===`list`||e.type===t.type&&ye(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`){if(n.spread)return 1;if(e.type===`html`){let t=Te(e.value);if(t===void 0||t===6||t===7)return 1}if(e.type===`blockquote`&&t.type===`blockquote`||(e.type===`definition`||e.type===`paragraph`)&&t.type===`list`&&(t.ordered&&typeof t.start==`number`&&t.start!==1||t.children.length>0&&t.children[0].children.length===0)||e.type===`paragraph`&&t.type===`thematicBreak`&&Ie(r)===`-`&&!r.options.ruleSpaces)return 1;let i=e;for(;(i.type===`blockquote`||i.type===`list`||i.type===`listItem`)&&i.children.length>0;)i=i.children[i.children.length-1];if(i.type!==`definition`&&i.type!==`paragraph`)return 0;if(t.type===`code`&&ye(t,r))return 1;if(t.type===`html`){let e=Te(t.value);if(e===void 0||e===7)return 1}return(e.type===`paragraph`||e!==i)&&(t.type===`definition`||t.type===`heading`&&Se(t,r)||t.type===`paragraph`)?1:0}}for(var lr=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],ur=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
2
+ `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`\r`,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:`\r`,after:`\\r`,inConstruct:`phrasing`},{character:`
3
+ `,before:`\\n`,inConstruct:`phrasing`},{character:`
4
+ `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`!`,after:`\\[`,inConstruct:`phrasing`,notInConstruct:lr},{character:`"`,inConstruct:`titleQuote`},{atBreak:!0,character:`#`},{character:`#`,inConstruct:`headingAtx`,after:`(?:[\r
5
+ ]|$)`},{character:`&`,after:`[#A-Za-z]`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`destinationRaw`,`phrasing`,`titleApostrophe`,`titleQuote`]},{character:`'`,inConstruct:`titleApostrophe`},{character:`(`,inConstruct:`destinationRaw`},{before:`\\]`,character:`(`,inConstruct:`phrasing`,notInConstruct:lr},{atBreak:!0,before:`\\d+`,character:`)`},{character:`)`,inConstruct:`destinationRaw`},{atBreak:!0,character:`*`,after:`(?:[ \r
6
+ *])`},{character:`*`,inConstruct:`phrasing`,notInConstruct:lr},{atBreak:!0,character:`+`,after:`(?:[ \r
7
+ ])`},{atBreak:!0,character:`-`,after:`(?:[ \r
8
+ -])`},{atBreak:!0,before:`\\d+`,character:`.`,after:`(?:[ \r
9
+ ]|$)`},{atBreak:!0,character:`<`,after:`[!/?A-Za-z]`},{character:`<`,after:`[!/?A-Za-z]`,inConstruct:`phrasing`,notInConstruct:lr},{character:`<`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`=`},{atBreak:!0,character:`>`},{character:`>`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`[`},{character:`[`,inConstruct:`phrasing`,notInConstruct:lr},{character:`[`,inConstruct:[`label`,`reference`]},{character:`\\`,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:`]`,inConstruct:[`label`,`reference`]},{atBreak:!0,character:`_`},{character:`_`,inConstruct:`phrasing`,notInConstruct:lr},{atBreak:!0,character:"`"},{character:"`",inConstruct:[`codeFencedLangGraveAccent`,`codeFencedMetaGraveAccent`]},{character:"`",inConstruct:`phrasing`,notInConstruct:lr},{atBreak:!0,character:`~`},{character:`<`,inConstruct:`autolink`},{character:`>`,inConstruct:`autolink`},{character:``,inConstruct:`autolink`}],dr=-1;++dr<33;)ur.push({character:String.fromCharCode(dr),inConstruct:`autolink`});function fr(e){return e.label||!e.identifier?e.label||``:Wt(e.identifier)}function pr(e){if(!e._compiled){let t=(e.atBreak?`[\\r\\n][\\t ]*`:``)+(e.before?`(?:`+e.before+`)`:``);e._compiled=RegExp((e.beforeNode?`^`:t?`(`+t+`)`:``)+(/[$()*+.?[\\\]^{|}]/.test(e.character)?`\\`:``)+e.character+(e.afterNode?`$`:e.after?`(?:`+e.after+`)`:``),e.unicode?`gu`:`g`)}return e._compiled}function mr(e,t,n){let r=t.indexStack,i=e.children||[],a=t.createTracker(n),o=[],s=-1;for(r.push(-1);++s<i.length;){let n=i[s];r[r.length-1]=s,o.push(a.move(t.handle(n,e,t,{before:`
10
+ `,after:`
11
+ `,...a.current()}))),n.type!==`list`&&(t.bulletLastUsed=void 0),s<i.length-1&&o.push(a.move(hr(n,i[s+1],e,t)))}return r.pop(),o.join(``)}function hr(e,t,n,r){let i=r.join.length;for(;i--;){let a=r.join[i](e,t,n,r);if(a===!0||a===1)break;if(typeof a==`number`)return`
12
+ `.repeat(1+a);if(a===!1)return`
13
+
14
+ <!---->
15
+
16
+ `}return`
17
+
18
+ `}var gr=/\r?\n|\r/g;function _r(e,t){let n=[],r=0,i=0,a;for(;a=gr.exec(e);)o(e.slice(r,a.index)),n.push(a[0]),r=a.index+a[0].length,i++;return o(e.slice(r)),n.join(``);function o(e){n.push(t(e,i,!e))}}var vr={}.hasOwnProperty;function yr(e,t,n){let r=(n.before||``)+(t||``)+(n.after||``),i=[],a=[],o={},s=e.stack.includes(`autolink`),c=n.before?n.before.length:0,l=r.length-(n.after?n.after.length:0),u=-1;for(;++u<e.unsafe.length;){let t=e.unsafe[u];if(!xe(e.stack,t)||!br(t.beforeNode,n.beforeNode)||!br(t.afterNode,n.afterNode))continue;let a=e.compilePattern(t),s=t.beforeNode?c:0,d=r.slice(s,t.afterNode?l:void 0),f;for(;f=a.exec(d);){let e=`before`in t||!!t.atBreak,n=`after`in t,r=s+f.index+(e?f[1].length:0);vr.call(o,r)?(o[r].before&&!e&&(o[r].before=!1),o[r].after&&!n&&(o[r].after=!1)):(i.push(r),o[r]={before:e,after:n})}}i.sort(xr);let d=c;for(u=-1;++u<i.length;){let e=i[u];if(!(e<d||e>=l)){if(r.charAt(e)===`_`&&e>0&&Bt(r.charCodeAt(e-1))===void 0&&!vr.call(o,e-1)&&!(e-1===c&&/[*_]/.test(r.charAt(c-1)))){let t=e+1;for(;t<l&&r.charAt(t)===`_`;)t++;let n=t-e-1;if(i[u+n]===t-1&&t<r.length&&Bt(r.charCodeAt(t))===void 0&&!vr.call(o,t)&&!(t===l-1&&/[*_]/.test(r.charAt(l)))){u+=n;continue}}if(!(e+1<l&&i[u+1]===e+1&&o[e].after&&!o[e+1].before&&!o[e+1].after||e-1>=c&&i[u-1]===e-1&&o[e].before&&!o[e-1].before&&!o[e-1].after)){if(d!==e){let t=r.slice(d,e);a.push(s?t:Sr(t,`\\`))}d=e+1,s?a.push(`%`+r.charCodeAt(e).toString(16).toUpperCase().padStart(2,`0`)):/[!-/:-@[-`{-~]/.test(r.charAt(e))&&(!n.encode||!n.encode.includes(r.charAt(e)))?a.push(`\\`+r.charAt(e)):a.push(_e(r.charCodeAt(e)))}}}let f=r.slice(d,l);return a.push(s?f:Sr(f,n.after)),a.join(``)}function br(e,t){return e?t?typeof e==`string`?e===t.type:e.includes(t.type):!1:!0}function xr(e,t){return e-t}function Sr(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],a=e+t,o=-1,s=0,c;for(;c=n.exec(a);)r.push(c.index);for(;++o<r.length;)s!==r[o]&&i.push(e.slice(s,r[o])),i.push(`\\`),s=r[o];return i.push(e.slice(s)),i.join(``)}function Cr(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,a=n.column||1;return{move:c,current:o,shift:s};function o(){return{now:{line:i,column:a},lineShift:r}}function s(e){r+=e}function c(e){let t=e||``,n=t.split(/\r?\n|\r/g),o=n[n.length-1];return i+=n.length-1,a=n.length===1?a+o.length:1+o.length+r,t}}function wr(e,t){let n=t||{},r={associationId:fr,bulletCurrent:void 0,bulletLastUsed:void 0,containerPhrasing:Or,containerFlow:kr,createTracker:Cr,compilePattern:pr,enter:a,handlers:{...pe},handle:void 0,indentLines:_r,indexStack:[],join:[...sr],options:{},safe:Ar,stack:[],unsafe:[...ur]};ir(r,n),r.options.tightDefinitions&&r.join.push(Dr),r.handle=se(`type`,{invalid:Tr,unknown:Er,handlers:r.handlers});let i=r.handle(Ee(e)?{type:`root`,children:[e]}:e,void 0,r,{before:`
19
+ `,after:`
20
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
21
+ `),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function Tr(e){throw Error("Cannot handle value `"+e+"`, expected node")}function Er(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function Dr(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function Or(e,t){return Ce(e,this,t)}function kr(e,t){return mr(e,this,t)}function Ar(e,t){return yr(this,e,t)}var k=e(n(),1),A=e(r(),1),jr=Object.defineProperty,Mr=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t,n)=>Mr(e,typeof t==`symbol`?t:t+``,n),Pr=class e{constructor(e=new Map){this.map=e}clone(){return new e(new Map(this.map))}increment(e){let t=this.map.get(e)??0;this.map.set(e,t+1)}decrement(e,t){let n=this.map.get(e);n!==void 0&&(--n,this.map.set(e,n),n===0&&t())}},Fr=class{constructor(){Nr(this,`map`,new Map)}getOrCreate(e){let t=this.map.get(e);return t===void 0&&(t=new Set,this.map.set(e,t)),t}get(e){return this.map.get(e)}use(e,t){let n=this.get(e);n!==void 0&&t(n)}delete(e){return this.map.delete(e)}};function Ir(e,t){return t(e),e}function Lr(){}var Rr=`cell`;function zr(e,t){return e===t}var Br=new Map,Vr,Hr=class{constructor(e={}){Nr(this,`subscriptions`,new Fr),Nr(this,`singletonSubscriptions`,new Map),Nr(this,`graph`,new Fr),Nr(this,`state`,new Map),Nr(this,`distinctNodes`,new Map),Nr(this,`executionMaps`,new Map),Nr(this,`definitionRegistry`,new Set),Nr(this,`combinedCells`,[]);for(let t of Object.getOwnPropertySymbols(e))this.state.set(t,e[t])}cellInstance(e,t=!0,n=Symbol()){return this.state.has(n)||this.state.set(n,e),t!==!1&&!this.distinctNodes.has(n)&&this.distinctNodes.set(n,t===!0?zr:t),n}signalInstance(e=!0,t=Symbol()){return e!==!1&&this.distinctNodes.set(t,e===!0?zr:e),t}sub(e,t){this.register(e);let n=this.subscriptions.getOrCreate(e);return n.add(t),()=>n.delete(t)}singletonSub(e,t){return this.register(e),t===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,t),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,t){let n=this.signalInstance();return this.connect({map:e=>(...t)=>{e(t)},sink:n,sources:e}),this.sub(n,t)}pubIn(e){var t;let n=Reflect.ownKeys(e),r=this.getExecutionMap(n),i=r.refCount.clone(),a=r.participatingNodes.slice(),o=new Map(this.state),s=e=>{this.graph.use(e,t=>{for(let{sources:n,sink:r}of t)n.has(e)&&i.decrement(r,()=>{a.splice(a.indexOf(r),1),s(r)})})};for(;;){let n=a.shift();if(n===void 0)break;let i=n,c=!1,l=e=>{let t=this.distinctNodes.get(i);t!=null&&t(o.get(i),e)?c=!1:(c=!0,o.set(i,e),this.state.has(i)&&this.state.set(i,e))};if(Object.prototype.hasOwnProperty.call(e,i)?l(e[i]):r.projections.use(i,e=>{for(let t of e){let e=[...Array.from(t.sources),...Array.from(t.pulls)].map(e=>o.get(e));t.map(l)(...e)}}),c){let e=o.get(i);this.inContext(()=>{this.subscriptions.use(i,t=>{for(let n of t)n(e)})}),(t=this.singletonSubscriptions.get(i))==null||t(e)}else s(i)}}connect({sources:e,pulls:t=[],map:n,sink:r}){let i={map:n,pulls:new Set(t),sink:this.register(r),sources:new Set(e)};for(let n of[...e,...t])this.register(n),this.graph.getOrCreate(n).add(i);this.executionMaps.clear()}pub(e,t){this.pubIn({[e]:t})}pipe(e,...t){return this.combineOperators(...t)(e)}transformer(...e){return t=>Ir(this.signalInstance(),n=>(this.link(this.pipe(n,...e),t),n))}link(e,t){this.connect({map:e=>t=>{e(t)},sink:t,sources:[e]})}combine(...e){return Ir(this.signalInstance(),t=>{this.connect({map:e=>(...t)=>{e(t)},sink:t,sources:e})})}combineCells(...e){let t=this.combinedCells.find(t=>e.length===t.sources.length&&e.every((e,n)=>e===t.sources[n]));if(t)return t.cell;let n=this.cellInstance(e.map(e=>this.getValue(e)),!0);return this.connect({map:e=>(...t)=>{e(t)},sink:n,sources:e}),this.combinedCells.push({sources:e,cell:n}),n}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(e=>this.getValue(e))}register(e){let t=Br.get(e);return t===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),Ir(t.type===Rr?this.cellInstance(t.initial,t.distinct,e):this.signalInstance(t.distinct,e),e=>{this.inContext(()=>{t.init(this,e)})}))}inContext(e){let t=Vr;Vr=this;let n=e();return Vr=t,n}changeWith(e,t,n){this.connect({sources:[t],pulls:[e],sink:e,map:e=>(t,r)=>{e(n(r,t))}})}calculateExecutionMap(e){let t=[],n=new Set,r=new Fr,i=new Pr,a=new Fr,o=(e,s=0)=>{i.increment(e),!n.has(e)&&(this.register(e),r.use(e,e=>{s=Math.max(...Array.from(e).map(e=>t.indexOf(e)))+1}),this.graph.use(e,t=>{for(let n of t)n.sources.has(e)?(a.getOrCreate(n.sink).add(n),o(n.sink,s)):r.getOrCreate(n.sink).add(e)}),n.add(e),t.splice(s,0,e))};return e.forEach(o),{participatingNodes:t,pendingPulls:r,projections:a,refCount:i}}getExecutionMap(e){let t=e;if(e.length===1){t=e[0];let n=this.executionMaps.get(t);if(n!==void 0)return n}else for(let[t,n]of this.executionMaps.entries())if(Array.isArray(t)&&t.length===e.length&&t.every(t=>e.includes(t)))return n;let n=this.calculateExecutionMap(e);return this.executionMaps.set(t,n),n}combineOperators(...e){return t=>{for(let n of e)t=n(t,this);return t}}};function j(e,t=Lr,n=!0){return Ir(Symbol(),r=>{Br.set(r,{type:Rr,distinct:n,initial:e,init:t})})}function Ur(e=Lr,t=!1){return Ir(Symbol(),n=>{Br.set(n,{type:`signal`,distinct:t,init:e})})}function Wr(e=Lr){return Ir(Symbol(),t=>{Br.set(t,{type:`signal`,distinct:!1,init:e})})}var Gr=k.createContext(null);function Kr(){let e=k.useContext(Gr);if(e===null)throw Error(`useRealm must be used within a RealmContextProvider`);return e}function qr(e){let t=Kr();t.register(e);let n=k.useCallback(n=>t.sub(e,n),[t,e]);return k.useSyncExternalStore(n,()=>t.getValue(e),()=>t.getValue(e))}function Jr(...e){let t=Kr();return qr(k.useMemo(()=>t.combineCells.apply(t,e),[t,...e]))}function Yr(e){let t=Kr();return t.register(e),k.useCallback(n=>{t.pub(e,n)},[t,e])}function Xr(e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:t=>n=>{t(e(n))},sink:r,sources:[t]}),r}}function Zr(...e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:e=>(...t)=>{e(t)},pulls:e,sink:r,sources:[t]}),r}}function Qr(e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:t=>()=>{t(e)},sink:r,sources:[t]}),r}}function $r(e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:t=>n=>{e(n)&&t(n)},sink:r,sources:[t]}),r}}function ei(e,t){return(n,r)=>{let i=r.signalInstance();return r.connect({map:n=>r=>{n(t=e(t,r))},sink:i,sources:[n]}),i}}var ti=new WeakMap;function ni(e,t){let n=ti.get(e);return n||(n=new Set,ti.set(e,n)),n.add(t),()=>{n.delete(t)}}function ri(e){let t=ti.get(e);if(ti.delete(e),!t)return;let n=!1,r;for(let e of[...t].reverse())try{e()}catch(e){n||(n=!0,r=e)}if(n)throw r instanceof Error?r:Error(`Realm cleanup failed with a non-Error value`)}function ii(e){return function(t){return{init:n=>e.init?.call(e,n,t),postInit:n=>e.postInit?.call(e,n,t),update:n=>e.update?.call(e,n,t)}}}function ai({children:e,plugins:t}){let[n,r]=k.useState(null);return k.useEffect(()=>{var e,n;let i=new Hr;try{for(let n of t)(e=n.init)==null||e.call(n,i);for(let e of t)(n=e.postInit)==null||n.call(e,i)}catch(e){try{ri(i)}catch(t){throw AggregateError([e,t],`Realm plugin initialization and cleanup both failed`)}throw e}return r(i),()=>{ri(i)}},[]),k.useEffect(()=>{var e;if(n)for(let r of t)(e=r.update)==null||e.call(r,n)}),n?k.createElement(Gr.Provider,{value:n},e):null}function M(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function oi(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var si=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,ci=si&&`documentMode`in document?document.documentMode:null,li=si&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ui=si&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),di=!(!si||!(`InputEvent`in window)||ci)&&`getTargetRanges`in new window.InputEvent(`input`),fi=si&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pi=si&&/Android/.test(navigator.userAgent),mi=si&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!pi,hi=si&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gi=si&&pi&&hi,_i=si&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&li&&!hi,vi=0,yi=1,bi=2,xi=1,Si=2,Ci=3,wi=4,Ti=5,Ei=6,Di=mi||fi||_i?`\xA0`:`​`,Oi=`
22
+
23
+ `,ki=ui?`\xA0`:Di,Ai=`֑-߿יִ-﷽ﹰ-ﻼ`,ji=`A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿`;RegExp(`^[^`+ji+`]*[`+Ai+`]`),RegExp(`^[^`+Ai+`]*[`+ji+`]`);var Mi={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ni={directionless:1,unmergeable:2},Pi={center:2,end:6,justify:4,left:1,right:3,start:5},Fi={[Si]:`center`,[Ei]:`end`,[wi]:`justify`,[xi]:`left`,[Ci]:`right`,[Ti]:`start`},Ii={normal:0,segmented:2,token:1},Li={[vi]:`normal`,[bi]:`segmented`,[yi]:`token`},Ri=`$config`;function zi(){return wf()._blockCursorElement}function Bi(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Vi=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&M(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=Hi(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=Hi(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function Hi(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var Ui=class e extends Vi{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;Bi(t);)e=t,t=t.nextSibling;let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===zi()?n:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(_i||fi||mi);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=of().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=of().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=zi(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=Wi(t,n);i.push(r);let a=Wi(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function Wi(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&M(225),n.reverse()}var Gi;try{Gi=`0.48.0+prod.esm`}catch{}var Ki=Gi??`"<unknown>+source"`,qi=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},Ji=null;function Yi(e,t=1e3){return e instanceof Xi?e.clone():e.size<t?new Map(e):new Xi().init(new Map(e),void 0,e.size)}var Xi=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===Ji?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===Ji?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==Ji&&n!==void 0||(this._size++,n===Ji&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,Ji),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(t)for(let n of t){let t=n[0],r=e?e.get(t):void 0;r!==Ji&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===Ji||t&&t.has(n[0])||(yield n)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}};function Zi(e,t,n,r,i,a){if(z(e)){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&((z(o)||Xf(o)&&o.__slots!==null)&&Zi(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of Xf(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&Zf(e)&&e.__slotHost===t&&((z(e)||Xf(e)&&e.__slots!==null)&&Zi(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var Qi=!1,$i=0;function ea(e){$i=e.timeStamp}function ta(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&cd(e,n)!==void 0}function na(e,t,n){let r=Qd(Vd(n)),i=r&&lf(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&bd(t,s,a,o,!1)}function ra(e,t,n){if(I(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Xu(t)&&n.isAttached()}function ia(e,t,n){for(let r=e;r&&!Rf(r);r=Fd(r)){let e=cd(r,t);if(e!==void 0){let t=H(e,n);if(t)return B(t)||!G(r)?void 0:[r,t]}}}function aa(e,t,n){Qi=!0;let r=performance.now()-$i>100;try{ou(e,()=>{let i=R()||function(e){return e.read(`latest`,()=>{let e=R();return e===null?null:e.clone()})}(e),a=new Map,o=e._editorState,s=e._blockCursorElement,c=!1,l=``;for(let n=0;n<t.length;n++){let u=t[n],d=u.type,f=u.target,p=ia(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&F(h)&&Xu(f)&&ra(i,f,h)&&na(f,h,e);else if(d===`childList`){c=!0;let t=u.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=od(r),a=r.parentNode;if(!(a==null||r===s||i!==null||ta(r,a,e)||e._slotsUsed&&G(r)&&r.hasAttribute(`data-lexical-slot`)||Rf(r))){if(ui){let e=(G(r)?r.innerText:null)||r.nodeValue;e&&(l+=e)}a.removeChild(r)}}let n=u.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(ta(r,f,e)||s===r)&&(f.appendChild(r),t++)}r!==t&&a.set(m,h)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let u=n.takeRecords();if(u.length>0){for(let t=0;t<u.length;t++){let n=u[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||ta(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&fd(i),ui&&Nd(e)&&i.insertRawText(l))})}finally{Qi=!1}}function oa(e){let t=e._observer;t!==null&&aa(e,t.takeRecords(),t)}function sa(e){(function(e){$i===0&&Vd(e).addEventListener(`textInput`,ea,!0)})(e),e._observer=new MutationObserver((t,n)=>{aa(e,t,n)})}var ca=`latest`,la=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||ya).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function ua(e,t){return new la(e,t)}function da(e,t,n=ca){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function fa(e,t,n){let r;if(Bl(),typeof n==`function`){let i=e.getLatest(),a=da(i,t);if(r=n(a),t.isEqual(a,r))return i}else r=n;let i=e.getWritable();return ga(i).updateFromKnown(t,r),i}function pa(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of Wf(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}var ma=new Set([`__proto__`,`constructor`,`prototype`]),ha=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return va(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(ma.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=va(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(ma.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function ga(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new ha(t,_a(t));return t.__state=n,n}function _a(e){return e.__state?e.__state.sharedNodeState:Bu(wf(),e.getType()).sharedNodeState}function va(e){if(e)for(let t in e)return e}function ya(e){return e}function ba(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function xa(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function Sa(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Ca(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&ba(n,e,t)||t&&ba(n,t,e)||e&&xa(n,e,t)||t&&xa(n,t,e))}(c,l))}function wa(e,t){let n=e.mergeWithSibling(t),r=Wl()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Ta(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&F(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(Ca(t,r)){r=wa(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&F(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Ca(r,n)){r=wa(r,n);break}break}n.remove()}}else r.remove()}function Ea(e){return Da(e.anchor),Da(e.focus),e}function Da(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),F(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!z(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Oa=Symbol.for(`@lexical/CachedTextSize`);function ka(e,t){return Ga.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=Wa.get(r);if(i===void 0&&M(345,r),z(i)){let a=Ka.get(r);if(a!==void 0&&z(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=qa.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&M(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[Oa];e===void 0&&M(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:Na})}function Aa(e){z(e)||e[Oa]===void 0&&(e[Oa]=F(e)?e.__text.length:e.getTextContentSize())}var ja=4,Ma,Na,Pa,N=``,Fa=null,Ia=null,La=null;function Ra(){return{firstTextKey:La,format:Fa,style:Ia}}function za(e){e.firstTextKey!==null&&(Fa=e.format,Ia=e.style,La=e.firstTextKey)}function Ba(e){if(La!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&M(348),t===null)return;let n=Ka.get(t);F(n)&&(Fa=n.getFormat(),Ia=n.getStyle(),La=t)}var Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za=!1,Qa=!1;function $a(e,t){let n=Wa.get(e),r=Ka.has(e);if(t!==null){let n=wo(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(Na._keyToDOMMap.delete(e),z(n)){let e=qf(n,Wa);eo(e,0,e.length-1,null)}if(n!==void 0){for(let e of lo(n).values()){let t=fo(e);$a(e,null),t!==null&&t.remove()}Ad(Ya,Pa,Va,n,`destroyed`)}}}function eo(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&$a(t,r)}}function to(e,t){e.setProperty(`text-align`,t)}var no=`40px`;function ro(e,t){let n=Ma.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${no}))`)}function io(e,t){let n=e.style;t===0?to(n,``):t===1?to(n,`left`):t===2?to(n,`center`):t===3?to(n,`right`):t===4?to(n,`justify`):t===5?to(n,`start`):t===6&&to(n,`end`)}function ao(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(fu(e))return null;let n=e.getParent();return n===null||Gd(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function oo(e){let t=of().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function so(e,t,n){t||e.contentEditable===`false`?zf(n,Na):n.removeAttribute(`contenteditable`)}function co(e,t,n){let r=N,i=Ra();N=``;let a=``,o=B(e);for(let[r,i]of n){let n=oo(r);so(t,o,n),t.appendChild(n),N=``;let s=Ra();mo(i,Ef(e,n,Na)),za(s),uo(e,r,t,n),a+=N}return za(i),N=r,a}function lo(e){return Xf(e)&&e.__slots!==null?e.__slots:Yf}function uo(e,t,n,r){let i=Xa.$getSlotTargetElement(e,t,n,Na);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function fo(e){let t=qa.get(e);return t===void 0?null:t.parentElement}function po(e,t,n){let r=lo(e),i=lo(t);for(let[e,t]of r)if(!i.has(e)){let e=fo(t);$a(t,null),e!==null&&e.remove()}let a=N,o=Ra(),s=``,c=null,l=B(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:fo(i);N=``;let u=Ra();if(o===null){o=oo(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),mo(a,Ef(t,o,Na))}else i===a?yo(a,o):(i!==void 0&&$a(i,o),mo(a,Ef(t,o,Na)));if(za(u),so(n,l,o),uo(t,e,n,o),s+=N,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return za(o),N=a,s}function mo(e,t){let n=Ka.get(e);if(n===void 0&&M(60),t!==null){let r=Wa.get(e);if(r!==void 0){let i=qa.get(e);if(i!==void 0){let a=Zf(r)?r.__slotHost:null,o=Zf(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),yo(e,t.element)}}}let r=Xa.$createDOM(n,Na);if(function(e,t,n){let r=n._keyToDOMMap;sd(t,n,e),r.set(e,t)}(e,r,Na),F(n)?r.setAttribute(`data-lexical-text`,`true`):B(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),Lf(r,{captureSelection:!0})),z(n)){let e=n.__indent,t=n.__size;ao(r,n),e!==0&&ro(r,e);let i=lo(n),a=i.size>0?co(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,N+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=N,o=t-1;if(ho(qf(n,Ka),n,0,o,Ef(n,r,Na)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,N=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&io(r,o),n.isInline()||go(null,n,r)}else{let t=n.getTextContent();if(B(n)){let t=n.decorate(Na,Ma);t!==null&&bo(e,t),r.contentEditable=`false`;let i=lo(n);i.size>0&&co(n,r,i)}N+=t}return t!==null&&t.insertChild(r),Xa.$decorateDOM(n,null,r,Na),Aa(n),Ad(Ya,Pa,Va,n,`created`),r}function ho(e,t,n,r,i){let a=N,o=Ra();N=``,Fa=null,Ia=null,La=null;let s=n;for(;s<=r;++s){let t=Ra();mo(e[s],i);let n=Ka.get(e[s]);n!==null&&F(n)?Fa===null&&(Fa=n.getFormat(),Ia=n.getStyle(),La=n.__key):z(n)&&s<r&&!n.isInline()&&(N+=Oi),za(t)}let c=Na._keyToDOMMap.get(t.__key);c===void 0&&M(349,t.__key),c.__lexicalTextContent=N,c.__lexicalFirstTextKey=La,N=a+N,za(o)}function go(e,t,n){let r=Ef(t,n,Na),i=r.element.__lexicalLastChildKind??null,a=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Su(e)?`line-break`:B(e)&&e.isInline()?`decorator`:null}return lo(e).size>0?null:`empty`}return null}(t,Ka);i!==a&&r.setManagedLineBreak(a)}function _o(e,t,n){var r;Fa=null,Ia=null,La=null,function(e,t,n){let r=N,i=e.__size,a=t.__size;N=``;let o=n.element,s=Na._keyToDOMMap.get(t.__key);s===void 0&&M(351,t.__key);let c=a-i;if(!Za&&Math.abs(c)<=1&&i>=ja&&e.__first===t.__first&&(c!==0||!Na._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=Ja.get(e.__key);if(!Za&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=Ka.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=ka(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=Ka.get(n);if(e===void 0)break;let t=Ra();yo(n,o),F(e)&&Fa===null&&(Fa=e.getFormat(),Ia=e.getStyle(),La=e.__key),za(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=Ka.get(n);if(e===void 0)break;let t;if(z(e)){let r=Na._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&z(e)&&!e.isInline()&&(d+=Oi),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,N=r+m,vo(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=Wa.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=Ka.get(a),d=Wa.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=Ka.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=Wa.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let b=ka(l,c);for(let e of _){let t=Ra();if(e.kind===`reconcile`)yo(e.key,n.element);else if(e.kind===`destroy`)$a(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=Na._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}mo(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=Ka.get(e.key);t&&F(t)&&Fa===null&&(Fa=t.getFormat(),Ia=t.getStyle(),La=t.__key)}za(t)}let x=``;for(let e=0;e<o;e++){let t=Ka.get(f[e]);if(t===void 0)return!1;let n;if(z(t)){let r=Na._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(350,t.getType()),n=i}else n=t.getTextContent();x+=n,e<o-1&&z(t)&&!t.isInline()&&(x+=Oi)}let S=r.__lexicalSlotTextLength||0,C=S>0?i.slice(S):i;return r.__lexicalTextContent=C.slice(0,C.length-b)+x,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&M(353),N=r+e,vo(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=Ka.get(t);if(e===void 0)break;let r=Za||Ua.has(t)||Ha.has(t),i=Ra();if(r)yo(t,o);else{let n,r;if(z(e)){r=qa.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(354,e.getType()),n=i}else n=e.getTextContent();N+=n,r!==void 0&&Ba(r)}F(e)?Fa===null&&(Fa=e.getFormat(),Ia=e.getStyle(),La=e.__key):z(e)&&n<a-1&&!e.isInline()&&(N+=Oi),za(i),t=e.__next,n++}s.__lexicalTextContent=N,s.__lexicalFirstTextKey=La,N=r+N;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)yo(r,o);else{let e=wo(r),t=mo(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}$a(r,null)}let a=Ka.get(i);F(a)&&Fa===null&&(Fa=a.getFormat(),Ia=a.getStyle(),La=a.__key)}else{let r=qf(e,Wa),s=qf(t,Ka);if(r.length!==i&&M(227),s.length!==a&&M(228),i===0)a!==0&&ho(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&lo(t).size===0&&n.element.__lexicalLineBreak==null;eo(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=Ra();if(e===r)u=xo(yo(r,a.element)),d++,f++;else{if(l===void 0&&(l=So(n,f)),c===void 0)c=So(t,d);else if(!c.has(e)){d++,za(i);continue}if(!l.has(e)){u=xo(wo(e)),$a(e,a.element),d++,c.delete(e),za(i);continue}if(c.has(r)){let e=Pd(Na,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=xo(yo(r,a.element)),d++,f++}else mo(r,a.withBefore(u??a.before)),f++}let o=Ka.get(r);o!==null&&F(o)?Fa===null&&(Fa=o.getFormat(),Ia=o.getStyle(),La=o.__key):z(o)&&f<=s&&!o.isInline()&&(N+=Oi),za(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:Na.getElementByKey(t);ho(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&eo(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=N,s.__lexicalFirstTextKey=La,N=r+N}(e,t,Ef(t,n,Na)),Gd(t)||(r=t,Fa==null||Fa===r.__textFormat||Qa||r.setTextFormat(Fa),function(e){Ia==null||Ia===e.__textStyle||Qa||e.setTextStyle(Ia)}(t))}function vo(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=Ka.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=Ka.get(r);if(F(e))return Fa=e.getFormat(),void(Ia=e.getStyle())}}t.__lexicalFirstTextKey=La}function yo(e,t){let n=Wa.get(e),r=Ka.get(e);n!==void 0&&r!==void 0||M(61);let i=Za||Ua.has(e)||Ha.has(e),a=Pd(Na,e);if(n===r&&!i){let e;if(z(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&M(355,n.getType()),e=t,Ba(a)}else e=n.getTextContent();return N+=e,a}if(n!==r&&i&&Ad(Ya,Pa,Va,r,`updated`),Xa.$updateDOM(r,n,a,Na)){let n=mo(e,null);return t===null&&M(62),t.replaceChild(n,a),$a(e,null),n}if(z(n)){z(r)||M(334,e);let t=r.__indent;(Za||t!==n.__indent)&&ro(a,t);let o=r.__format;(Za||o!==n.__format)&&io(a,o);let s=i&&(lo(r).size>0||lo(n).size>0)?po(n,r,a):``;if(i){let e=N;if(_o(n,r,a),fu(r)||r.isInline()||go(0,r,a),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,N=e+s+t,a.__lexicalSlotTextLength=s.length}else(lo(r).size>0||lo(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&M(356,n.getType()),N+=e,Ba(a)}if((Za||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(ao(a,r),fu(r)&&!Za))for(let e of r.getChildren())z(e)&&ao(Pd(Na,e.getKey()),e)}else{let t=r.getTextContent();if(B(r)){let t=r.decorate(Na,Ma);t!==null&&bo(e,t),i&&(lo(r).size>0||lo(n).size>0)&&po(n,r,a)}N+=t}if(!Qa&&fu(r)){let e=r.getLatest();if(e.__cachedText!==N){let t=e.getWritable();t.__cachedText=N,r=t}}return Xa.$decorateDOM(r,n,a,Na),Aa(r),a}function bo(e,t){let n=Na._pendingDecorators,r=Na._decorators;if(n===null){if(r[e]===t)return;n=ud(Na)}n[e]=t}function xo(e){let t=e.nextSibling;return t!==null&&t===Na._blockCursorElement&&(t=t.nextSibling),t}function So(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function Co(e,t,n,r,i,a){N=``,Fa=null,Ia=null,La=null,Za=r===2,Na=n,Ma=n._config,Xa=n._config.dom||Mu,Pa=n._nodes,Va=Na._listeners.mutation,Ha=i,Ua=a,Wa=e._nodeMap,Ga=e,Ka=t._nodeMap,Qa=t._readOnly,qa=Yi(n._keyToDOMMap),Ja=function(){let e=new Map,t=t=>{for(let n of t){let t=Ka.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(Ha.keys()),t(Ua),e}();let o=new Map;return Ya=o,yo(`root`,null),Na=void 0,Pa=void 0,Ha=void 0,Ua=void 0,Wa=void 0,Ga=void 0,Ka=void 0,Ma=void 0,qa=void 0,Ja=void 0,Ya=void 0,Xa=Mu,o}function wo(e){let t=qa.get(e);return t===void 0&&M(75,e),t}function P(e){return{type:e}}var To=P(`SELECTION_CHANGE_COMMAND`),Eo=P(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Do=P(`CLICK_COMMAND`),Oo=P(`BEFORE_INPUT_COMMAND`),ko=P(`INPUT_COMMAND`),Ao=P(`COMPOSITION_START_COMMAND`),jo=P(`COMPOSITION_END_COMMAND`),Mo=P(`DELETE_CHARACTER_COMMAND`),No=P(`INSERT_LINE_BREAK_COMMAND`),Po=P(`INSERT_PARAGRAPH_COMMAND`),Fo=P(`CONTROLLED_TEXT_INSERTION_COMMAND`),Io=P(`PASTE_COMMAND`),Lo=P(`REMOVE_TEXT_COMMAND`),Ro=P(`DELETE_WORD_COMMAND`),zo=P(`DELETE_LINE_COMMAND`),Bo=P(`FORMAT_TEXT_COMMAND`),Vo=P(`SET_TEXT_FORMAT_COMMAND`),Ho=P(`UNDO_COMMAND`),Uo=P(`REDO_COMMAND`),Wo=P(`KEYDOWN_COMMAND`),Go=P(`KEY_ARROW_RIGHT_COMMAND`),Ko=P(`MOVE_TO_END`),qo=P(`KEY_ARROW_LEFT_COMMAND`),Jo=P(`MOVE_TO_START`),Yo=P(`KEY_ARROW_UP_COMMAND`),Xo=P(`KEY_ARROW_DOWN_COMMAND`),Zo=P(`KEY_ENTER_COMMAND`),Qo=P(`KEY_SPACE_COMMAND`),$o=P(`KEY_BACKSPACE_COMMAND`),es=P(`KEY_ESCAPE_COMMAND`),ts=P(`KEY_DELETE_COMMAND`),ns=P(`KEY_TAB_COMMAND`),rs=P(`INSERT_TAB_COMMAND`),is=P(`INDENT_CONTENT_COMMAND`),as=P(`OUTDENT_CONTENT_COMMAND`),os=P(`DROP_COMMAND`),ss=P(`FORMAT_ELEMENT_COMMAND`),cs=P(`DRAGSTART_COMMAND`),ls=P(`DRAGOVER_COMMAND`),us=P(`DRAGEND_COMMAND`),ds=P(`COPY_COMMAND`),fs=P(`CUT_COMMAND`),ps=P(`SELECT_ALL_COMMAND`),ms=P(`CLEAR_EDITOR_COMMAND`),hs=P(`CLEAR_HISTORY_COMMAND`),gs=P(`CAN_REDO_COMMAND`),_s=P(`CAN_UNDO_COMMAND`),vs=P(`FOCUS_COMMAND`),ys=P(`BLUR_COMMAND`),bs=P(`KEY_MODIFIER_COMMAND`);function xs(e){let t=new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function Ss(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}var Cs=Object.freeze({}),ws=[[`keydown`,function(e,t){let n=t._inputState;n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Fs(n),!t.isComposing()&&W(t,Wo,e)}],[`pointerdown`,function(e,t){let n=hf(e),r=e.pointerType;_f(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&ou(t,()=>{Bf(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],[`compositionstart`,function(e,t){W(t,Ao,e)}],[`compositionend`,function(e,t){let n=t._inputState;ui?n.compositionPhase=`ending-firefox`:fi||!mi&&!_i?W(t,jo,e):(n.compositionPhase=`ending-safari`,n.compositionEndData=e.data)}],[`input`,function(e,t){e.stopPropagation();let n=t._inputState;Fs(n),ou(t,()=>{Ls(e,t)||t.dispatchCommand(ko,e)},{event:e}),n.unprocessedBeforeInputData=null}],[`click`,function(e,t){ou(t,()=>{let n=R(),r=Qd(Vd(t)),i=ml();if(r){if(I(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!fu(t)&&U().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=lf(r,t._rootElement).anchorNode;(G(n)||Xu(n))&&fd(pl(i,r,t,e))}}W(t,Do,e)})}],[`cut`,Cs],[`copy`,Cs],[`dragstart`,Cs],[`dragover`,Cs],[`dragend`,Cs],[`paste`,Cs],[`focus`,Cs],[`blur`,Cs],[`drop`,Cs]];di&&ws.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||ui&&Nd(t)||n!==`insertCompositionText`&&ou(t,()=>{Ls(e,t)||W(t,Oo,e)},{event:e})}(e,t)]);var Ts=new WeakMap,Es=new WeakMap,Ds=xs(e=>(e.addEventListener(`selectionchange`,qs),()=>e.removeEventListener(`selectionchange`,qs)));function Os(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=Wl(),u;if(a!==void 0)u=a;else{let e=Qd(Vd(l));u=e===null?null:lf(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!F(c)||(!i&&(!di||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||hd(n))&&o.offset!==s.offset&&!c.isComposing()||Yu(c)||c.isDirty()&&m>1||(i||!di)&&p!==null&&!c.isComposing()&&d!==Of(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Ju(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(F(t)||z(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function ks(e,t){return Xu(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function As(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=lf(e,t._rootElement),s=t._inputState;s.isSelectionChangeFromDOMUpdate&&(s.isSelectionChangeFromDOMUpdate=!1,ks(r,i)&&ks(a,o)&&!s.postDeleteSelectionToRestore)||ou(t,()=>{if(!n)return void fd(null);if(!Wu(t,r,a))return;let c=R();if(s.postDeleteSelectionToRestore&&I(c)&&c.isCollapsed()){let e=c.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(c=s.postDeleteSelectionToRestore.clone(),fd(c))}if(s.postDeleteSelectionToRestore=null,I(c)){let n=c.anchor,l=n.getNode();if(c.isCollapsed()){e.type===`Range`&&r===a&&(c.dirty=!0);let i=Vd(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=U(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)js(c,u,d);else if(n.type===`text`)F(l)||M(141),Ms(c,l);else if(n.type===`element`&&!g){z(l)||M(259);let e=n.getNode();e.isEmpty()?function(e,t){js(e,t.getTextFormat(),t.getTextStyle())}(c,e):js(c,c.format,``)}}else{let e=n.key,t=c.focus.key,r=c.getNodes(),a=r.length,s=c.isBackward(),l=s?o:i,u=s?i:o,d=s?t:e,f=s?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(F(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}c.format=m?p:0}}W(t,To,void 0)})}function js(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Ms(e,t){js(e,t.getFormat(),t.getStyle())}function Ns(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Ps(e){let{lastKeyCode:t}=Wl()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
24
+ `:t===`Tab`?` `:null;if(!n)return;let r=R();if(!I(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!F(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
25
+ `){if(Su(e))e.selectEnd();else if(!e){let e=Kf(i,cl),t=e&&e.getNextSibling();z(t)&&t.selectStart()}}else n===` `?Fc(e)&&e.selectEnd():F(e)&&e.getTextContent()[0]===n&&e.select(1,1)}else i.getTextContent()[a]===n&&i.select(a+1,a+1)}function Fs(e){e.isInsertTextAfterHandledSelectionCommand=!1,e.handledSelectionCommandTimeoutId!==null&&(clearTimeout(e.handledSelectionCommandTimeoutId),e.handledSelectionCommandTimeoutId=null)}function Is(e){Fs(e),e.isInsertTextAfterHandledSelectionCommand=!0,e.handledSelectionCommandTimeoutId=setTimeout(()=>Fs(e),0)}function Ls(e,t){let n=hf(e);if(G(n)&&Bf(n,t))return!0;let r=t.getRootElement();if(r===null)return!1;let i=mf(r.ownerDocument);return i!==null&&r.contains(i)&&Bf(i,t)}function Rs(e){let t=e.inputType,n=Ns(e),r=Wl(),i=r._inputState,a=R();if(t===`insertText`&&e.data&&i.isInsertTextAfterHandledSelectionCommand){if(Fs(i),e.preventDefault(),I(a)&&!a.isCollapsed()){let e=a.isBackward()?a.anchor:a.focus;a.anchor.set(e.key,e.offset,e.type),a.focus.set(e.key,e.offset,e.type)}return!0}if(t===`deleteContentBackward`){if(a===null){let e=ml();if(!I(e))return!0;fd(e.clone())}if(I(a)){let t=a.anchor.key===a.focus.key;if(function(e,t){return e.lastKeyCode===`MediaLast`&&t<e.lastKeyDownTimeStamp+30}(i,e.timeStamp)&&r.isComposing()&&t){if(id(null),i.lastKeyDownTimeStamp=0,setTimeout(()=>{ou(r,()=>{id(null)})},30),I(a)){let e=a.anchor.getNode();e.markDirty(),F(e)||M(142),Ms(a,e)}}else{if(id(null),fi&&n!==null&&!n.collapsed&&(a.applyDOMRange(n),!a.isCollapsed()))return e.preventDefault(),a.removeText(),!0;e.preventDefault();let o=a.anchor.getNode(),s=o.getTextContent(),c=o.canInsertTextAfter(),l=a.anchor.offset===0&&a.focus.offset===s.length,u=gi&&t&&!l&&c;if(u&&a.isCollapsed()&&(u=!B(Md(a.anchor,!0))),!u){W(r,Mo,!0);let e=R();gi&&I(e)&&e.isCollapsed()&&(i.postDeleteSelectionToRestore=e,setTimeout(()=>i.postDeleteSelectionToRestore=null))}}return!0}}if(!I(a))return!0;let o=e.data;i.unprocessedBeforeInputData!==null&&yd(!1,r,i.unprocessedBeforeInputData),a.dirty&&i.unprocessedBeforeInputData===null||!a.isCollapsed()||fu(a.anchor.getNode())||n===null||a.applyDOMRange(n),i.unprocessedBeforeInputData=null;let s=a.anchor,c=a.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
26
+ `)e.preventDefault(),W(r,No,!1);else if(o===Oi)e.preventDefault(),W(r,Po,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),a.insertRawText(t)}else o!=null&&Os(a,n,o,e.timeStamp,!0)?(e.preventDefault(),W(r,Fo,o),Ps(o)):i.unprocessedBeforeInputData=o;return i.lastBeforeInputInsertTextTimeStamp=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:W(r,Fo,e),Ps((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:{let t=i.hadOrphanedCompositionEvents;i.hadOrphanedCompositionEvents=!1;let n=r._compositionKey;id(null),t||W(r,Fo,e),Hs(n);break}case`insertLineBreak`:id(null),W(r,No,!1);break;case`insertParagraph`:id(null),i.isInsertLineBreak&&!fi?(i.isInsertLineBreak=!1,W(r,No,!1)):W(r,Po,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:W(r,Io,e);break;case`deleteByComposition`:(function(e,t){return e!==t||z(e)||z(t)||!Ju(e)||!Ju(t)})(l,u)&&W(r,Lo,e);break;case`deleteByDrag`:Ld(lc),W(r,Lo,e);break;case`deleteByCut`:W(r,Lo,e);break;case`deleteContent`:W(r,Mo,!1);break;case`deleteWordBackward`:W(r,Ro,!0);break;case`deleteWordForward`:W(r,Ro,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:W(r,zo,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:W(r,zo,!1);break;case`formatStrikeThrough`:W(r,Bo,`strikethrough`);break;case`formatBold`:W(r,Bo,`bold`);break;case`formatItalic`:W(r,Bo,`italic`);break;case`formatUnderline`:W(r,Bo,`underline`);break;case`historyUndo`:W(r,Ho,void 0);break;case`historyRedo`:W(r,Uo,void 0)}return!0}function zs(e){let t=Wl(),n=t._inputState,r=R(),i=e.data,a=Ns(e),o=!1;if(i!=null&&I(r)){let s=Qd(Vd(t)),c=s===null?null:lf(s,t._rootElement),l=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&!t.isComposing();l&&(n.hadOrphanedCompositionEvents=!0);let u=r.anchor.getNode(),d=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&t.isComposing()&&F(u)&&Yu(u);if(!l&&!d&&Os(r,a,i,e.timeStamp,!1,c)){if(o=!0,n.compositionPhase===`ending-firefox`){let e=Us(t,i);if(n.compositionPhase=`idle`,e)return Ld(uc),pd(),!0}let a=r.anchor.getNode();if(s===null||c===null)return!0;let l=r.isBackward(),u=l?r.anchor.offset:r.focus.offset,d=l?r.focus.offset:r.anchor.offset;di&&!r.isCollapsed()&&F(a)&&c.anchorNode!==null&&a.getTextContent().slice(0,u)+i+a.getTextContent().slice(u+d)===vd(c.anchorNode)||W(t,Fo,i);let f=i.length;ui&&f>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(r.anchor.offset-=f,r._cachedNodes=null,r._cachedIsBackward=null),gi&&t.isComposing()&&(n.lastKeyDownTimeStamp=0,id(null))}}return o||(yd(!1,t,i===null?void 0:i),n.compositionPhase===`ending-firefox`&&(Us(t,i||void 0),Ld(`composition-end`),n.compositionPhase=`idle`)),pd(),!0}function Bs(e){let t=Wl(),n=t._inputState,r=R();if(I(r)&&!t.isComposing()){n.compositionPhase=`composing`,n.hadOrphanedCompositionEvents=!1;let i=r.anchor,a=r.anchor.getNode();if(id(i.key),Ld(`composition-start`),e.timeStamp<n.lastKeyDownTimeStamp+30||i.type===`element`||!r.isCollapsed()||!gi&&(a.getFormat()!==r.format||F(a)&&a.getStyle()!==r.style)||F(a)&&(Yu(a)||i.offset===0&&!a.canInsertTextBefore()||i.offset===a.getTextContentSize()&&!a.canInsertTextAfter())){W(t,Fo,ki);let e=R();I(e)&&id(e.anchor.key)}}return!0}function Vs(e){let t=Wl();return t._inputState.compositionPhase=`idle`,Us(t,e.data),Ld(uc),!0}function Hs(e){if(e===null)return;let t=H(e);if(!F(t)||t.getType()===`text`||Yu(t)||!t.isAttached())return;let n=R(),r=I(n)&&n.anchor.key===e?n.anchor.offset:null,i=jc(t.getTextContent());if(i.setFormat(t.getFormat()),i.setStyle(t.getStyle()),t.replace(i),r!==null){let e=Math.min(r,i.getTextContentSize());i.select(e,e)}}function Us(e,t){let n=e._compositionKey;if(id(null),n!==null&&t!=null){if(t===``){let t=H(n),r=e.getElementByKey(n),i=r!==null&&F(t)?Of(t,r,e):null;if(i!==null&&i.nodeValue!==null&&F(t)){let n=Qd(Vd(e)),r=n&&lf(n,e._rootElement),a=null,o=null;r!==null&&r.anchorNode===i&&(a=r.anchorOffset,o=r.focusOffset),bd(t,i.nodeValue,a,o,!0)}return Hs(n),!1}if(t[t.length-1]===`
27
+ `){let t=R();if(I(t)||L(t)){if(I(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return W(e,Zo,null),Hs(n),!1}}let r=H(n);if(r!==null&&F(r)&&Yu(r)){r.markDirty();let e=R(),i=r.getTextContentSize(),a=I(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return yd(!0,e,t),Hs(n),!1}function Ws(e){let t=Wl(),n=t._inputState;if(e.key==null)return!0;if(n.compositionPhase===`ending-safari`){let r=Dd(e);if(r&&ou(t,()=>{Us(t,n.compositionEndData)}),n.compositionPhase=`idle`,n.compositionEndData=``,r)return!0}if(function(e){return wd(e,`ArrowRight`,{shiftKey:`any`})}(e))W(t,Go,e);else if(function(e){return wd(e,`ArrowRight`,{...Td,shiftKey:`any`})}(e))W(t,Ko,e);else if(function(e){return wd(e,`ArrowLeft`,{shiftKey:`any`})}(e))W(t,qo,e);else if(function(e){return wd(e,`ArrowLeft`,{...Td,shiftKey:`any`})}(e))W(t,Jo,e);else if(function(e){return wd(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))W(t,Yo,e);else if(function(e){return wd(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))W(t,Xo,e);else if(function(e){return wd(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))n.isInsertLineBreak=!0,W(t,Zo,e);else if(function(e){return e.key===` `}(e))W(t,Qo,e);else if(function(e){return li&&wd(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),n.isInsertLineBreak=!0,W(t,No,!0);else if(function(e){return wd(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))n.isInsertLineBreak=!1,W(t,Zo,e);else if(function(e){return wd(e,`Backspace`,{shiftKey:`any`})||li&&wd(e,`h`,{ctrlKey:!0})}(e))Dd(e)?W(t,$o,e)&&Is(n):(e.preventDefault(),W(t,Mo,!0));else if(function(e){return e.key===`Escape`}(e))W(t,es,e);else if(function(e){return wd(e,`Delete`,{})||li&&wd(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?W(t,ts,e):(e.preventDefault(),W(t,Mo,!1));else if(function(e){return wd(e,`Backspace`,Ed)}(e))e.preventDefault(),W(t,Ro,!0);else if(function(e){return wd(e,`Delete`,Ed)}(e))e.preventDefault(),W(t,Ro,!1);else if(function(e){return li&&wd(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),W(t,zo,!0);else if(function(e){return li&&(wd(e,`Delete`,{metaKey:!0})||wd(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),W(t,zo,!1);else if(function(e){return wd(e,`b`,Td)}(e))e.preventDefault(),W(t,Bo,`bold`);else if(function(e){return wd(e,`u`,Td)}(e))e.preventDefault(),W(t,Bo,`underline`);else if(function(e){return wd(e,`i`,Td)}(e))e.preventDefault(),W(t,Bo,`italic`);else if(function(e){return wd(e,`Tab`,{shiftKey:`any`})}(e))W(t,ns,e);else if(function(e){return wd(e,`z`,Td)}(e))e.preventDefault(),W(t,Ho,void 0);else if(function(e){return li?wd(e,`z`,{metaKey:!0,shiftKey:!0}):wd(e,`y`,{ctrlKey:!0})||wd(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),W(t,Uo,void 0);else{let r=t._editorState._selection;(function(e){return wd(e,`a`,Td)})(e)?(e.preventDefault(),W(t,ps,e)&&Is(n)):r===null||I(r)||(function(e){return wd(e,`c`,Td)}(e)?(e.preventDefault(),W(t,ds,e)):function(e){return wd(e,`x`,Td)}(e)&&(e.preventDefault(),W(t,fs,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(bs,e),!0}function Gs(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Ks=new Map;function qs(e){let t=$d(e.target);if(t===null)return;let n=Id(e.target),r=null,i=null,a=n===null?void 0:Es.get(n);if(n!==null){if(a!==void 0){let e=a.editors,n=a.hasShadowEditor;if(n===void 0){n=!1;for(let t of e)if(t._rootElement!==null&&ef(t._rootElement.getRootNode())){n=!0;break}a.hasShadowEditor=n}if(n){let n=null,a=null;for(let o of e){let e=o._rootElement;if(e===null)continue;let s=lf(t,e).anchorNode;if(s!==null&&Ku(s)===o){if(ef(e.getRootNode())){r=o,i=s;break}n===null&&(n=o,a=s)}}r===null&&n!==null&&(r=n,i=a)}else{let e=t.anchorNode;e===null||G(e)&&e.shadowRoot!==null||(r=Ku(e),r!==null&&(i=e))}}if(r===null){let e=mf(n);r=e===null?null:Ku(e)}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(a!==void 0)for(let e of a.editors)e._inputState.isSelectionChangeFromMouseDown=!1;ou(r,()=>{let n=ml(),a=i??lf(t,r._rootElement).anchorNode;(G(a)||Xu(a))&&fd(pl(n,t,r,e))})}let o=gd(r),s=o[o.length-1],c=s._key,l=Ks.get(c),u=l||s;u!==r&&As(t,u,!1),As(t,r,!0),r===s?l&&Ks.delete(c):Ks.set(c,r)}function Js(e){e._lexicalHandled=!0}function Ys(e){return!0===e._lexicalHandled}function Xs(e){let t=Ts.get(e);if(t===void 0)return;let n=Es.get(t);if(n===void 0)return;Ts.delete(e);let r=qu(e);Gu(r)?(function(e){if(e._parentEditor!==null){let t=gd(e),n=t[t.length-1]._key;Ks.get(n)===e&&Ks.delete(n)}else Ks.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&M(198);let i=Gs(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}function Zs(e,t,n){Bl();let r=e.__key,i=e.getParent();if(i===null)return void(Qf(e)!==null&&M(367,r,String(Qf(e))));let a=function(e){let t=R();if(!I(t)||!z(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return zd(i,e)&&n.set(e.__key,0,`element`),zd(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(I(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(_l(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(_l(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else L(a)&&t&&e.isSelected()&&e.selectPrevious();if(I(a)&&t&&!o){let t=e.getIndexWithinParent();nd(e),hl(a,i,t,-1)}else nd(e);n||Gd(i)||i.canBeEmpty()||!i.isEmpty()||Zs(i,t),t&&a&&fu(i)&&i.isEmpty()&&i.selectEnd()}function Qs(e){return e}var $s=Symbol.for(`ephemeral`);function ec(e){return e[$s]||!1}var tc={configurable:!0,enumerable:!1,value:void 0,writable:!0},nc=class{__type;__key;__parent;__prev;__next;__state;[Oa];static getType(){let{ownNodeType:e}=Uf(this);return e===void 0&&M(64,this.name),e}static clone(e){M(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Jf(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",tc),Object.defineProperty(this,Oa,tc),td(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=H(e);if(t===null)break;e=t.__parent===null?Qf(t):t.__parent}return!1}isSelected(e){let t=e||R();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(F(this))return n;if(I(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(B(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:H(e)}getParentOrThrow(){let e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(Gd(t)||Qf(e)!==null)return z(e)||e===this&&B(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:H(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:H(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=z(this)?this:this.getParent(),n=z(e)?e:e.getParent(),r=t&&n?Jp(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=Jp(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?Gp(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&M(279),!1)))}isParentOf(e){return zd(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=z(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&M(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=Wl()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(ec(this))return this;let e=H(this.__key);return e===null&&M(113),e}getWritable(){if(ec(this))return this;Bl();let e=Hl(),t=Wl(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=R();if(o!==null&&o.setCachedNodes(null),a.has(r))return rd(i),i;let s=Mf(i);return a.add(r),rd(s),n.set(r,s),s}getTextContent(){return dp(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}getDOMSlot(e){return new Vi(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){M(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of _a(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&ga(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){Zs(this,!0,e)}replace(e,t){Bl();let n=R();n!==null&&(n=n.clone()),Jd(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();nd(o),l!==null&&I(n)&&hl(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;Zs(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;t&&(z(this)&&z(o)||M(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren()));let _=rp(this);if(_.length>0){Xf(this)&&Xf(o)||M(368,this.__key,o.__key);for(let e of _){let t=ip(this,e);t!==null&&(hp(this,e),mp(o,e,t))}}if(I(n)){fd(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):zc(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):zc(r,o))}return ad()===i&&id(a),o}insertAfter(e,t=!0){Bl(),Jd(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.getParent(),a=R(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(I(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}nd(r),t&&I(a)&&hl(a,i,n,-1)}else nd(r);let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&I(a)){let e=this.getIndexWithinParent();hl(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Bl(),Jd(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.__key,a=R(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();nd(r),o!==null&&t&&I(a)&&hl(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&I(a)&&hl(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return V()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Bl();let n=$f(this);if(n!==null)return n.selectPrevious(e,t);let r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(z(r))return r.select();if(!F(r)){let e=r.getIndexWithinParent()+1;return i.select(e,e)}return r.select(e,t)}selectNext(e,t){Bl();let n=$f(this);if(n!==null)return n.selectNext(e,t);let r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(z(r))return r.select(0,0);if(!F(r)){let e=r.getIndexWithinParent();return i.select(e,e)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function rc(e){return e instanceof nc}var ic=`historic`,ac=`history-push`,oc=`history-merge`,sc=`skip-scroll-into-view`,cc=`skip-dom-selection`,lc=`skip-selection-focus`,uc=`composition-end`,dc=`!important`;function fc(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function pc(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===dc?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function mc(e,t,n=``){if(t===n)return;let r=fc(n),i=fc(t);for(let t in i)delete r[t],pc(e,t,i[t]);for(let t in r)e.removeProperty(t)}function hc(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function gc(e,t){return 1&t?`strong`:2&t?`em`:`span`}function _c(e,t,n,r,i){let a=r.classList,o=kd(i,`base`);o!==void 0&&a.add(...o),o=kd(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Mi){let r=Mi[e];if(o=kd(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}}function vc(e,t,n){let r=n.isComposing(),i=e+(r?Di:``),a=wf(),o=Tf(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(of().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||ui){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}}function yc(e,t,n,r,i,a){vc(i,e,t);let o=a.theme.text;o!==void 0&&_c(0,0,r,e,o)}function bc(e,t){let n=of().createElement(t);return n.appendChild(e),n}function xc(e){return e!=null&&!0===e.__isInlineFormattable}var Sc=class e extends nc{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}static getType(){return`text`}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return Li[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ad()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Mi[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return $u(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=hc(0,n),i=gc(0,n),a=r===null?i:r,o=of().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=of().createElement(i),o.appendChild(s)),yc(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&mc(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=hc(0,i),s=hc(0,a),c=gc(0,i),l=gc(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??M(48);let i=of().createElement(l);return yc(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??M(49)),vc(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&_c(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&mc(t.style,p,f),!1}static importDOM(){return{"#text":()=>({conversion:Dc,priority:0}),b:()=>({conversion:wc,priority:0}),code:()=>({conversion:Ac,priority:0}),em:()=>({conversion:Ac,priority:0}),i:()=>({conversion:Ac,priority:0}),mark:()=>({conversion:Ac,priority:0}),s:()=>({conversion:Ac,priority:0}),span:()=>({conversion:Cc,priority:0}),strong:()=>({conversion:Ac,priority:0}),sub:()=>({conversion:Ac,priority:0}),sup:()=>({conversion:Ac,priority:0}),u:()=>({conversion:Ac,priority:0})}}static importJSON(e){return jc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return G(t)||M(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=bc(t,`b`)),this.hasFormat(`italic`)&&(t=bc(t,`i`)),this.hasFormat(`strikethrough`)&&(t=bc(t,`s`)),this.hasFormat(`underline`)&&(t=bc(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Mi[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Ni[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=$u(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Ii[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Bl();let n=e,r=t,i=R(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!I(i))return ll(o,n,o,r,`text`,`text`);{let e=ad();e!==i.anchor.key&&e!==i.focus.key||id(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=R();if(r&&I(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Bl();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=ad(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=R();if(I(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=jc(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Sa(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=jc(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Sa(t,n);let a=n.__key;i===r&&id(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&rd(t),n!==null&&rd(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),I(v)&&hl(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;ad()===r&&id(n);let o=R();if(I(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&vl(i,t,n,e,a),s!==null&&s.key===r&&vl(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function Cc(e){return{forChild:Mc(e.style),node:null}}function wc(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Mc(t.style,n?void 0:`bold`),node:null}}var Tc=new WeakMap;function Ec(e){if(!G(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Dc(e){let t=e;e.parentElement===null&&M(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Tc.get(n))===void 0&&!Ec(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Tc.set(r[e],i);return i}(t)!==null)return{node:wl(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=Oc(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=Oc(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:jc(n)}}function Oc(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,G(n)){let e=n.style.display;if(e===``&&!bf(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Xu(n))return n;if(n.nodeName===`BR`)return null}}var kc={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Ac(e){let t=kc[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Mc(e.style,t),node:null}}function jc(e=``){return qd(new Sc(e))}function F(e){return e instanceof Sc}function Mc(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>((F(e)||xc(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}var Nc=class e extends Sc{static getType(){return`tab`}static clone(t){return new e(t.__key)}constructor(e){super(` `,e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=kd(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return Pc().updateFromJSON(e)}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||M(286),this}setDetail(e){return e!==2&&M(127),this}setMode(e){return e!==`normal`&&M(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Pc(){return qd(new Nc)}function Fc(e){return e instanceof Nc}var Ic=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Wp(im(Yp(this,`next`)),im(Yp(e,`next`)))<0}getNode(){let e=H(this.key);return e===null&&M(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,zl()||(ad()===a&&id(e),i!==null&&(i.setCachedNodes(null),I(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function Lc(e,t,n){return new Ic(e,t,n)}function Rc(e,t){let n=t.__key,r=e.offset,i=`element`;if(F(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!z(t)){let e=t.getNextSibling();if(F(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function zc(e,t){if(z(t)){let n=t.getLastDescendant();z(n)||F(n)?Rc(e,n):Rc(e,t)}else Rc(e,t)}var Bc=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!L(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>Qf(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(F(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=H(e);t!==null&&n.push(t)}return zl()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>Qf(e)===null);if((R()||ml())===this&&e[0]){let t=jp(e[0],`next`);Zp(Hp(t,t))}for(let t of e)t.remove();Vc()}};function Vc(){let e=U();if(e.isEmpty()){let t=V();e.append(t),t.select()}}function I(e){return e instanceof Hc}var Hc=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!I(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=new Set;for(let n of e)if(Dp(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;z(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Ep(e.focus)&&z(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=Fp(e.focus.origin,`previous`);Dp(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Lp(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!z(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=im(e.anchor),r=im(e.anchor.getFlipped()),i=e=>Tp(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(sm($p(this),`next`));return zl()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=qc(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(z(d)&&!d.isInline()){l||(c+=`
28
+ `);let e=``;for(let t of rp(d)){let n=ip(d,t);n!==null&&(e+=n.getTextContent())}e===``?l=!d.isEmpty():(c+=e,l=!1)}else if(l=!1,F(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else!B(d)&&!Su(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=Wl(),n=t.getEditorState()._selection,r=sl(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),Ea(this)}clone(){let t=this.anchor,n=this.focus;return new e(Lc(t.key,t.offset,t.type),Lc(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=$u(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Mi[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(wl(e))}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,a=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(a=n,o=t),a.type===`element`&&function(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=jc();if(o.setFormat(n),o.setStyle(r),Ou(a))a.splice(0,0,[o]);else if(a!==null){let e=Gd(i)?V().append(o):o;a.insertBefore(e)}else if(Gd(i)){let e=i.getLastChild();z(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(V().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}(a,o,r,i),o.type===`element`&&Xp(o,im(Yp(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];F(d)||M(26);let f=d.getTextContent().length,p=d.getParentOrThrow(),m=l[u-1];if(u===1&&o.type===`element`&&(c=f,o.set(a.key,c,`text`)),this.isCollapsed()&&s===f&&(Yu(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling(),n;if(F(t)&&t.canInsertTextBefore()&&!Yu(t)?n=t:(n=jc(),n.setFormat(r),n.setStyle(i),p.canInsertTextAfter()?d.insertAfter(n):p.insertAfter(n)),n.select(0,0),d=n,e!==``)return void this.insertText(e)}else if(this.isCollapsed()&&s===0&&(Yu(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling(),n;if(!F(t)||Yu(t)?(n=jc(),n.setFormat(r),p.canInsertTextBefore()?d.insertBefore(n):p.insertBefore(n)):n=t,n.select(),d=n,e!==``)return void this.insertText(e)}else if(d.isSegmented()&&s!==f){if(ad()!==null)d=d.setMode(`normal`).setFormat(r).setStyle(i);else{let e=jc(d.getTextContent());e.setFormat(r),d.replace(e),d=e}}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||z(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),rl(this.anchor,this.focus),void this.insertText(e)}if(u===1){if(Ju(d)){let t=jc(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(Fc(d)){let t=jc(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=jc(e);if(t.setFormat(r),t.setStyle(i),t.select(),s===0)d.insertBefore(t,!1);else{let[e]=d.splitText(s);e.insertAfter(t,!1)}t.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null);return}d.setFormat(r),d.setStyle(i)}let a=c-s;d=d.spliceText(s,a,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{let t=new Set([...d.getParentKeys(),...m.getParentKeys()]),n=z(d)?d:d.getParentOrThrow(),r=z(m)?m:m.getParentOrThrow(),i=m;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline());if(o.type===`text`&&(c!==0||m.getTextContent()===``)||o.type===`element`&&m.getIndexWithinParent()<c){if(F(m)&&!Ju(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=jc(m.getTextContent());m.replace(e),m=e}fu(o.getNode())||o.type!==`text`||(F(m)||M(395),m=m.spliceText(0,c,``)),t.add(m.__key)}else{let e=m.getParentOrThrow();e.canBeEmpty()||e.getChildrenSize()!==1?m.remove():e.remove()}}else t.add(m.__key);let a=r.getChildren(),p=new Set(l),h=n.is(r),g=n.isInline()&&d.getNextSibling()===null?n:d;for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.is(d)||z(t)&&t.isParentOf(d))break;t.isAttached()&&(!p.has(t)||t.is(i)?h||g.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;e!==null;){let r=e.getChildren(),i=r.length;(i===0||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Ju(d)){if(s===f)d.select();else{let t=jc(e);t.select(),d.replace(t)}}else d=d.spliceText(s,f-s,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<u;e++){let n=l[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=R()===this;Qp(this,rm($p(this))),e&&R()!==this&&fd(this)}formatText(e,t=null){Gc(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&z(t)&&Qf(t)!==null){let n=t.isShadowRoot()?t.getFirstChild()??t.append(V()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&n!==null&&!z(n)){let e=V();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=R();return I(t)||M(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&Gd(t)){let n=kl(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Kf(n,Cf),i=e[e.length-1];if(z(r)&&`__language`in r){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=El(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(z(e)||B(e))&&!e.isInline())){z(r)||M(211,n.constructor.name,n.getType());let t=El(this);r.splice(t,0,e),i.selectEnd();return}if(z(r)&&Qf(r)!==null){let t=El(this),n=Tl(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}if(r===null){let t=kl(e),n=t.getLastDescendant(),r=Yp(this.anchor,`next`);for(let e of t.getChildren())r=fm(e,r);n!==null&&n.selectEnd();return}if(z(r)&&!r.isParentRequired()&&!Gd(r.getParentOrThrow())){let t=El(this),n=Tl(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}let a=kl(e),o=a.getLastDescendant(),s=a.getChildren(),c=!z(r)||!r.isEmpty()?this.insertParagraph():null;c&&!r.isAttached()&&(n=this.anchor.getNode(),r=Kf(n,Cf));let l=s[s.length-1],u=s[0];var d;z(d=u)&&Cf(d)&&!d.isEmpty()&&z(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(z(r)||M(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=s[1]),u&&(r===null&&M(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||M(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(r,u));let f=Kf(o,Cf);c&&z(f)&&(c.canMergeWhenEmpty()||Cf(l))&&(f.append(...c.getChildren()),c.remove()),z(r)&&r.isEmpty()&&r.remove(),o.selectEnd();let p=z(r)?r.getLastChild():null;Su(p)&&f!==r&&p.remove()}insertParagraph(){let e=this.anchor.getNode();if(this.anchor.type===`element`&&Gd(e)){let t=V();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let t=El(this),n=Kf(this.anchor.getNode(),Cf);if(n!==null&&Qf(n)!==null)return null;z(n)||M(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=xu();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=qc(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(F(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(F(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),F(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(Al(this,e,t,n))return;let r=e===`move`,i=Wl(),a=Qd(Vd(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!z(c)||c.isInline()||c.canBeEmpty()||Zd(o,i,s);let l=Pd(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=F(c)?Of(c,l,i):null),this.dirty){let e=Pd(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=F(n)?Of(n,e,i):null}t&&u&&yl(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&F(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=jp(c,t?`previous`:`next`).getNodeAtCaret();if(F(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?Of(e,n,i):null;if(r){let e=t?r.length:0;yl(a,r,e,r,e)}}}}if(Xc(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=sf(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=fu(o)?o:Ud(o);this.applyDOMRange(n),this.dirty=!0,!r&&(Zc(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||Yc(this))}n===`lineboundary`&&Al(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&z(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(z(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=Bp(Yp(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(Dp(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(z(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=im(t);Qp(this,Hp(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(Ep(t)){if(z(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(B(t.origin)){if(!t.origin.isIsolated()){if(rp(t.origin).length>0){if(z(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=dl();e.add(t.origin.getKey()),fd(e)}}else if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&z(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=dl();e.add(t.origin.getKey()),fd(e)}else t.origin.remove()}return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return rp(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(Qp(this,Hp(!t.origin.isEmpty()&&n.isEmpty()?em(jp(n,t.direction)):r.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(Qf(e)!==null)return;if(z(e)&&e.isShadowRoot())break;e=e.getParent()}}let i=this.focus;if(Qc(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&Jc(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void el(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void el(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(hd(e)||$c(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&fu(e.getParent())&&e.getPreviousSibling()===null&&Jc(this,e),Vc()}}deleteLine(e){let t=il(this.anchor);if(t!==null&&B($f(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&Qc(this,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):Kf(this.anchor.getNode(),Cf)===Kf(this.focus.getNode(),Cf)?this.removeText():(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e))}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;Qc(this,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return zl()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function L(e){return e instanceof Bc}function Uc(e,t){if(L(e)){for(let n of e.getNodes())xc(n)&&n.setFormat(t(n.getFormat()));return}if(e.isCollapsed())return e.setFormat(t(e.format)),void id(null);let n=[];for(let r of e.getNodes())F(r)?n.push(r):z(r)?r.setTextFormat(t(r.getTextFormat())):xc(r)&&r.setFormat(t(r.getFormat()));let r=n.length;if(r===0)return e.setFormat(t(e.format)),void id(null);let i=e.anchor,a=e.focus,o=e.isBackward(),s=o?a:i,c=o?i:a,l=0,u=n[0],d=s.type===`element`?0:s.offset;if(s.type===`text`&&d===u.getTextContentSize()&&(l=1,u=n[1],d=0),u==null)return;let f=r-1,p=n[f],m=c.type===`text`?c.offset:p.getTextContentSize();if(u.is(p)){if(d===m)return;let n=t(u.getFormat());if(Yu(u)||d===0&&m===u.getTextContentSize())u.setFormat(n);else{let e=u.splitText(d,m),t=d===0?e[0]:e[1];t.setFormat(n),s.type===`text`&&s.set(t.__key,0,`text`),c.type===`text`&&c.set(t.__key,m-d,`text`)}e.format=n;return}d===0||Yu(u)||([,u]=u.splitText(d),d=0);let h=t(u.getFormat());u.setFormat(h);let g=t(p.getFormat());m>0&&(m===p.getTextContentSize()||Yu(p)||([p]=p.splitText(m)),p.setFormat(g));for(let e=l+1;e<f;e++){let r=n[e];r.setFormat(t(r.getFormat()))}s.type===`text`&&s.set(u.__key,d,`text`),c.type===`text`&&c.set(p.__key,m,`text`),e.format=h|g}function Wc(e,t){let n=[];for(let[e,r]of Object.entries(t))typeof r==`boolean`&&n.push([e,r]);n.length!==0&&Uc(e,e=>{for(let[t,r]of n)e=$u(e,t,r?Mi[t]:0);return e})}function Gc(e,t,n=null){let r=n===null&&I(e)?$u(e.format,t,null):n;Uc(e,e=>$u(e,t,r))}function Kc(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function qc(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[Kc(n),Kc(r)]}function Jc(e,t){for(let n=t;n;n=n.getParent()){if(z(n)){if(n.collapseAtStart(e))return!0;if(Gd(n))break}if(n.getPreviousSibling())break}return!1}function Yc(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function Xc(e,t,n,r){e.modify(t,n,r)}function Zc(e,t,n){let r=e.getNodes(),i=r.filter(e=>zd(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=z(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function Qc(e,t,n){if(Al(e,`extend`,t,n))return;let r=Wl(),i=Qd(Vd(r));if(!i||typeof i.modify!=`function`)return;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!z(c)||c.isInline()||c.canBeEmpty()||Zd(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&F(t)?Of(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return;let g=m.offset;if(yl(i,h,g,h,g),Xc(i,`move`,t?`backward`:`forward`,n),i.rangeCount===0)return;let _=sf(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(p&&n===`character`&&s.type===`text`&&F(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=jp(u,t?`previous`:`next`).getNodeAtCaret();if(F(n)){let r=t?n.getTextContentSize()-1:1;e.focus.set(n.__key,r,`text`),e.dirty=!0;return}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return void(r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0))}let[b,x,S,C]=t?[v,y,d,f]:[d,f,v,y],w=fu(u)?u:Ud(u);e.applyDOMRange({collapsed:!1,endContainer:S,endOffset:C,startContainer:b,startOffset:x}),e.dirty=!0,!Zc(e,t,w)&&t&&Yc(e),n===`lineboundary`&&Al(e,`extend`,t,n,`decorators`)}var $c=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function el(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function tl(e,t,n,r){let i,a=t,o=!1;if(G(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),cd(e,r)!==void 0||Bf(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=md(d),F(i))a=Np(i,s?`next`:`previous`);else{let c=md(e);if(c===null)return null;if(z(c)){let o=r.getElementByKey(c.getKey());o===null&&M(214);let l=Ef(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),z(c)||M(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(z(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=z(u)?u:u.getParentOrThrow()),a=0}F(u)?(i=u,c=null,a=Np(u,s?`next`:`previous`)):u!==c&&s&&!f&&(z(c)||M(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=$f(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&md(e)===c){let n=Ef(c,s,r);n.element===s?t===0&&B(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(z(c))return[Lc(c.__key,a,`element`),o]}}else i=md(e);return F(i)?[Lc(i.__key,Np(i,a,`clamp`),`text`),o]:null}function nl(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&z(a)&&a.isInline()){let t=a.getPreviousSibling();F(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else z(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):F(r)&&!i.isUnmergeable()&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&z(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&z(a)&&a.isInline()&&!a.canInsertTextAfter()&&a.getTextContentSize()>1){let t=a.getNextSibling();F(t)&&e.set(t.__key,0,`text`)}}}function rl(e,t,n){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);nl(e,n,r),nl(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function il(e){let t=H(e.key);return t===null?null:tp(t)}function al(e,t,n){let r=il(e),i=il(t);if(r===i||r!==null&&i!==null&&r.is(i))return!1;let a=n(r,i);if(r!==null)return z(r)?t.set(r.getKey(),a?r.getChildrenSize():0,`element`):t.set(r.getKey(),a?r.getTextContentSize():0,`text`),!0;let o=$f(i);if(o===null)return!1;let s=o.getParent();if(s===null)return!1;let c=o.getIndexWithinParent();return t.set(s.getKey(),a?c+1:c,`element`),!0}function ol(e){let t=al(e.anchor,e.focus,(t,n)=>function(e,t,n,r){if(n!==null&&r!==null){let e=$f(n),t=$f(r);if(e!==null&&e.is(t)){for(let t of np(e).values()){if(t===n.getKey())return!0;if(t===r.getKey())return!1}return!0}return e===null||t===null||e.isBefore(t)}if(n!==null){let e=$f(n),r=H(t.key);return e===null||r===null||!(!e.is(r)&&!e.isParentOf(r))||e.isBefore(r)}let i=$f(r),a=H(e.key);return i!==null&&a!==null&&!i.is(a)&&!i.isParentOf(a)&&a.isBefore(i)}(e.anchor,e.focus,t,n));return t&&(e.dirty=!0),t}function sl(e,t,n,r,i,a){if(e===null||n===null||!Wu(i,e,n))return null;let o=tl(e,t,I(a)?a.anchor:null,i);if(o===null)return null;let s=tl(n,r,I(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=md(e),r=md(n);if(B(t)&&B(r))return null}let f=i._slotsUsed&&al(c,u,()=>(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return rl(c,u),[c,u,l||d||f]}function cl(e){return z(e)&&!e.isInline()}function ll(e,t,n,r,i,a){let o=Hl(),s=new Hc(Lc(e,t,i),Lc(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function ul(){return new Hc(Lc(`root`,0,`element`),Lc(`root`,0,`element`),0,``)}function dl(){return new Bc(new Set)}function fl(e,t){return pl(null,e,t,null)}function pl(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!Qi&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(I(e)&&!c)return e.clone();{if(t===null)return null;let r=lf(t,n._rootElement);if(l=r.anchorNode,u=r.focusNode,d=r.anchorOffset,f=r.focusOffset,(s||o===void 0)&&I(e)&&!Wu(n,l,u))return e.clone()}let p=sl(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(I(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();F(e)?(_=e.getFormat(),v=e.getStyle()):z(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new Hc(m,h,_,v);return g&&(y.dirty=!0),y}function R(){return Hl()._selection}function ml(){return Wl()._editorState._selection}function hl(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),gl(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}gl(e)}function gl(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!z(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(F(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(z(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(F(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(z(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(F(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function _l(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,F(i)?s=`text`:z(i)&&(s=`element`)):(a=r.__key,F(r)?(o=r.getTextContentSize(),s=`text`):z(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function vl(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function yl(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function bl(e,t,n){let r=Pd(e,t.getKey());if(z(t)){let i=Ef(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function xl(e,t,n,r,i,a){let o=a.getRootNode(),s=Zu(o)||ef(o)?mf(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&Uu(s,s))return;let c=lf(r,a),l;if(!I(t))return void(e!==null&&Wu(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=bl(n,f,u.offset),[g,_]=bl(n,p,d.offset),v=t.format,y=t.style,b=t.isCollapsed(),x=m,S=g,C=!1;if(u.type===`text`?(x=F(f)?Of(f,m,n):null,C=f.getFormat()!==v||f.getStyle()!==y):I(e)&&e.anchor.type===`text`&&(C=!0),d.type===`text`&&(S=F(p)?Of(p,g,n):null),x!==null&&S!==null){if(b&&(e===null||C||I(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,h,u.key,performance.now()),(r.type!==`Range`||!b)&&c.anchorOffset===h&&c.focusOffset===_&&c.anchorNode===x&&c.focusNode===S){if(s===null||!a.contains(s)){let e=s===null?null:Ku(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(yl(r,x,h,S,_),ui&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=pf(a);if(e===null||!a.contains(e)){let e=mf(a.ownerDocument),t=e===null?null:Ku(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===pf(a)){let e=I(t)&&t.anchor.type===`element`?x.childNodes[h]||null:(l===void 0&&(l=cf(r,a)),l);if(e!==null){let t;if(Xu(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=Id(n),i=Bd(r);if(r===null||i===null)return;let a=n.getBoundingClientRect();if(t.bottom<a.top)return;let{top:o,bottom:s}=t,c=0,l=0,u=n;for(;u!==null;){let t=u===r.body;if(t){let t=i.visualViewport;if(t){let e=t.offsetTop;c=e,l=e+t.height}else c=0,l=Vd(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(c+=a),isFinite(o)&&(l-=o)}else{let e=u===n?a:u.getBoundingClientRect();c=e.top,l=e.bottom}let d=0;if(o<c?d=-(c-o):s>l&&(d=s-l),d!==0){if(t)i.scrollBy(0,d);else{let e=u.scrollTop;u.scrollTop+=d;let t=u.scrollTop-e;o-=t,s-=t}}if(t)break;u=Fd(u)}})(n,t,a)}}(function(e){e._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function Sl(e){let t=R()||ml();t===null&&(t=U().selectEnd()),t.insertNodes(e)}function Cl(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
29
+ `||n===`\r
30
+ `?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function wl(e){let t=[];return Cl(e,{linebreak:()=>t.push(xu()),tab:()=>t.push(Pc()),text:e=>t.push(jc(e))}),t}function Tl(e){let t=[];for(let n of e)Su(n)||(!z(n)&&!B(n)||n.isInline()?t.push(n):z(n)&&t.push(...Tl(n.getChildren())));return t}function El(e){let t=e;e.isCollapsed()||t.removeText();let n=R();I(n)&&(t=n),I(t)||M(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!Cf(i)&&Qf(i)===null;){let e=i;if([i,a]=Dl(i,a),e.is(i))break}return a}function Dl(e,t){let n=e.getParent();if(!n){let e=V();return U().append(e),e.select(),[U(),0]}if(F(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!z(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Hc(Lc(e.__key,t,`element`),Lc(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Ol(e){return Su(e)||Hd(e)||F(e)||e.isParentRequired()}function kl(e){let t=V(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if(Ol(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(Su(i)&&(a===void 0||!Ol(a)))continue}n.append(i)}else t.append(i),n=null}return t}function Al(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=Yp(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!am(c)){for(let e of c){l=!1;let{origin:t}=e;if(!B(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of Bp(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(Dp(e))e.origin.isInline()||(c=e);else{if(z(e.origin))continue;B(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&B(c.origin)&&c.origin.isKeyboardSelectable()){let e=dl();return e.add(c.origin.getKey()),fd(e),!0}return c=im(c),s&&Xp(e.anchor,c),Xp(e.focus,c),l||!o}var jl=null,Ml=null,Nl=!1,Pl=!1,Fl=!1,Il=new Set,Ll=0,Rl={characterData:!0,childList:!0,subtree:!0};function zl(){return Nl||jl!==null&&jl._readOnly}function Bl(){Nl&&M(13)}function Vl(){Ll>99&&M(14)}function Hl(){return jl===null&&M(195,Kl()),jl}function Ul(e){Hl()!==null&&Ml===null&&(Ml=e),Ml!==e&&oi(378)}function Wl(){return Ml===null&&M(337,Kl()),Ml}function Gl(){Wl()._dirtyType=2}function Kl(){let e=0,t=new Set,n=Iu.version;if(typeof window<`u`)for(let r of rf(document)){let i=qu(r);if(Gu(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function ql(){return Ml}function Jl(e,t,n){let r=t.__type,i=Bu(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function Yl(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Xl(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Zl(e){return Ql(e,Wl()._nodes)}function Ql(e,t){let n=e.type,r=t.get(n);r===void 0&&M(17,n);let i=r.klass;e.type!==i.getType()&&M(18,i.name);let a=i.importJSON(e),o=e.children;if(z(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Ql(o[e],t);a.append(n)}let s=e.$slots;if(s){Xf(a)||M(379,i.name);for(let e in s)mp(a,e,Ql(s[e],t))}return a}function $l(e,t,n){let r=jl,i=Nl,a=Ml;jl=t,Nl=!0,Ml=e;try{return n()}finally{jl=r,Nl=i,Ml=a}}function eu(e,t){let n=Fl;Fl=!0;try{(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&ru(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=jl,u=Nl,d=Ml,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){Ml=e,jl=n,Nl=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=Co(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),Pl)throw t;Au(e,null,r,n),sa(e),e._dirtyType=2,Pl=!0,eu(e,a),Pl=!1;return}finally{p.observe(r,Rl),e._updating=f,jl=l,Nl=u,Ml=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set),e._updateTags=new Set,function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=ud(e)),delete r[a])}(e,n);let y=i?null:Qd(Vd(e));if(e._editable&&y!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){Ml=e,jl=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&Zd(t,e,r),xl(o,s,e,y,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(I(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(pf(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())Xd(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&Xd(t)){let n=t.getPreviousSibling();(n===null||Xd(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=Ef(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=of().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=vm(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&Zd(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,Rl),Ml=d,jl=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),I(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(To,void 0);let b=e._pendingDecorators;b!==null&&(e._decorators=b,e._pendingDecorators=null,tu(`decorator`,e,!0,b)),function(e,t,n){let r=dd(t),i=dd(n);r!==i&&tu(`textcontent`,e,!0,i)}(e,t||a,n),tu(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),!f&&ru(e,e._deferred),(function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){Il.has(e)||(Il.add(e),setTimeout(()=>{Il.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${e._config.namespace}`));let n=t.shift();if(n){let[t,r]=n;au(e,t,r)}})(e)})(e,t)}finally{Fl=n}}function tu(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function nu(e,t,n,r){let i=gd(e),a;if(!Fl)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(ou(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{nu(a,t,n,r)}),!1}function ru(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function iu(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&M(191),a._flushSync=!0),o&&e._deferred.push(o),Xl(e,i.tag)),a==null?au(e,n,i):n()}}return r}function au(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,Xl(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=pu(c||s),l=!0),c._flushSync=o;let u=jl,d=Nl,f=Ml,p=e._updating;jl=c,Nl=!1,e._updating=!0,Ml=e;let m=e._headless||e.getRootElement()===null;Ru(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=Qd(Vd(e));return I(n)||n==null?pl(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=iu(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(I(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);F(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Ta(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=ad(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);F(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ta(r),r!==void 0&&Yl(r,a)&&Jl(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){Ll++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&Yl(c,a)&&Jl(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,Ll++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),iu(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(z(t)&&Zi(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(Xf(t)&&t.__slots!==null&&Zi(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}for(let e of o)a.delete(e);let s=Wl(),c=s._compositionKey;c===null||a.has(c)||(s._compositionKey=null)}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(I(i)){e._slotsUsed&&ol(i);let t=c._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||M(19)}else L(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),eu(e);return}finally{jl=u,Nl=d,Ml=f,e._updating=p,Ll=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,eu(e)):l&&Hu(()=>{eu(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function ou(e,t,n){Ml===e&&n===void 0?t():au(e,t,n)}function su(e){if(Gd(e)){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var cu=class extends nc{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:su,extends:nc})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return Fi[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&rp(this).length===0}isDirty(){let e=Wl()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of rp(this)){let n=ip(this,t);z(n)&&e.push(...n.getAllTextNodes())}let t=this.getFirstChild();for(;t!==null;){if(F(t)&&e.push(t),z(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;z(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;z(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return z(e)&&e.getLastDescendant()||e||null}let r=t[e];return z(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:H(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:H(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=dp(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),z(i)&&r!==n-1&&!i.isInline()&&(e+=Oi)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of rp(e)){let r=ip(e,n);r!==null&&(t+=r.getTextContentSize())}return t}(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),z(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Pi[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Mi[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return $u(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Bl();let n=R(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(F(e)||z(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(F(e)||z(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return I(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):ll(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==``&&Pi[e]||0,this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){ec(this)&&M(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||M(226,String(e),String(t),String(r));for(let e of n);let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0){if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&M(100);let t=e.getNextSibling(),n=e.__key;nd(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,nd(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&M(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=R();if(I(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;lu(r,t,n)&&_l(r,r.getNode(),this,l,c),lu(i,t,n)&&_l(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||Gd(this)||this.remove()}}return i}getDOMSlot(e){return new Ui(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(G(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||Gd(this)||this.getChildren().some(F)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=Ef(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function z(e){return e instanceof cu}function lu(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var uu=class extends nc{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function B(e){return e instanceof uu}var du=class e extends cu{__cachedText;static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){let e=this.__cachedText;return e===null||!zl()&&Wl()._dirtyType!==0?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)z(e)||B(e)||M(282);return super.splice(e,t,n)}static importJSON(e){return U().updateFromJSON(e)}collapseAtStart(){return!0}};function fu(e){return e instanceof du}function pu(e){return new _u(Yi(e._nodeMap),null,e._slotsUsed)}function mu(){return new _u(new Map([[`root`,new du]]),null,!1)}function hu(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&M(130,n.name),z(e)){let r=t.children;Array.isArray(r)||M(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=hu(i[e]);r.push(t)}}let r=rp(e);if(r.length>0){let i={};for(let t of r){let r=ip(e,t);r===null&&M(366,n.name,t),i[t]=hu(r)}t.$slots=i}return t}function gu(e){return e instanceof _u}var _u=class e{_nodeMap;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,n=!1){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=n}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return $l(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return n._readOnly=!0,n}toJSON(){return $l(null,this,()=>({root:hu(U())}))}},vu=class extends cu{static getType(){return`artificial`}createDOM(e){return of().createElement(`div`)}},yu=class e extends nc{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
31
+ `}createDOM(){return of().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>Cu(e)||wu(e)?null:{conversion:bu,priority:0}}}static importJSON(e){return xu().updateFromJSON(e)}};function bu(e){return{node:xu()}}function xu(){return qd(new yu)}function Su(e){return e instanceof yu}function Cu(e){let t=e.parentElement;if(t!==null&&Sf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Tu(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Tu(n))return!0}}return!1}function wu(e){let t=e.parentElement;if(t!==null&&Sf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Tu(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Tu(r))return!0}return!1}function Tu(e){return Xu(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var Eu=class e extends cu{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=of().createElement(`p`),n=kd(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Du,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(G(t)){this.isEmpty()&&t.append(of().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return V().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(F);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=V();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||F(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Du(e){let t=V();if(If(t,e),Pf(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Pi&&t.setFormat(n)}return Ff(t,e),{node:t}}function V(){return qd(new Eu)}function Ou(e){return e instanceof Eu}function ku(e){console.warn(e)}function Au(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=mu(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(e._updateTags=new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null,e._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(e._inputState.handledSelectionCommandTimeoutId),e._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``,function(e,t){let n=`__lexicalKey_${t._key}`;delete e[n]}(t,e)),n!==null&&(n.textContent=``,a.set(`root`,n),sd(n,e,`root`))}function ju(e){let t=new Set,n=new Set;for(let{klass:r,ownNodeConfig:i}of Wf(e)){let e=r.transform;if(!n.has(e)){n.add(e);let i=r.transform();i&&t.add(i)}if(i){let e=i.$transform;e&&t.add(e)}}return t}var Mu={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=Vu(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>z(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>z(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function Nu(e){let t=e||{},n=ql(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=mu(),s=t.namespace||(i===null?_d():i._config.namespace),c=t.editorState,l=[du,Sc,yu,Nc,Eu,vu,...t.nodes||[]],{onError:u,onWarn:d,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let e=0;e<l.length;e++){let n=l[e],r=null,i=null;if(n&&typeof n==`object`){let e=n;n=e.replace,r=e.with,i=e.withKlass||null}if(typeof n!=`function`||!n.prototype||!(n===nc||n.prototype instanceof nc)){let r=`<unknown>`;try{r=JSON.parse(Ki)}catch{}M(365,String(e-l.length+(t.nodes?t.nodes.length:0)),typeof n==`function`?`${n.name}${typeof n.getType==`function`?` (type ${String(n.getType())})`:``}`:String(n),String(r))}Uf(n);let a=n.getType(),o=ju(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:pa(l[e]),transforms:o})}}let h=new Iu(o,i,m,{disableEvents:a,dom:{...Mu,...e&&e.dom},namespace:s,theme:r},u||console.error,d||ku,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(m,f?f.import:void 0),p,e);return c!==void 0&&(h._pendingEditorState=c,h._dirtyType=2),function(e){e.registerCommand(Oo,Rs,0),e.registerCommand(ko,zs,0),e.registerCommand(Ao,Bs,0),e.registerCommand(jo,Vs,0),e.registerCommand(Wo,Ws,0)}(h),h}function Pu(e,t){let n=e.get(t);e.delete(t),n&&n()}function Fu(e,t,n){return e.set(t,n),Pu.bind(null,e,t)}var Iu=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_inputState;_createEditorArgs;constructor(e,t,n,r,i,a,o,s,c){this._createEditorArgs=c,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Xi,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=_d(),this._onError=i,this._onWarn=a,this._htmlConversions=o,this._editable=s,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return Fu(this._listeners.update,e)}registerEditableListener(e){return Fu(this._listeners.editable,e)}registerDecoratorListener(e){return Fu(this._listeners.decorator,e)}registerTextContentListener(e){return Fu(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return xm(Fu(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&M(35);let r=this._commands;r.has(e)||r.set(e,[new qi,new qi,new qi,new qi,new qi]);let i=r.get(e);i===void 0&&M(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=jf(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=jf(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=H(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:oc}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return W(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=kd(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Au(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||Xs(t),n!=null&&t.classList.remove(...n)),e!==null){let t=Bd(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,sa(this),this._updateTags.add(oc),eu(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Ts.set(e,n);let r=Es.get(n);r===void 0&&(r={editors:new Set,hasShadowEditor:void 0},Es.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Gs(e);i.push(Ds.register(n));for(let n=0;n<ws.length;n++){let[r,a]=ws[n],o=typeof a==`function`?e=>{Ys(e)||(Js(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(Ys(e))return;Js(e);let n=t.isEditable();switch(r){case`cut`:return n&&W(t,fs,e);case`copy`:return W(t,ds,e);case`paste`:return n&&W(t,Io,e);case`dragstart`:return n&&W(t,cs,e);case`dragover`:return n&&W(t,ls,e);case`dragend`:return n&&W(t,us,e);case`focus`:return n&&W(t,vs,e);case`blur`:return n&&W(t,ys,e);case`drop`:return n&&W(t,os,e)}};i.push(Ss(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(oc),eu(this);tu(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=pu(e),n._selection=e._selection?e._selection.clone():null),oa(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),eu(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,ou(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(let[e,t]of n._nodeMap.entries())z(t)?this._dirtyElements.set(e,!0):this._dirtyLeaves.add(e)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return function(e,t,n){let r=mu(),i=jl,a=Nl,o=Ml,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,jl=r,Nl=!1,Ml=t,Ru(null);try{let i=t._nodes;Ql(e.root,i),n&&n(),r._readOnly=!0,r._parsed=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,jl=i,Nl=a,Ml=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(...e){let[t,n]=e.length===1?[`force-commit`,e[0]]:e;return t===`force-commit`&&eu(this),(t===`pending`?this._pendingEditorState||this._editorState:this.getEditorState()).read(n,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):au(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),ou(this,()=>{let r=R(),i=U();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||fd(r.clone()),Ld(`focus`),Rd(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Qd(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,tu(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Gl()))}toJSON(){return{editorState:this._editorState.toJSON()}}};Iu.version=Ki;var Lu=null;function Ru(e){Lu=e}var zu=1;function Bu(e,t){let n=Vu(e,t);return n===void 0&&M(30,t),n}function Vu(e,t){return e._nodes.get(t)}var Hu=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function Uu(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return Zu(t)||ef(t)?mf(t):null})():t;if(!G(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=ld(n),i=n.nodeName;return rc(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&qu(n)==null)}function Wu(e,t,n){let r=e.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(n))return!1}catch{return!1}return Ku(t)===e&&e.read(`latest`,()=>!Uu(t))}function Gu(e){return e instanceof Iu}function Ku(e){let t=e;for(;t!=null;){let e=qu(t);if(Gu(e))return e;t=Fd(t)}return null}function qu(e){return e?e.__lexicalEditor:null}function Ju(e){return Fc(e)||e.isToken()}function Yu(e){return Ju(e)||e.isSegmented()}function Xu(e){return _f(e)&&e.nodeType===3}function Zu(e){return _f(e)&&e.nodeType===9}function Qu(e){let t=e;for(;t!=null;){if(Xu(t))return t;t=t.firstChild}return null}function $u(e,t,n){let r=Mi[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Mi.superscript:t===`superscript`?i&=~Mi.subscript:t===`lowercase`?(i&=~Mi.uppercase,i&=~Mi.capitalize):t===`uppercase`?(i&=~Mi.lowercase,i&=~Mi.capitalize):t===`capitalize`&&(i&=~Mi.lowercase,i&=~Mi.uppercase),i}function ed(e){return F(e)||Su(e)||B(e)}function td(e,t){let n=function(){let e=Lu;return Lu=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Bl(),Vl();let r=Wl(),i=Hl(),a=``+zu++;i._nodeMap.set(a,e),z(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function nd(e){Qf(e)!==null&&M(380,e.__key,String(Qf(e)));let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function rd(e){Vl(),ec(e)&&M(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?Zf(t)?t.__slotHost:null:t.__parent,r=Hl(),i=Wl(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent===null?Zf(e)?e.__slotHost:null:e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),z(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function id(e){Bl();let t=Wl(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=H(n);e!==null&&e.getWritable()}if(e!==null){let t=H(e);t!==null&&t.getWritable()}}}function ad(){return zl()?null:Wl()._compositionKey}function H(e,t){let n=(t||Hl())._nodeMap.get(e);return n===void 0?null:n}function od(e,t){let n=cd(e,Wl());return n===void 0?null:H(n,t)}function sd(e,t,n){e[`__lexicalKey_${t._key}`]=n}function cd(e,t){return e[`__lexicalKey_${t._key}`]}function ld(e,t){let n=e;for(;n!=null;){let e=od(n,t);if(e!==null)return e;n=Fd(n)}return null}function ud(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function dd(e){return e.read(()=>U().getTextContent())}function U(){return Hl()._nodeMap.get(`root`)}function fd(e){Bl();let t=Hl();e!==null&&(e.dirty=!0,e.setCachedNodes(null),I(e)&&Wl()._slotsUsed&&ol(e)),t._selection=e}function pd(){Bl(),oa(Wl())}function md(e){let t=function(e,t){let n=e;for(;n!=null;){let e=cd(n,t);if(e!==void 0)return e;n=Fd(n)}return null}(e,Wl());return t===null?null:H(t)}function hd(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function gd(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function _d(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function vd(e){return Xu(e)?e.nodeValue:null}function yd(e,t,n){let r=Qd(Vd(t));if(r===null)return;let i=lf(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=vd(a),r=ld(a);if(t!==null&&F(r)){if((t===Di||t===ki)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&bd(r,t,o,s,e)}}}function bd(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing();if(a.isToken()&&o)return;let s=t;if((o||i)&&(t.endsWith(Di)&&(s=t.slice(0,-Di.length)),i)){let e=ki,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){let t=R();if(s===``){if(id(null),mi||fi||_i)a.remove();else{let e=Wl();xd(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=ml(),l=a.getTextContentSize(),u=ad(),d=a.getKey();if(a.isToken()&&!o||u!==null&&d===u&&!o||I(c)&&(i!==null&&!i.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!o||c.focus.key===e.__key&&c.focus.offset===l&&!a.canInsertTextAfter()&&!o))return void a.markDirty();if(!I(t)||n===null||r===null)return void xd(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=jc(a.getTextContent());a.replace(e),a=e}xd(a,s,t)}}}function xd(e,t,n){if(e.setTextContent(t),I(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=Np(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Sd(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function Cd(e,t){return Sd(e,t,`altKey`)&&Sd(e,t,`ctrlKey`)&&Sd(e,t,`shiftKey`)&&Sd(e,t,`metaKey`)}function wd(e,t,n){if(!Cd(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith(`Digit`)&&/^\d$/.test(t))return e.code===`Digit${t}`;let r=`Key`+t.toUpperCase();return e.code===r}var Td={ctrlKey:!li,metaKey:li},Ed={altKey:li,ctrlKey:!li};function Dd(e){return e.key===`Backspace`}function Od(e){let t=U();if(I(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(fu(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),Ea(e),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();if(a===null)return z(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),Ea(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),Ea(e),e}{let e=t.select(0,t.getChildrenSize());return fd(Ea(e)),e}}function kd(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=vm(i);return n[t]=e,e}return i}function Ad(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&M(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function jd(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function Md(e,t){let n=e.offset;if(e.type===`element`)return jd(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?jd(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function Nd(e){let t=Vd(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function W(e,t,n){return nu(e,t,n,e)}function Pd(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&M(75,t),n}function Fd(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return ef(n)?n.host:null}function Id(e){return Zu(e)?e:G(e)?e.ownerDocument:null}function Ld(e){Bl(),Wl()._updateTags.add(e)}function Rd(e){Bl(),Wl()._deferred.push(e)}function zd(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Bd(e){let t=Id(e);return t?t.defaultView:null}function Vd(e){let t=e._window;return t===null&&M(78),t}function Hd(e){return z(e)&&e.isInline()||B(e)&&e.isInline()}function Ud(e){let t=e.getLatest();for(;t!==null;){if(Qf(t)!==null&&z(t))return t;let e=t.getParentOrThrow();if(Gd(e))return e;t=e}return t}function Wd(e){return z(e)&&e.isShadowRoot()}function Gd(e){return fu(e)||Wd(e)}function Kd(e,t=!1){let n=e.constructor.clone(e);return td(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function qd(e){let t=Wl(),n=e.getType(),r=Vu(t,n);r===void 0&&M(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||M(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||M(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&M(203,e.constructor.name,n,r.name,r.getType()),t}return e}function Jd(e,t){!fu(e.getParent())||z(t)||B(t)||M(99)}function Yd(e){let t=H(e);return t===null&&M(63,e),t}function Xd(e){if(!e||e.isInline())return!1;if(B(e))return!0;if(z(e)){if(e.isShadowRoot()){let t=e.getParent();return!(z(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function Zd(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Qd(e){return si?(e||window).getSelection():null}function $d(e){let t=Bd(e);return t?t.getSelection():null}function ef(e){return vf(e)&&`host`in e}var tf=[];function nf(e){let t=e.getRootNode();if(t===e||!ef(t))return tf;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!ef(e))break;n.push(e),r=e.host}return n}function*rf(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(Zu(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function af(e){return e===null?document:e.ownerDocument}function of(){let e=ql();return af(e===null?null:e._rootElement)}function sf(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=nf(t);if(n.length===0)return null;let r=e.getComposedRanges;try{let t=r.call(e,{shadowRoots:n})[0];if(t!==void 0)return t}catch{}try{let t=r.apply(e,n)[0];if(t!==void 0)return t}catch{}return null}function cf(e,t){let n=sf(e,t);if(n!==null){let e=uf(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function lf(e,t){let n=sf(e,t);return n===null?e:df(n,ff(e))}function uf(e){let t=e.startContainer.ownerDocument;if(t===null)return null;let n=t.createRange();try{return n.setStart(e.startContainer,e.startOffset),n.setEnd(e.endContainer,e.endOffset),n}catch{return null}}function df(e,t){let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e;return t===`backward`?{anchorNode:i,anchorOffset:a,direction:t,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:t,focusNode:i,focusOffset:a}}function ff(e){return e.direction}function pf(e){let t=e.getRootNode();return Zu(t)||ef(t)?t.activeElement:null}function mf(e){let t=e.activeElement;for(;t!==null&&t.shadowRoot!==null;){let e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function hf(e){let t=e.target;if(t!==null&&G(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function gf(e){return G(e)&&e.tagName===`A`}function G(e){return _f(e)&&e.nodeType===1}function _f(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function vf(e){return _f(e)&&e.nodeType===11}var yf=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function bf(e){return!(!G(e)||!e.style.display.startsWith(`inline`))||yf.test(e.nodeName)}var xf=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Sf(e){return(!G(e)||!e.style.display.startsWith(`inline`))&&xf.test(e.nodeName)}function Cf(e){if(B(e)&&!e.isInline())return!0;if(!z(e)||Gd(e))return!1;let t=e.getFirstChild(),n=t===null||Su(t)||F(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function wf(){return Wl()}function Tf(e=wf()){return e._config.dom||Mu}function Ef(e,t,n=wf()){let r=Tf(n).$getDOMSlot(e,t,n);return z(e)&&(Df(r)||M(344,e.getKey(),e.getType())),r}function Df(e){return e instanceof Ui}function Of(e,t,n=wf()){return Qu(Ef(e,t,n).element)}var kf=new WeakMap,Af=new Map;function jf(e){if(!e._readOnly&&e.isEmpty())return Af;e._readOnly||M(192);let t=kf.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),kf.set(e,t)),t}function Mf(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Nf(e){return(t=Mf(e))[$s]=!0,t;var t}function Pf(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function Ff(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function If(e,t){let n=t.style.textAlign;return n&&n in Pi?e.setFormat(n):e}function Lf(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function Rf(e){return!0===e.__lexicalUnmanaged}function zf(e,t=wf()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function Bf(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(G(n)&&n.hasAttribute(`data-lexical-slot`)||cd(n,t)!==void 0)return!1;n=Fd(n)}return!1}function Vf(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==nc[t]}var Hf=new WeakMap;function Uf(e){let t=Hf.get(e);if(t)return t;let n=e.prototype!=null&&Ri in e.prototype?e.prototype[Ri]():void 0,r=function(e){if(!(e===nc||e.prototype instanceof nc)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{Iu.version&&(n=JSON.parse(Iu.version))}catch{}M(290,e.name,t,n)}return e===uu||e===cu||e===nc}(e),i=!r&&Vf(e,`getType`)?e.getType():void 0,a,o=i;if(n){if(i)a=n[i];else{for(let[e,t]of Object.entries(n))o=e,a=t;if(!a)for(let e of Object.getOwnPropertySymbols(n)){let t=n[e];if(t){a=t;break}}}}if(!r&&o&&(Vf(e,`getType`)||(e.getType=()=>o),Vf(e,`clone`)||(e.clone=t=>(Ru(t),new e)),Vf(e,`importJSON`)||(e.importJSON=a&&a.$importJSON||(t=>new e().updateFromJSON(t))),!Vf(e,`importDOM`)&&a)){let{importDOM:t}=a;t&&(e.importDOM=()=>t)}let s={klass:e,ownNodeConfig:a,ownNodeType:o};return Hf.set(e,s),s}function*Wf(e){for(let t=e;t&&(t===nc||rc(t.prototype));){let e=Uf(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||Jf(t)}}function Gf(e){let t=wf();return Bl(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Kf=(e,t)=>{let n=e;for(;n!=null&&!fu(n);){if(t(n))return n;n=n.getParent()}return null};function qf(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?H(r):t.get(r);e??M(174),n.push(r),r=e.__next}return n}function Jf(e){let t=Object.getPrototypeOf(e);if(typeof t==`function`&&t!==Function.prototype)return t;let n=e.prototype&&Object.getPrototypeOf(e.prototype);return n?n.constructor:null}var Yf=new Map;function Xf(e){return z(e)||B(e)}function Zf(e){return z(e)||B(e)}function Qf(e){let t=e.getLatest();return Zf(t)?t.__slotHost:null}function $f(e){let t=Qf(e);if(t===null)return null;let n=H(t);return z(n)||B(n)||M(370),n}function ep(e){let t=$f(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of np(t))if(r===n)return e;return null}function tp(e){let t=e.getLatest();for(;t!==null;){if(Qf(t)!==null)return t;t=t.getParent()}return null}function np(e){let t=e.getLatest();return Xf(t)&&t.__slots!==null?t.__slots:Yf}function rp(e){return Array.from(np(e).keys())}function ip(e,t){let n=np(e).get(t);return n===void 0?null:H(n)}var ap=[`__proto__`,`constructor`,`prototype`],op=Symbol(`slotMapOwner`);function sp(e){let t=e.__slots;return t!==null&&t[op]===e||(t=new Map(t),t[op]=e,e.__slots=t),t}var cp=new WeakMap,lp=[];function up(e){for(let{ownNodeConfig:t}of Wf(e)){let e=t&&t.slots;if(e)return e}return lp}function dp(e){let t=``;for(let n of rp(e)){let r=ip(e,n);r!==null&&(t+=r.getTextContent())}return t}function fp(e,t,n){let r=n.get(e),i=n.get(t);return r===void 0?i===void 0?e<t?-1:+(e>t):1:i===void 0?-1:r-i}function pp(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=cp.get(e);if(t===void 0){let n=up(e),r=new Map;for(let t of n)ap.includes(t)&&M(371,e.name,t),r.has(t)&&M(372,e.name,t),r.set(t,r.size);t=r,cp.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&fp(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>fp(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function mp(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||M(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!z(n)&&!B(n)||n.isInline())&&M(374,n.__key);let i=e.getWritable(),a=sp(i),o=a.get(t);o!==void 0&&gp(o);let s=n.getWritable(),c=$f(s);if(c!==null){let e=ep(s);e!==null&&sp(c.getWritable()).delete(e),s.__slotHost=null}return nd(s),s.__slotHost=i.__key,a.set(t,s.__key),pp(i),function(){let e=wf();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function hp(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&(gp(r),sp(n).delete(t)),n}function gp(e){let t=H(e);if(t===null)return;let n=t.getWritable();Zf(n)||M(377,e),n.__slotHost=null,n.remove()}var _p={next:`previous`,previous:`next`},vp=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Up({hasNext:Ep,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return jp(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return jp(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&M(263,Array.from(o).join(` `))}else i.insert(e);i=jp(e,this.direction)}for(let e of o.values())e.remove();return this}},yp=class e extends vp{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Fp(e,this.direction)}getParentCaret(e=`root`){return jp(Sp(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=xp(this.direction);return jp(this.getNodeAtCaret(),e)||Fp(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},bp={root:fu,shadowRoot:Gd};function xp(e){return _p[e]}function Sp(e,t=`root`){return e===null||bp[t](e)?null:Qf(e)===null?e:null}var Cp=class e extends vp{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:jp(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return z(this.origin)?Fp(this.origin,this.direction):null}getParentCaret(e=`root`){return jp(Sp(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=xp(this.direction);return jp(this.getNodeAtCaret(),e)||Fp(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof wp)&&this.direction===t.direction&&this.origin.is(t.origin)}},wp=class e extends vp{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Mp(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return jp(Sp(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Mp(this.origin,xp(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Cp||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return jp(this.origin,this.direction)}};function Tp(e){return e instanceof wp}function Ep(e){return e instanceof Cp}function Dp(e){return e instanceof yp}var Op={next:class extends wp{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends wp{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},kp={next:class extends Cp{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Cp{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Ap={next:class extends yp{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends yp{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function jp(e,t){return e?new kp[t](e):null}function Mp(e,t,n){return e?new Op[t](e,Np(e,n)):null}function Np(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&oi(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Pp(e,t){return new zp(e,t)}function Fp(e,t){return z(e)?new Ap[t](e):null}function Ip(e){return e&&e.getChildCaret()||e}function Lp(e){return e&&Ip(e.getAdjacentCaret())}var Rp=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return Tp(t)?function(e,t){let{direction:n,origin:r}=e;return Pp(e,Np(r,t===`focus`?xp(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Pp(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=Tp(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Tp(n),i=t=>t.isSameNodeCaret(n)?null:Lp(t)||t.getParentCaret(e);return Up({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},zp=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return Mp(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function Bp(e){return Hp(e,jp(U(),e.direction))}function Vp(e){return Hp(e,e)}function Hp(e,t){return e.direction!==t.direction&&M(265),new Rp(e,t,e.direction)}function Up(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function Wp(e,t){let n=Jp(e.origin,t.origin);switch(n===null&&M(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return Gp(n)}}function Gp(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function Kp(e,t){return t.is(e)}function qp(e){return z(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Jp(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=qp(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=qp(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(Kp(e,r)||M(276),{commonAncestor:r,type:`ancestor`}):i===null?(Kp(t,r)||M(277),{commonAncestor:r,type:`descendant`}):((z(a)||Kp(e,a))&&(z(i)||Kp(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||M(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function Yp(e,t){let{type:n,key:r,offset:i}=e,a=Yd(e.key);return n===`text`?(F(a)||M(266,a.getType(),r),Mp(a,t,i)):(z(a)||M(267,a.getType(),r),cm(a,e.offset,t))}function Xp(e,t){let{origin:n,direction:r}=t,i=r===`next`;Tp(t)?e.set(n.getKey(),t.offset,`text`):Ep(t)?F(n)?e.set(n.getKey(),Np(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(Dp(t)&&z(n)||M(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function Zp(e){let t=R(),n=I(t)?t:ul();return Qp(n,e),fd(n),n}function Qp(e,t){Xp(e.anchor,t.anchor),Xp(e.focus,t.focus)}function $p(e){let{anchor:t,focus:n}=e,r=Yp(t,`next`),i=Yp(n,`next`),a=Wp(r,i)<=0?`next`:`previous`;return Hp(om(r,a),om(i,a))}function em(e){let{direction:t,origin:n}=e,r=jp(n,xp(t)).getNodeAtCaret();return r?jp(r,t):Fp(n.getParentOrThrow(),t)}function tm(e,t=`root`){let n=[e];for(let r=Dp(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(em(r));return n}function nm(e){return!!e&&e.origin.isAttached()}function rm(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=sm(e,r),o=tm(a.anchor,n),s=tm(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(Dp(e))c.add(e.origin.getKey());else if(Ep(e)){let{origin:t}=e;z(t)&&!c.has(t.getKey())||l.push(t)}for(let e of l)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=em(jp(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=jc(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=Mp(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let u,d;for(let e of o)if(nm(e)){u=im(e);break}for(let e of s)if(nm(e)){d=im(e);break}let f=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c=0;for(;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(Gd(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,Cf),d=u&&l(o,e=>n.has(e.getKey())&&Cf(e));return d&&rp(d).length>0?null:u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;Fp(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}else if(d){let e=function(e){if(Dp(e)){let t=e.origin;if(Cf(t))return t}else{let t=e.getParentAtCaret();if(t&&Cf(t))return t}return null}(d),t=e&&e.getParent(),n=e&&e.getParents().findLast(Wd);if(e&&t&&!fu(t)&&e.isEmpty()&&c.has(e.getKey())&&rp(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!fu(n)&&n.isEmpty();){let e=n.getParent();if(e&&fu(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let p=[u,d,...o,...s].find(nm);if(p)return Vp(om(im(p),e.direction));M(269,JSON.stringify(o.map(e=>e.origin.__key)))}function im(e){let t=function(e){let t=e;for(;Dp(t);){let e=Lp(t);if(!Dp(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(F(t.origin))return Tp(t)?t:Mp(t.origin,n,n);let r=t.getAdjacentCaret();return Ep(r)&&F(r.origin)?Mp(r.origin,n,xp(n)):t}function am(e){return Tp(e)&&e.offset!==Np(e.origin,e.direction)}function om(e,t){return e.direction===t?e:e.getFlipped()}function sm(e,t){return e.direction===t?e:Hp(om(e.focus,t),om(e.anchor,t))}function cm(e,t,n){let r=Fp(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return om(r,n)}function lm(e){let{origin:t,offset:n,direction:r}=e;if(n===Np(t,r))return e.getSiblingCaret();if(n===Np(t,xp(r)))return em(e.getSiblingCaret());let[i]=t.splitText(n);return F(i)||M(281),om(jp(i,`next`),r)}function um(e,t){return!0}function dm(e,{$copyElementNode:t=Kd,$splitTextPointCaretNext:n=lm,rootMode:r=`shadowRoot`,$shouldSplit:i=um,removeEmptyDestination:a=!1}={}){if(Tp(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(Dp(e)){let e=em(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}return o}function fm(e,t,n){let r=om(t,`next`);Tp(r)&&(r.offset===0?r=jp(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=jp(r.origin,`next`))),r.origin.is(e)&&(Ep(r)||M(342,e.getKey(),e.getType()),r=em(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=dm(e,n))r=e;return Tp(r)&&M(283),r.insert(e.isInline()?V().append(e):e),om(jp(e.getLatest(),`next`),t.direction)}function pm(e){return e}function mm(...e){return e}function hm(e,t){return[e,t]}function gm(e){return e}function _m(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function vm(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function ym(e,...t){let n=vm(...t);n.length>0&&e.classList.add(...n)}function bm(e,...t){let n=vm(...t);n.length>0&&e.classList.remove(...n)}function xm(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Sm(e,t,n){return xm(...Object.entries(t).map(([t,r])=>Ss(e,t,r,n)))}function Cm(e){let t=wf().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function wm(e){return Cm(fu(e)?e:e.getParentOrThrow())}function Tm(e){let t=wm(e);return t!==null&&t.direction===`rtl`}function Em(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!Yu(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=qc(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=Nf(t)),t.__text=p)}}return t}function Dm(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Om(e,t,n){let r=Yp(e,n);if(am(r))return!1;for(;r;r=r.getParentCaret()){let e=r.getParentAtCaret();if(!e||r.getNodeAtCaret())return!1;if(t.is(e))return!0}return!1}function km(e,t,n=Dm){if(!e)return;let r=e.getStartEndPoints(),i=!1,a=null,o=new Map;if(r){let[t,n]=r,s=Kf(t.getNode(),Cf);a=Kf(n.getNode(),Cf);let c=e.isBackward()?`previous`:`next`;i=z(a)&&!a.is(s)&&function(e,t,n){let r=e.getNode();return(!z(r)||!r.isEmpty())&&Om(e,t,n)}(n,a,xp(c)),z(s)&&o.set(s.getKey(),s),z(a)&&!i&&o.set(a.getKey(),a)}for(let t of e.getNodes())if(z(t)&&Cf(t)){if(i&&t.is(a))continue;o.set(t.getKey(),t)}else if(!r){let e=Kf(t,Cf);z(e)&&o.set(e.getKey(),e)}for(let e of o.values()){let r=t();n(e,r),e.replace(r,!0)}}function Am(e){let t=jm(e);return t!==null&&t.writingMode===`vertical-rl`}function jm(e){let t=e.anchor.getNode();return z(t)?Cm(t):wm(t)}function Mm(e,t){let n=Am(e)?!t:t;Pm(e)&&(n=!n);let r=Yp(e.focus,n?`previous`:`next`);if(am(r))return!1;if(Tp(r)&&!Fc(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(F(e)&&!Fc(e))return!0}for(let e of Bp(r)){if(Dp(e))return!e.origin.isInline();if(!z(e.origin)){if(B(e.origin))return!0;break}}return!1}function Nm(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Pm(e){let t=jm(e);return t!==null&&t.direction===`rtl`}function Fm(e,t,n){let r=Pm(e),i;i=Am(e)||r?!n:n,Nm(e,t,i,`character`)}function Im(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Lm(e,t){let n=e.ownerDocument,r=n.defaultView||window,i=r.getComputedStyle(e),a=i.position===`absolute`,o=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(i.position===`fixed`)return n.body;for(let t=e;t=Fd(t);)if(i=r.getComputedStyle(t),(!a||i.position!==`static`)&&o.test(i.overflow+i.overflowY+i.overflowX))return t;return n.body}function Rm(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function zm(e){let t=Kf(e,e=>z(e)&&!e.isInline());return z(t)||Im(4,e.__key),t}function Bm(e){let t=R()||ml(),n;if(I(t))n=Yp(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=jp(r,`next`))}n||=Fp(U(),`previous`).getFlipped().insert(V())}let r=fm(e,n),i=Lp(r);return Zp(Vp(Dp(i)?im(i):r)),e.getLatest()}function Vm(e,t){let n=t();return e.replace(n),n.append(e),n}function Hm(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function Um(e){let t=null;if(Hm(e,DragEvent)?t=e.dataTransfer:Hm(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function Wm(e){let t=R();if(!I(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=Kf(i,e=>z(e)&&!e.isInline());if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}var Gm=!(ui||!si)&&void 0;function Km(e,t=!1){let n=1;if(function(){if(Gm===void 0){let e=document.createElement(`div`);e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`100px`,e.style.left=`-1000px`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),Gm=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return Gm}()||t){let t=e&&e.ownerDocument.defaultView||window;for(;e;)n*=Number(t.getComputedStyle(e).getPropertyValue(`zoom`)),e=Fd(e)}return n}var qm=Symbol.for(`preact-signals`);function Jm(){if(eh>1)return void eh--;let e,t=!1;for(function(){let e=$m;for($m=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();Zm!==void 0;){let n=Zm;for(Zm=void 0,th++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ch(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(th=0,eh--,t)throw e}function Ym(e){if(eh>0)return e();rh=++nh,eh++;try{return e()}finally{Jm()}}var Xm,Zm;function Qm(e){let t=Xm;Xm=void 0;try{return e()}finally{Xm=t}}var $m,eh=0,th=0,nh=0,rh=0,ih=0;function ah(e){if(Xm===void 0)return;let t=e.n;return t===void 0||t.t!==Xm?(t={i:0,S:e,p:Xm.s,n:void 0,t:Xm,e:void 0,x:void 0,r:t},Xm.s!==void 0&&(Xm.s.n=t),Xm.s=t,e.n=t,32&Xm.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Xm.s,t.n=void 0,Xm.s.n=t,Xm.s=t),t):void 0}function oh(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function sh(e,t){return new oh(e,t)}function ch(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function lh(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function uh(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function dh(e,t){oh.call(this,void 0),this.x=e,this.s=void 0,this.g=ih-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function fh(e){let t=e.m;if(e.m=void 0,typeof t==`function`){eh++;let n=Xm;Xm=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,ph(e),t}finally{Xm=n,Jm()}}}function ph(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,fh(e)}function mh(e){if(Xm!==this)throw Error(`Out-of-order effect`);uh(this),Xm=e,this.f&=-2,8&this.f&&ph(this),Jm()}function hh(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function gh(e,t){let n=new hh(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}function _h(e,t={}){let n={};for(let r in e){let i=t[r];n[r]=sh(i===void 0?e[r]:i)}return n}oh.prototype.brand=qm,oh.prototype.h=function(){return!0},oh.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?Qm(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},oh.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Qm(()=>{var e;(e=this.Z)==null||e.call(this)}))}},oh.prototype.subscribe=function(e){return gh(()=>{let t=this.value,n=Xm;Xm=void 0;try{e(t)}finally{Xm=n}},{name:`sub`})},oh.prototype.valueOf=function(){return this.value},oh.prototype.toString=function(){return this.value+``},oh.prototype.toJSON=function(){return this.value},oh.prototype.peek=function(){let e=Xm;Xm=void 0;try{return this.value}finally{Xm=e}},Object.defineProperty(oh.prototype,"value",{get(){let e=ah(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(th>100)throw Error(`Cycle detected`);(function(e){eh!==0&&th===0&&e.l!==rh&&(e.l=rh,$m={S:e,v:e.v,i:e.i,o:$m})})(this),this.v=e,this.i++,ih++,eh++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Jm()}}}}),dh.prototype=new oh,dh.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ih))return!0;if(this.g=ih,this.f|=1,this.i>0&&!ch(this))return this.f&=-2,!0;let e=Xm;try{lh(this),Xm=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Xm=e,uh(this),this.f&=-2,!0},dh.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}oh.prototype.S.call(this,e)},dh.prototype.U=function(e){if(this.t!==void 0&&(oh.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},dh.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(dh.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=ah(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),hh.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},hh.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,fh(this),lh(this),eh++;let e=Xm;return Xm=this,mh.bind(this,e)},hh.prototype.N=function(){2&this.f||(this.f|=2,this.u=Zm,Zm=this)},hh.prototype.d=function(){this.f|=8,1&this.f||ph(this)},hh.prototype.dispose=function(){this.d()};function vh(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}function yh(e,t){let n;return sh(e(),{unwatched(){n&&=(n(),void 0)},watched(){this.value=e(),n=t(this)}})}function bh(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var xh;try{xh=`0.48.0+prod.esm`}catch{}var Sh=xh??`"<unknown>+source"`,Ch=new Set([`__proto__`,`constructor`,`prototype`]);function wh(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!Ch.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=wh(n[e],r[e]));return e}return t}var Th=0,Eh=1,Dh=2,Oh=3,kh=4,Ah=5,jh=6,Mh=7;function Nh(e){return e.id===Th}function Ph(e){return e.id===Dh}function Fh(e){return function(e){return e.id===Eh}(e)||bh(305,String(e.id),String(Eh)),Object.assign(e,{id:Dh})}var Ih=new Set,Lh=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:Th}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):_m;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;Ph(t)||bh(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:Oh,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:kh,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==kh&&bh(307,String(t.id),String(Ah)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:Ah,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==Ah&&bh(308,String(n.id),String(Ah));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:jh})}(n),()=>{let e=this.state;e.id!==Mh&&bh(309,String(n.id),String(Mh)),this.state=function(e){return Object.assign(e,{id:Ah})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==jh&&bh(310,String(t.id),String(jh)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:Mh})}(t),n}getSignal(){return this._signal===void 0&&bh(311),this._signal}getInitResult(){this.extension.init===void 0&&bh(312,this.extension.name);let e=this.state;return function(e){return e.id>=kh}(e)||bh(313,String(e.id),String(kh)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=Oh}(e)||bh(314,String(e.id),String(Oh)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&bh(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&bh(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=Mh}(e)||bh(316,String(e.id),String(Mh)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Ih}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=Ah})(e)||bh(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},Rh={tag:oc};function zh(){let e=U();e.isEmpty()&&e.append(V())}var Bh=pm({config:gm({setOptions:Rh,updateOptions:Rh}),init:({$initialEditorState:e=zh})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(gu(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[du,Sc,yu,Nc,Eu]}),Vh=Symbol.for(`@lexical/extension/LexicalBuilder`);function Hh(...e){return qh.fromExtensions(e).buildEditor()}function Uh(){}function Wh(e){throw e}function Gh(e){return Array.isArray(e)?e:[e]}var Kh=Sh,qh=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Kh,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Gh(Bh)];for(let e of t)n.push(Gh(e));return new e(n)}static maybeFromEditor(t){let n=t[Vh];return n&&(n.PACKAGE_VERSION!==Kh&&bh(292,n.PACKAGE_VERSION,Kh),n instanceof e||bh(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&bh(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(Nu({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Vh]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Uh;function t(){try{e()}finally{e=Uh}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=xm(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&bh(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&bh(296);let[t]=Gh(e);typeof t.name!=`string`&&bh(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&bh(298,t.name),!n){n=new Lh(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&bh(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&bh(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=Gh(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(Ph(i))return;let a=n.extension.name;var o;Nh(i)||bh(300,a,r||`[unknown]`),Nh(o=i)||bh(304,String(o.id),String(Th)),i=Object.assign(o,{id:Eh}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=Fh(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())Nh(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&bh(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return xm(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.onWarn!==void 0&&(e.onWarn=o.onWarn),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of vh(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&bh(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&wh(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=Wh,e}};function Jh(e,t){let n=qh.fromEditor(e).getExtensionRep(t);return n===void 0&&bh(303,t.name),n.getExtensionDependency()}function Yh(e,t){let n=qh.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function Xh(e){return Yh(wf(),e)}var Zh=P(`INSERT_HORIZONTAL_RULE_COMMAND`),Qh=class e extends uu{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return eg().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:$h,priority:0})}}exportDOM(){return{element:of().createElement(`hr`)}}createDOM(e){let t=of().createElement(`hr`);return ym(t,e.theme.hr),t}getTextContent(){return`
32
+ `}isInline(){return!1}updateDOM(){return!1}};function $h(){return{node:eg()}}function eg(){return Gf(Qh)}function tg(e){return e instanceof Qh}var ng=pm({build:(e,t)=>_h({inheritEditableFromParent:t.inheritEditableFromParent}),config:gm({$getParentEditor:function(){let e=wf();return qh.fromEditor(e),e},inheritEditableFromParent:!1}),init:(e,t,n)=>{let r=t.$getParentEditor();e.parentEditor=r,e.theme=e.theme||r._config.theme},name:`@lexical/extension/NestedEditor`,register:(e,t,n)=>gh(()=>{let t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})});Date.now;function rg(e){return e.canIndent()}function ig(e,t,n=rg){return xm(e.registerCommand(ns,t=>{let n=R();if(!I(n))return!1;t.preventDefault();let r=function(e){if(e.getNodes().filter(e=>cl(e)&&e.canIndent()).length>0)return!0;let t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,i=zm(r.getNode());if(i.canIndent()){let e=i.getKey(),t=ul();if(t.anchor.set(e,0,`element`),t.focus.set(e,0,`element`),t=Ea(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?as:is:rs;return e.dispatchCommand(r,void 0)},0),e.registerCommand(is,()=>{let e=typeof t==`number`?t:t?t.peek():null;if(!I(R()))return!1;let r=typeof n==`function`?n:n.peek();return Wm(t=>{if(r(t)){let n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},4))}function ag(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(I(a)&&I(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||fu(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&F(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!F(l)||!F(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function og(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=p.has(`paste`)||p.has(`cut`)?0:ag(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(ac);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(I(a)&&I(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!F(r)||!F(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function sg(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function cg(e,t,n,r=Date.now,i,a=null){let o=og(e,n,r),s=()=>{i&&i(t)};return s(),xm(e.registerCommand(Ho,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(gs,!0)),i.length===0&&e.dispatchCommand(_s,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Uo,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(_s,!0));let o=r.pop();r.length===0&&e.dispatchCommand(gs,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(ms,()=>(sg(t,i),!1),0),e.registerCommand(hs,()=>(sg(t,i),e.dispatchCommand(gs,!1),e.dispatchCommand(_s,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(gs,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(_s,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function lg(){return{current:null,redoStack:[],undoStack:[]}}var ug=pm({build:(e,{delay:t,createInitialHistoryState:n,disabled:r,maxDepth:i,now:a},o)=>({..._h({delay:t,disabled:r,historyState:n(e),maxDepth:i,now:a}),...o.getInitResult()}),config:gm({createInitialHistoryState:lg,delay:300,disabled:typeof window>`u`,maxDepth:null,now:Date.now}),init:()=>({canRedo:sh(!1),canUndo:sh(!1)}),name:`@lexical/history/History`,register:(e,t,n)=>{let{canUndo:r,canRedo:i}=n.getInitResult(),a=n.getOutput(),o=e=>Ym(()=>{r.value=e!=null&&e.undoStack.length>0,i.value=e!=null&&e.redoStack.length>0});return gh(()=>{if(!a.disabled.value)return cg(e,a.historyState.value,a.delay,()=>a.now.peek()(),o,a.maxDepth);o(null)})}}),dg=pm({build:(e,{disabled:t,parentEditor:n})=>_h({disabled:t,parentEditor:n||e._parentEditor}),config:gm({disabled:!1,parentEditor:null}),dependencies:[mm(ug,{disabled:!0})],name:`@lexical/history/SharedHistory`,register:(e,t,n)=>gh(()=>{let{disabled:e,parentEditor:t}=n.getOutput();if(!e.value){let{output:e}=n.getDependency(ug),r=function(e){return e?Yh(e,ug.name):null}(t.value);if(!r)return;let i=r.output;Ym(()=>{e.delay.value=i.delay.value,e.historyState.value=i.historyState.value,e.now.value=i.now.value,e.disabled.value=i.disabled.value})}})});function fg(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var pg;function mg(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function hg(e){return pg&&pg.editor===e?pg:void 0}function gg(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(mg(e,n))]}return t}function _g(e,t){let n=t;for(let r of e){let[e,i]=gg(n,r),a=e.key;if(n===t&&mg(n,e)===i)continue;let o=n===t||n===void 0?vg(t):n;o[a]=i,n=o}return n}function vg(e){return Object.create(e||null)}function yg(e,t){return[e,t]}function bg(e,t,n,r=wf()){let i=pg,a=hg(r);try{return pg={...a,editor:r,[e]:t},n()}finally{pg=i}}function xg(e,t=()=>{}){return(n,r=wf())=>i=>{let a=hg(r),o=a&&a[e],s=_g(n,o||t(r));return s&&s!==o?bg(e,s,i,r):i()}}function Sg(e,t,n,r){return Object.assign(ua(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}function Cg(e){if(!Zu(e))return;let t=e;if(t.querySelector(`style`)===null)return;let n=new Map;function r(e){let t=n.get(e);if(t===void 0){t=new Set;for(let n=0;n<e.style.length;n++)t.add(e.style[n]);n.set(e,t)}return t}try{for(let e of Array.from(t.styleSheets)){let n;try{n=e.cssRules}catch{continue}for(let e of Array.from(n)){if(!Hm(e,CSSStyleRule))continue;let n;try{n=t.querySelectorAll(e.selectorText)}catch{continue}for(let t of Array.from(n)){if(!G(t))continue;let n=r(t);for(let r=0;r<e.style.length;r++){let i=e.style[r];n.has(i)||t.style.setProperty(i,e.style.getPropertyValue(i),e.style.getPropertyPriority(i))}}}}}catch{}}var wg=`@lexical/html/DOM`,Tg=Symbol.for(`@lexical/html/DOMExportContext`);function Eg(e,t,n){return Sg(Tg,e,t,n)}var Dg=Eg(`isExport`,Boolean);function Og(e){let t=Yh(e,wg);return t?t.output.defaults:void 0}function kg(e){let t=Yh(e,wg);return t?t.output.runtime:void 0}function Ag(e=wf()){let t=kg(e);return t?t.getSessionConfig():Tf(e)}var jg=xg(Tg,Og),Mg=Symbol.for(`@lexical/html/SelectorImpl`);function Ng(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?G:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>Ng(e,[...t,n]);return{[Mg]:n,attr:(e,t,n)=>i(Ig(e,t,n)),classAll:(...e)=>i(Fg(e)),classAny:(...e)=>i(function(e){let t=Pg(e);return t.length===0?()=>!1:e=>{if(!G(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>G(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!G(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}fg(362,JSON.stringify(e))}(e,t,n))}}function Pg(e){let t=[];for(let n of e)n&&t.push(n);return t}function Fg(e){let t=Pg(e);return t.length===0?()=>!0:e=>{if(!G(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function Ig(e,t,n){if(!0===t)return t=>G(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>G(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!G(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}fg(361,JSON.stringify(e))}var Lg={kind:`text`,predicate:Xu,tags:new Set},Rg={[Mg]:Lg},zg={kind:`comment`,predicate:e=>e.nodeType===8,tags:new Set},Bg={[Mg]:zg},Vg={any:()=>Ng(new Set,[]),comment:()=>Bg,tag(...e){e.length>0||fg(363);let t=new Set;for(let n of e)t.add(n.toUpperCase());return Ng(t,[])},text:()=>Rg},Hg=/[A-Za-z0-9_-]/,Ug=class{constructor(e,t){this.source=e,this.pos=t}peek(e=0){return this.source[this.pos+e]||``}consume(){return this.source[this.pos++]||``}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){let e=this.pos;for(;!this.eof()&&Hg.test(this.peek());)this.pos++;return this.source.slice(e,this.pos)}readQuoted(){let e=this.consume();this.assert(e===`"`||e===`'`,`expected quote`);let t=this.pos;for(;!this.eof()&&this.peek()!==e;)this.peek()===`\\`?this.pos+=2:this.pos++;this.assert(!this.eof(),`unterminated string`);let n=this.source.slice(t,this.pos);return this.pos++,n.replace(/\\(.)/g,`$1`)}assert(e,t){e||fg(364,String(this.pos+1),t,this.source)}};function Wg(e){let t=new Set,n=[],r=[];if(e.skipWhitespace(),e.peek()===`*`)e.consume();else if(Hg.test(e.peek())){let n=e.readIdent();n&&t.add(n.toUpperCase())}for(;!e.eof();){let t=e.peek();if(t===`.`){e.consume();let t=e.readIdent();e.assert(t!==``,`expected class name after "."`),r.push(t)}else if(t===`#`){e.consume();let t=e.readIdent();e.assert(t!==``,`expected id after "#"`),n.push(Ig(`id`,t))}else{if(t!==`[`)break;{e.consume(),e.skipWhitespace();let t=e.readIdent();e.assert(t!==``,`expected attribute name after "["`),e.skipWhitespace();let r=!0;if(e.peek()===`=`){e.consume(),e.skipWhitespace();let t=e.peek();t===`"`||t===`'`?r=e.readQuoted():(r=e.readIdent(),e.assert(r!==``,`expected attribute value`)),e.skipWhitespace()}e.assert(e.peek()===`]`,`expected "]"`),e.consume(),n.push(Ig(t,r))}}}return r.length>0&&n.push(Fg(r)),{predicates:n,tags:t}}function Gg(e){let t=new Ug(e,0),n=[];for(;;){let e=Wg(t);if(n.push(e),t.skipWhitespace(),t.eof())break;t.assert(t.peek()===`,`,`expected "," (selector lists are the only supported combinator)`),t.consume(),t.skipWhitespace()}if(n.length===1)return Ng(n[0].tags,n[0].predicates);let r=new Set;for(let e of n)for(let t of e.tags)r.add(t);return Ng(r,[(e,t)=>{for(let r of n){let n=e.nodeName;if(r.tags.size>0&&!r.tags.has(n))continue;let i=!0;for(let n of r.predicates)if(!n(e,t)){i=!1;break}if(i)return!0}return!1}])}var Kg=Vg;Kg.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),Kg.text(),Kg.tag(`script`,`style`),Kg.tag(`br`),Kg.tag(`p`),Kg.tag(`hr`),Kg.any(),Object.freeze([]),Object.freeze({}),Vg.any();var qg={any:Vg.any,comment:Vg.comment,css:Gg,tag:Vg.tag,text:Vg.text},Jg=new Set([`STYLE`,`SCRIPT`]);function Yg(e,t){Cg(t);let n=Zu(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!Jg.has(t.nodeName)){let n=$g(t,e,i,!1);if(n!==null)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof vu&&t.insertAfter(xu());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Xg(e,t=null,n=wf()){return jg([yg(Dg,!0)],n)(()=>{let r=U(),i=Ag(n),a=I(t)?tp(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(z(a)?a:r).getChildren())Qg(n,e,o,t,i);return e})}function Zg(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&fg(338),Ul(e),Xg(of().createElement(`div`),t,e).innerHTML}function Qg(e,t,n,r=null,i=Tf(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&F(t)&&(s=Em(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=of().createDocumentFragment(),p=d?d():z(s)?s.getChildren():[],m=a&&L(r)&&z(t)?null:r,h=f.append.bind(f);for(let n of p){let o=Qg(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((G(c)||vf(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(vf(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function $g(e,t,n,r,i=new Map,a){let o=[];if(Jg.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let d=e.childNodes,f=[],p=(s==null||!Gd(s))&&(s!=null&&cl(s)||r);for(let e=0;e<d.length;e++)f.push(...$g(d[e],t,n,p,new Map(i),s));if(u!=null&&(f=u(f)),Sf(e)&&(f=e_(e,f,p?()=>{let e=new vu;return n.push(e),e}:V)),s==null){if(f.length>0)for(let e of f)o.push(e);else Sf(e)&&function(e){return e.nextSibling==null||e.previousSibling==null?!1:bf(e.nextSibling)&&bf(e.previousSibling)}(e)&&o.push(xu())}else z(s)&&s.append(...f);return o}function e_(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if(cl(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&cl(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}function t_(e,t,n=null){let r=af(n),i=n?nf(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=Fd(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(ef(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function n_(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var r_={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function i_(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}var a_=(e,t)=>{if(!I(t))return t.insertRawText(e),!0;let n=e=>{let t=R();I(t)&&e(t)};return Cl(e,{linebreak:()=>n(e=>e.insertParagraph()),tab:()=>n(e=>e.insertNodes([Pc()])),text:e=>n(t=>t.insertText(e))}),!0},o_={"application/x-lexical-editor":[(e,t,n)=>{try{let n=wf(),r=JSON.parse(e);if(r&&r.namespace===n._config.namespace&&Array.isArray(r.nodes))return v_(n,x_(r.nodes),t),!0}catch(e){console.error(e)}return n()}],"text/html":[(e,t,n)=>{try{let n=wf();return v_(n,Yg(n,new DOMParser().parseFromString(i_(e),`text/html`)),t),!0}catch(e){return console.error(e),n()}}],"text/plain":[a_],"text/uri-list":[a_]};function s_(e,t,n,r){if(!e)return!1;let i=a=>!!e[a]&&e[a](t,n,i.bind(null,a-1),r);return i(e.length-1)}function c_(e,t,n){let r=t.getData(`text/plain`);for(let i of function(e){return Object.keys(e.$importMimeType).filter(t=>e.$importMimeType[t]!==void 0).sort((t,n)=>{let r=e.priority[t],i=e.priority[n];return r===void 0&&i===void 0?t<n?-1:+(t>n):r===void 0?1:i===void 0?-1:r-i})}(e)){let a=t.getData(i);if(a&&(i!==`text/html`||a!==r)&&s_(e.$importMimeType[i],a,n,t))return!0}return!1}var l_={$importMimeType:o_,$insertDataTransfer:(e,t)=>c_({$importMimeType:o_,priority:r_},e,t),priority:r_},u_=pm({build:(e,t)=>({$importMimeType:t.$importMimeType,$insertDataTransfer:(e,n)=>c_(t,e,n),priority:t.priority}),config:gm({$importMimeType:o_,priority:r_}),mergeConfig(e,t){let n=_m(e,t);if(t.$importMimeType){let r={...e.$importMimeType};for(let[e,n]of Object.entries(t.$importMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$importMimeType=r}return t.priority&&(n.priority={...e.priority,...t.priority}),n},name:`@lexical/clipboard/Import`});function d_(e,t=R()){return t??n_(166),I(t)&&t.isCollapsed()||t.getNodes().length===0?``:Zg(e,t)}function f_(e,t=R()){return t??n_(166),I(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(b_(e,t))}function p_(e,t,n){(function(){let e=Xh(u_.name);return e?e.output:l_})().$insertDataTransfer(e,t)}var m_=`application/x-lexical-drag`;function h_(e,t){let n={editorKey:t.getKey()};e.setData(m_,JSON.stringify(n))}function g_(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(m_);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=t_(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=ld(n.node);if(r===null)return null;if(F(r))return Mp(r,`next`,n.offset);if(z(r))return cm(r,n.offset,`next`);let i=r.getParent();return i===null?null:cm(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=dm(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=R();if(s){if(!I(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=sm($p(t),`next`);return Wp(n,e)<0&&Wp(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,Zp(Vp(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of rf(t)){let t=qu(n);if(Gu(t)&&t.getKey()===e&&G(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function __(e,t){return g_(e,t,p_)}function v_(e,t,n){e.dispatchCommand(Eo,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(I(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=Yp(t,`previous`);if(r){if(Tp(r))n=r.origin;else{let e=Hp(r,Fp(U(),`next`).getFlipped());for(let t of e){if(F(t.origin)){n=t.origin;break}if(z(t.origin)&&!t.origin.isInline())break}}}if(n&&F(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function y_(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=z(n)&&n.excludeFromCopy(`html`),o=n;t!==null&&F(o)&&(o=Em(t,o,`clone`));let s=z(o)?o.getChildren():[],c=function(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&n_(58,n.name),z(e)){let e=t.children;Array.isArray(e)||n_(59,n.name)}return t}(o);F(o)&&o.getTextContentSize()===0&&(i=!1);let l=i&&L(t)&&z(n)?null:t;for(let r=0;r<s.length;r++){let a=s[r],o=y_(e,l,a,c.children);!i&&z(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a){let t=rp(o);if(t.length>0){let n={};for(let r of t){let t=ip(o,r);t===null&&n_(366,o.constructor.name,r);let i=[];y_(e,null,t,i),i.length===1&&i[0].type===t.getType()||n_(385,r,o.constructor.name,String(i.length),String(i.length>0?i[0].type:`none`)),n[r]=i[0]}c.$slots=n}}if(i&&!a)r.push(c);else if(Array.isArray(c.children))for(let e=0;e<c.children.length;e++){let t=c.children[e];r.push(t)}return i}function b_(e,t){let n=[],r=U(),i=I(t)?t.anchor.getNode():L(t)?t.getNodes()[0]??null:null,a=i===null?null:tp(i),o=(z(a)?a:r).getChildren();for(let r=0;r<o.length;r++)y_(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function x_(e){let t=[];for(let n of e)t.push(Zl(n));return t}var S_=null;async function C_(e,t,n){if(S_!==null)return!1;if(t!==null)return new Promise((r,i)=>{e.update(()=>{r(w_(e,t,n))})});let r=e.getRootElement(),i=e._window||window,a=i.document,o=Qd(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.position=`fixed`,s.style.top=`-1000px`,s.append(a.createTextNode(`#`)),r.append(s);let c=a.createRange();return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise((t,r)=>{let o=e.registerCommand(ds,r=>(Hm(r,ClipboardEvent)&&(o(),S_!==null&&(i.clearTimeout(S_),S_=null),t(w_(e,r,n))),!0),4);S_=i.setTimeout(()=>{o(),S_=null,t(!1)},50),a.execCommand(`copy`),s.remove()})}function w_(e,t,n){if(n===void 0){let t=Qd(e._window),r=R();if(!r||r.isCollapsed()||!t)return!1;let i=lf(t,e.getRootElement()),a=i.anchorNode,o=i.focusNode;if(a!==null&&o!==null&&!Wu(e,a,o))return!1;n=E_(r)}t.preventDefault();let r=t.clipboardData;return r!==null&&(D_(r,n),!0)}var T_=[[`text/html`,d_],[`application/x-lexical-editor`,f_]];function E_(e=R()){return function(e,t){let n={"text/plain":``};for(let[r,i]of Object.entries(e))if(i){let e=A_(i,t);e!==null&&(n[r]=e)}return n}(O_(),e)}function D_(e,t){for(let[n]of T_)t[n]===void 0&&e.setData(n,``);for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}function O_(e=wf()){let t=Yh(e,j_.name);return t?t.output:k_}var k_={"application/x-lexical-editor":[(e,t)=>e?f_(wf(),e):t()],"text/html":[(e,t)=>e?d_(wf(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function A_(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}var j_=pm({build:(e,t,n)=>t.$exportMimeType,config:gm({$exportMimeType:k_}),mergeConfig(e,t){let n=_m(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$exportMimeType=r}return n},name:`@lexical/clipboard/GetClipboardData`}),M_={bold:`bold`,italic:`italic`,strikeThrough:`strikethrough`,subscript:`subscript`,superscript:`superscript`,underline:`underline`},N_=Symbol.for(`@lexical/dragon/WindowState`);function P_(e,t,n){let r=function(e){let t=e[N_];return t===void 0&&(t={dispose:()=>{},editors:new Map,installs:new Set},e[N_]=t),t}(e);if(r.installs.size===0){let t=R_.bind(e);e.addEventListener(`message`,t,!0),r.dispose=()=>{e.removeEventListener(`message`,t,!0)}}if(r.installs.add(t),n){let e=r.editors.get(n)||new Set;e.add(t),r.editors.set(n,e)}return F_.bind(null,e,r,t,n)}function F_(e,t,n,r){if(r){let e=t.editors.get(r);e&&e.delete(n)&&e.size===0&&t.editors.delete(r)}t.installs.delete(n)&&t.installs.size===0&&(t.dispose(),delete e[N_])}function I_(e){return e&&e.ownerDocument.defaultView}function L_(e){let t=yh(()=>I_(e.getRootElement()),t=>e.registerRootListener(e=>{t.value=I_(e)}));return gh(()=>{let n=t.value;if(n)return P_(n,Symbol(`@lexical/dragon/editorInstall`),e)})}function R_(e){if(e.origin!==this.location.origin)return;let t=function(e){let t=e[N_];if(t===void 0)return null;let n=qu(mf(e.document));return Gu(n)&&t.editors.has(n)?n:null}(this);if(t===null)return;let n=e.data;if(typeof n==`string`){let r;try{r=JSON.parse(n)}catch{return}if(r&&r.protocol===`nuanria_messaging`&&r.type===`request`){let n=r.payload;if(n&&n.functionId===`makeChanges`){let r=n.args;if(Array.isArray(r)){let[n,i,a,o,s,c]=r;if(![n,i,o,s].every(Number.isFinite)||typeof a!=`string`&&a!==-1)return;t.update(()=>{let t=R();if(I(t)){let r=t.anchor,l=r.getNode(),u=0,d=0;if(F(l)&&n>=0&&i>=0&&(u=n,d=n+i,t.setTextNodeRange(l,u,l,d)),typeof a!=`string`||u===d&&a===``||(t.insertRawText(a),l=r.getNode()),F(l)){let e=l.getTextContentSize();u=Math.min(Math.max(o,0),e),d=o<0||s<0?u:Math.min(o+s,e),t.setTextNodeRange(l,u,l,d)}if(typeof c==`string`&&s>0&&!t.isCollapsed()){let e=M_[c];e!==void 0&&t.formatText(e)}e.stopImmediatePropagation()}})}}}}}qg.tag(`h1`,`h2`,`h3`,`h4`,`h5`,`h6`),qg.tag(`blockquote`),qg.tag(`blockquote`),qg.tag(`p`),qg.tag(`span`);var z_=P(`DRAG_DROP_PASTE_FILE`),B_=ua(`shadowRoot`,{parse:Boolean}),V_=class e extends cu{static getType(){return`quote`}static clone(t){return new e(t.__key)}$config(){return this.config(`quote`,{extends:cu,stateConfigs:[{flat:!0,stateConfig:B_}]})}isShadowRoot(){return da(this,B_)}setIsShadowRoot(e){return fa(this,B_,e)}createDOM(e){let t=of().createElement(`blockquote`);return ym(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:q_,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(G(t)){this.isEmpty()&&t.append(of().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return H_().updateFromJSON(e)}exportJSON(){return super.exportJSON()}insertNewAfter(e,t){let n=V(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){if(this.isShadowRoot()){for(let e of this.getChildren())this.insertBefore(e);return this.remove(),!0}let e=V();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function H_(e){let t=qd(new V_);return e&&e.shadowRoot?t.setIsShadowRoot(!0):t}function U_(e){return e instanceof V_}var W_=class e extends cu{__tag;static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let t=this.__tag,n=of().createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];ym(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:K_,priority:0}),h2:e=>({conversion:K_,priority:0}),h3:e=>({conversion:K_,priority:0}),h4:e=>({conversion:K_,priority:0}),h5:e=>({conversion:K_,priority:0}),h6:e=>({conversion:K_,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&G_(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>G_(e)?{conversion:e=>({node:J_(`h1`)}),priority:3}:null}}exportDOM(e){let{element:t}=super.exportDOM(e);if(G(t)){this.isEmpty()&&t.append(of().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return J_(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){let n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?V():J_(this.getTag()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){let e=V();e.select(),this.replace(e,!0)}return i}collapseAtStart(){if(this.isEmpty()){let e=V();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function G_(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function K_(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=J_(t),Pf(e,n),If(n,e),Ff(n,e)),{node:n}}function q_(e){let t=H_();return If(t,e),Pf(e,t),Ff(t,e),{node:t}}function J_(e=`h1`){return qd(new W_(e))}function Y_(e){return e instanceof W_}function X_(e){return B(ld(e))}function Z_(e,t,n,r){let i=!1,a=null;if(e.isCollapsed()&&e.anchor.type===`text`){let t=e.anchor.getNode();if(F(t)){a=t;let r=e.anchor.offset,o=r===t.getTextContentSize()&&t.getNextSibling()===null,s=r===0&&t.getPreviousSibling()===null;i=n===`end`&&o||n===`start`&&s||n===`both`&&(o||s)}}let o=!1;for(let[n,s]of Object.entries(r)){if(s==null||!s[t])continue;let r=n;if(s.onlyAtBoundary){if(!(i&&a&&F(a)&&a.hasFormat(r)))continue;o=!0}e.hasFormat(r)&&e.toggleFormat(r)}o&&e.setStyle(``)}var Q_={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function $_(e,t){return function(e,t){if(!e.isCollapsed())return!1;let n=Yp(e.focus,t),r=Kf(n.origin,Wd);if(!r)return!1;let i=e.focus.getNode();if(!r.is(i)&&!zd(i,r))return!1;let a=Hp(n,jp(r,t));if(a.getTextSlices().some(e=>e&&e.getTextContentSize()>0))return!1;let o=Hp(a.anchor.getSiblingCaret(),a.focus),s=o.anchor.origin;for(let e of o){if(!Ep(e)||!e.origin.is(s.getParent()))return!1;s=e.origin}let c=r;for(let e of Bp(jp(r,t))){if(!e.origin.is(c.getParent())){if(Xd(e.origin)){let e=jp(c,t);return Zp(Hp(e,e)),!0}break}if(!Wd(e.origin))break;c=e.origin}return!1}(e,t)||function(e,t){if(!e.isCollapsed()||e.anchor.type!==`element`)return!1;let n=Yp(e.anchor,t).getNodeAtCaret();return!(!Wd(n)||n.isInline()||(Zp(Vp(im(Fp(n,t)))),0))}(e,t)}function ev(e){return B(e)&&!e.isInline()&&!e.isIsolated()&&e.isKeyboardSelectable()}function tv(e){let t=dl();t.add(e),fd(t)}function nv(e,t){if(!e.isCollapsed())return!1;let n=e.focus,r=n.getNode(),i=t?`previous`:`next`,a=Yp(n,i);if(n.type===`element`&&z(r)&&(fu(r)||Wd(r))){let e=a.getNodeAtCaret();return!(e===null||!ev(e))&&(tv(e.__key),!0)}let o=Kf(z(r)?r:r.getParentOrThrow(),e=>z(e)&&!e.isInline()&&Gd(e.getParent()));if(o===null)return!1;let s=jp(o,i).getNodeAtCaret();if(s===null||!ev(s))return!1;if(o.getTextContentSize()===0)return tv(s.__key),!0;let c=wf().getRootElement();if(c===null)return!1;let l=Qd(c.ownerDocument.defaultView);if(l===null||l.rangeCount===0)return!1;let u=l.anchorNode,d=l.anchorOffset,f=l.focusNode,p=l.focusOffset;l.modify(`move`,t?`backward`:`forward`,`line`);let m=l.anchorNode,h=l.anchorOffset;if(m===null)return rv(l,u,d,f,p),!1;let g=ld(m);return rv(l,u,d,f,p),g!==null&&(m===u&&h===d||!g.is(o)&&!zd(g,o))&&(tv(s.__key),!0)}function rv(e,t,n,r,i){t!==null&&r!==null&&e.setBaseAndExtent(t,n,r,i)}function iv(e,t){if(!e.isCollapsed())return!1;let n=e.focus.getNode(),r=Kf(z(n)?n:n.getParentOrThrow(),e=>z(e)&&!e.isInline());if(r===null)return!1;let i=wf(),a=i.getRootElement();if(a===null)return!1;let o=a.ownerDocument.defaultView;if(o===null)return!1;let s=!1;for(let e of r.getChildren())if(z(e)&&e.isInline()){let t=i.getElementByKey(e.getKey());if(t!==null){let e=o.getComputedStyle(t).display;if(e===`inline-grid`||e===`inline-flex`){s=!0;break}}}if(!s)return!1;let c=jp(r,t?`previous`:`next`).getNodeAtCaret();if(c===null||!z(c)){if(t){let e=r.getFirstDescendant();F(e)?e.select(0,0):r.select(0,0)}else{let e=r.getLastDescendant();if(F(e)){let t=e.getTextContentSize();e.select(t,t)}else{let e=r.getChildrenSize();r.select(e,e)}}return!0}let l=i.getElementByKey(c.getKey());if(l===null)return!1;let u=Qd(o);if(u===null||u.rangeCount===0)return!1;let d=u.getRangeAt(0).cloneRange();d.collapse(!0);let f=d.getBoundingClientRect(),p=l.getBoundingClientRect(),m=p.top+p.height/2;if(f.height>0){let t=t_(f.left,m,a);if(t!==null&&l.contains(t.node)){let n=a.ownerDocument.createRange();return n.setStart(t.node,t.offset),n.collapse(!0),e.applyDOMRange(n),e.dirty=!0,!0}}let h=t?c.getLastDescendant():c.getFirstDescendant();if(F(h)){let e=t?h.getTextContentSize():0;h.select(e,e)}else{let e=c.getChildrenSize();c.select(t?e:0,t?e:0)}return!0}function av(e,t){let n=jp(e,t),r=n.getAdjacentCaret();r!==null&&z(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Zp(Vp(n)):t===`next`?e.selectNext(0,0):e.selectPrevious()}function ov(e,t,n){n.preventDefault(),n.stopPropagation();let r=e.getNodes();if(r.length===0)return!0;let i=r.map(e=>jp(e,`next`)).sort(Wp),a=(t?i[0]:i[i.length-1]).origin,o=Kf(a,e=>e!==a&&z(e)&&!e.isInline())??U(),s=t?0:o.getChildrenSize();return o.select(s,s),!0}function sv(e,t=sh(Q_)){return xm(e.registerCommand(Do,()=>{let e=R();return L(e)?(e.clear(),!0):(I(e)&&Z_(e,`click`,`both`,t.peek()),!1)},0),e.registerCommand(Mo,e=>{let t=R();return I(t)?(t.deleteCharacter(e),!0):!!L(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(Ro,e=>{let t=R();return!!I(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(zo,e=>{let t=R();return!!I(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(Fo,t=>{let n=R();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)p_(r,n,e);else if(I(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(Lo,()=>{let e=R();return!!I(e)&&(e.removeText(),!0)},0),e.registerCommand(Bo,e=>{let t=R();return!(!I(t)&&!L(t))&&(Gc(t,e),!0)},0),e.registerCommand(Vo,e=>{let t=R();return!(!I(t)&&!L(t))&&(Wc(t,e),!0)},0),e.registerCommand(ss,e=>{let t=R();if(!I(t)&&!L(t))return!1;let n=t.getNodes();for(let t of n){let n=Kf(t,e=>z(e)&&!e.isInline());n!==null&&n.setFormat(e)}return!0},0),e.registerCommand(No,e=>{let t=R();return!!I(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Po,()=>{let e=R();return!!I(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(rs,()=>{let e=Pc(),t=R();return I(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Sl([e]),!0},0),e.registerCommand(is,()=>Wm(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(as,()=>Wm(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(Yo,e=>{let t=R();if(L(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),av(n[0],`previous`),!0}else if(I(t)&&(!e.shiftKey&&$_(t,`previous`)||!e.shiftKey&&nv(t,!0)||!e.shiftKey&&iv(t,!0)))return e.preventDefault(),!0;return!1},0),e.registerCommand(Xo,e=>{let t=R();if(L(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),av(n[0],`next`),!0}else if(I(t)&&(function(e){let t=e.focus;return t.key===`root`&&t.offset===U().getChildrenSize()}(t)||!e.shiftKey&&$_(t,`next`)||!e.shiftKey&&nv(t,!1)||!e.shiftKey&&iv(t,!1)))return e.preventDefault(),!0;return!1},0),e.registerCommand(qo,e=>{let n=R();if(L(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),av(t[0],Tm(t[0])?`next`:`previous`),!0}if(!I(n))return!1;if(!e.shiftKey&&$_(n,Tm(n.anchor.getNode())?`next`:`previous`))return e.preventDefault(),!0;if(e.shiftKey||Z_(n,`arrow`,`start`,t.peek()),Mm(n,!0)){let t=e.shiftKey;return e.preventDefault(),Fm(n,t,!0),!0}return!1},0),e.registerCommand(Go,e=>{let n=R();if(L(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),av(t[0],Tm(t[0])?`previous`:`next`),!0}if(!I(n))return!1;if(!e.shiftKey&&$_(n,Tm(n.anchor.getNode())?`previous`:`next`))return e.preventDefault(),!0;if(e.shiftKey||Z_(n,`arrow`,`end`,t.peek()),Mm(n,!1)){let t=e.shiftKey;return e.preventDefault(),Fm(n,t,!1),!0}return!1},0),e.registerCommand($o,t=>{let n=R();if(!L(n)&&X_(t.target))return!1;if(I(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(fu(n))return!1;let r=zm(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(as,void 0);if(fi&&di)return!1}else if(!L(n))return!1;return t.preventDefault(),e.dispatchCommand(Mo,!0)},0),e.registerCommand(ts,t=>{let n=R();return!(!L(n)&&X_(t.target))&&!(!I(n)&&!L(n))&&(t.preventDefault(),e.dispatchCommand(Mo,!1))},0),e.registerCommand(Zo,n=>{let r=R();if(L(r)){let e=r.getNodes();e.length===1&&B(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!I(r))return!1;if(Z_(r,`enter`,`both`,t.peek()),n!==null){if((fi||mi||_i)&&di)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(No,!1)}return e.dispatchCommand(Po,void 0)},0),e.registerCommand(es,()=>!!I(R())&&(e.blur(),!0),0),e.registerCommand(os,t=>{let[,n]=Um(t);if(n.length>0){let r=t.clientX,i=t.clientY,a=t_(r,i,e.getRootElement());if(a!==null){let{offset:t,node:r}=a,i=ld(r);if(i!==null){let e=ul();if(F(i))e.anchor.set(i.getKey(),t,`text`),e.focus.set(i.getKey(),t,`text`);else{let t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}fd(Ea(e))}e.dispatchCommand(z_,n)}return t.preventDefault(),!0}return __(t,e)},0),e.registerCommand(cs,t=>{let[n]=Um(t),r=R();return!(n&&!I(r))&&(I(r)&&!r.isCollapsed()&&t.dataTransfer!==null&&(D_(t.dataTransfer,E_(r)),h_(t.dataTransfer,e)),!0)},0),e.registerCommand(ls,t=>{let[n]=Um(t),r=R();if(n&&!I(r))return!1;let i=t.clientX,a=t.clientY,o=t_(i,a,e.getRootElement());return o!==null&&B(ld(o.node))&&t.preventDefault(),!0},0),e.registerCommand(ps,()=>{let e=R();return Od(I(e)&&tp(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(ds,t=>(C_(e,Hm(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(fs,t=>(async function(e,t){await C_(t,Hm(e,ClipboardEvent)?e:null),t.update(()=>{let e=R();I(e)?e.removeText():L(e)&&e.getNodes().forEach(e=>e.remove())},{tag:`cut`})}(t,e),!0),0),e.registerCommand(Io,t=>{let[,n,r]=Um(t);return n.length>0&&!r?(e.dispatchCommand(z_,n),!0):_f(t.target)&&Uu(t.target)?!1:R()!==null&&(function(e,t){e.preventDefault(),t.update(()=>{let n=R(),r=Hm(e,InputEvent)||Hm(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&p_(r,n,t)},{tag:`paste`})}(t,e),!0)},0),e.registerCommand(Qo,()=>{let e=R();return I(e)&&Z_(e,`space`,`both`,t.peek()),!1},0),e.registerCommand(ns,()=>{let e=R();return I(e)&&Z_(e,`tab`,`both`,t.peek()),!1},0),e.registerCommand(Ko,e=>{let t=R();if(L(t))return ov(t,!1,e);if(!I(t))return!1;let{anchor:n}=t;if(n.type!==`element`||n.offset!==0)return!1;let r=n.getNode();if(!z(r))return!1;let i=r.getFirstChild();if(!B(i)||!i.isInline())return!1;let a=r.getKey(),o=r.selectEnd();return e.shiftKey&&o.anchor.set(a,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(Jo,e=>{let t=R();if(L(t))return ov(t,!0,e);if(!I(t))return!1;let{anchor:n,focus:r}=t,i=Kf(r.getNode(),e=>z(e)&&!e.isInline());if(i===null)return!1;let a=i.getFirstChild();if(!B(a)||!a.isInline()||Kf(n.getNode(),e=>z(e)&&!e.isInline())!==i)return!1;let o=i.getKey();return(r.type!==`element`||r.key!==o||r.offset!==0)&&(t.focus.set(o,0,`element`),e.shiftKey||t.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}function cv(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function lv(e){let t=1,n=e.getParent();for(;n!=null;){if(K(n)){let e=n.getParent();if(q(e)){t++,n=e.getParent();continue}cv(40)}return t}return t}function uv(e){let t=e.getParent();q(t)||cv(40);let n=t,r=t;for(;r!==null;)r=r.getParent(),q(r)&&(n=r);return n}function dv(e){let t=[],n=e.getChildren().filter(K);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();q(i)?t=t.concat(dv(i)):t.push(r)}return t}function fv(e){return K(e)&&q(e.getFirstChild())}function pv(e,t){return K(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function mv(e){let t=R();if(t!==null){let n=t.getNodes();if(I(t)){let[r]=t.getStartEndPoints(),i=r.getNode(),a=i.getParent();if(Gd(i)){let e=i.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=V();i.append(e),n=e.select().getNodes()}}else if(pv(i,n)){let t=Mv(e);if(Gd(a)){i.replace(t);let e=Dv();z(i)&&(e.setFormat(i.getFormatType()),e.setIndent(i.getIndent())),t.append(e)}else if(K(i)){let e=i.getParentOrThrow();hv(t,e.getChildren()),e.replace(t)}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(z(i)&&i.isEmpty()&&!K(i)&&!r.has(i.getKey())){gv(i,e);continue}let a=ed(i)?i.getParent():K(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(q(a)){if(!r.has(t)){let n=Mv(e);hv(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(Gd(n)&&!r.has(t)){r.add(t),gv(a,e);break}a=n}}}}}function hv(e,t){e.splice(e.getChildrenSize(),0,t)}function gv(e,t){if(q(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=Dv(),a;if(hv(i,e.getChildren()),q(n)&&t===n.getListType())n.append(i),q(r)&&t===r.getListType()&&(hv(n,r.getChildren()),r.remove()),a=n;else if(q(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=Mv(t);n.append(i),e.replace(n),a=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());let o=R();return I(o)&&(a.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,`element`),a.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,`element`)),e.remove(),a}function _v(e,t){let n=e.getLastChild(),r=t.getFirstChild();n&&r&&fv(n)&&fv(r)&&(_v(n.getFirstChild(),r.getFirstChild()),r.remove());let i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function vv(){let e=R();if(I(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(pv(r,n))t.add(uv(r));else for(let e=0;e<n.length;e++){let r=n[e];if(ed(r)){let e=Rm(r,Cv);e!=null&&t.add(uv(e))}}for(let n of t){let t=n,r=dv(n);for(let n of r){let r=V().setTextStyle(e.style).setTextFormat(e.format);hv(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Xp(e.anchor,im(Fp(r,`next`))),n.__key===e.focus.key&&Xp(e.focus,im(Fp(r,`next`))),n.remove()}n.remove()}}}function yv(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())K(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),q(r.getFirstChild())||n++)}function bv(e){let t=new Set;if(fv(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(fv(r)&&fv(i)){let n=i.getFirstChild();if(q(n)){n.append(e);let i=r.getFirstChild();q(i)&&(hv(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(fv(r)){let t=r.getFirstChild();if(q(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(fv(i)){let t=i.getFirstChild();q(t)&&t.append(e)}else if(q(n)){let t=Kd(e),a=Kd(n);t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function xv(e){if(fv(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(q(n?n.getParent():void 0)&&K(n)&&q(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=Kd(e),i=Kd(t);r.append(i),e.getPreviousSiblings().forEach(e=>i.append(e));let a=Kd(e),o=Kd(t);a.append(o),hv(o,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(a),n.replace(e)}}}function Sv(e=!1){let t=R();if(!I(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=null;if(K(n)&&n.getChildrenSize()===0)r=n;else if(F(n)){let e=n.getParent();K(e)&&e.getChildren().every(e=>F(e)&&e.getTextContent().trim()===``)&&(r=e)}if(r===null)return!1;let i=uv(r),a=r.getParent();q(a)||cv(40);let o=a.getParent(),s;if(Gd(o))s=V(),i.insertAfter(s);else{if(!K(o))return!1;s=Kd(o),o.insertAfter(s)}s.setTextStyle(t.style).setTextFormat(t.format).select();let c=r.getNextSiblings();if(c.length>0){let t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(a,r):1,n=Kd(a).setStart(t);if(K(s)){let e=Kd(s);e.append(n),s.insertAfter(e)}else s.insertAfter(n);n.append(...c)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!K(e)&&!q(e))break;t=e}t.remove()}(r),!0}var Cv=class extends cu{__value;__checked;$config(){return this.config(`listitem`,{$transform:e=>{let t=e.getParent();if(q(t))t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){let n=e.createParentElementNode();q(n)||cv(340);let r=[e];for(let t of[`previous`,`next`]){r.reverse();for(let{origin:n}of jp(e,t)){if(!K(n))break;r.push(n)}}e.insertBefore(n),n.splice(0,0,r),Gd(t)||(fm(n,em(jp(n,`next`)),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:cu,importDOM:Qs({li:()=>({conversion:wv,priority:0})})})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let t=of().createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){(function(e,t){let n=t.getParent();!q(n)||n.getListType()!==`check`||q(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))})(t,this),t.value=this.__value,function(e,t,n){let r=t.list;if(!r)return;let i=r.listitem,a=r.nested&&r.nested.listitem,o=n.getParent(),s=q(o)&&o.getListType()===`check`,c=n.getChecked(),l=n.getChildren().some(e=>q(e)),u=[];r.listitemChecked!==void 0&&u.push(r.listitemChecked),r.listitemUnchecked!==void 0&&u.push(r.listitemUnchecked),a!==void 0&&u.push(...vm(a)),u.length>0&&bm(e,...u);let d=[];if(i!==void 0&&d.push(...vm(i)),s){let e=c?r.listitemChecked:r.listitemUnchecked;e!==void 0&&d.push(e)}a!==void 0&&l&&d.push(...vm(a)),d.length>0&&ym(e,...d)}(t,n.theme,this);let r=e?e.__style:``,i=this.__style;r!==i&&mc(t.style,i,r),function(e,t,n){let r=t.__textStyle,i=n?n.__textStyle:``;if(n!==null&&i===r)return;let a=fc(r);for(let t in a)e.style.setProperty(`--listitem-marker-${t}`,a[t]);if(i!==``)for(let t in fc(i))t in a||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),fv(this)?{after(e){if(G(e)){let t=e.previousElementSibling;if(G(t)&&t.nodeName===`LI`){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(z(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(K(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!q(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=Kd(n),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}let r=this.__key,i=0;if(t&&(z(e)||cv(139),i=e.getChildrenSize(),e.splice(i,0,this.getChildren())),t&&z(e)){let t=R();if(I(t))for(let n of t.getStartEndPoints())n.key===r&&n.type===`element`&&n.set(e.getKey(),i+n.offset,`element`)}return this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(q(n)||cv(39),K(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=Kd(n);r.forEach(e=>i.append(e)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&fv(t)&&fv(n)&&(_v(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){let n=Kd(this);return this.insertAfter(n,t),n}collapseAtStart(e){if(fv(this))return!1;let t=this.getParentOrThrow();if(K(t.getParentOrThrow()))return xv(this),!0;let n=V().append(...this.getChildren()),r=this.getNextSiblings();if(r.length>0){let e=Kd(t);e.append(...r),t.insertAfter(e)}return t.insertAfter(n),this.remove(),t.getChildrenSize()===0&&t.remove(),n.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return q(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;K(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&cv(117),(e=Math.floor(e))>=0||cv(199);let t=this.getIndent();for(;t!==e;)t<e?(bv(this),t++):(xv(this),t--);return this}canInsertAfter(e){return K(e)}canReplaceWith(e){return K(e)}canMergeWith(e){return K(e)||Ou(e)}extractWithChild(e,t){if(!I(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Mv(`bullet`)}canMergeWhenEmpty(){return!0}};function wv(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return Tv(t)}if(e.classList.contains(`joplin-checkbox`)){for(let t of e.children)if(t.classList.contains(`checkbox-wrapper`)&&t.children.length>0&&t.children[0].tagName===`INPUT`)return Tv(t.children[0])}let t=e.getAttribute(`aria-checked`),n=Dv(t===`true`||t!==`false`&&void 0);return If(n,e),{after:Ev.bind(null,n),node:Ff(n,e)}}function Tv(e){if(e.getAttribute(`type`)!==`checkbox`)return{node:null};let t=Dv(e.hasAttribute(`checked`));return{after:Ev.bind(null,t),node:t}}function Ev(e,t){let n=t[0];return t.length===1&&Ou(n)&&!e.getFormatType()&&n.getFormatType()?(e.setFormat(n.getFormatType()),n.getChildren()):t}function Dv(e){return qd(new Cv(void 0,e))}function K(e){return e instanceof Cv}var Ov=class extends cu{__tag;__start;__listType;$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.getNextSibling();q(t)&&e.getListType()===t.getListType()&&_v(e,t)})(e),yv(e)},extends:cu,importDOM:Qs({ol:()=>({conversion:Av,priority:0}),ul:()=>({conversion:Av,priority:0})})})}constructor(e=`number`,t=1,n){super(n);let r=jv[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=of().createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,kv(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(kv(t,n.theme,this),e.__start!==this.__start&&t.setAttribute(`start`,String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let t=this.createDOM(e._config,e);return G(t)&&(this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`)),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){let t=n[e];K(t)||(r===n&&(r=[...n]),r[e]=this.createListItemNode().append(!z(t)||q(t)||t.isInline()?t:jc(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return K(e)}createListItemNode(){return Dv()}};function kv(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=lv(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...vm(s));for(let t=0;t<e.length;t++)t!==o&&i.push(n.__tag+t)}if(l!==void 0){let e=vm(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&bm(e,...i),r.length>0&&ym(e,...r)}function Av(e){let t;if(function(e){return G(e)&&e.nodeName.toLowerCase()===`ol`}(e)){let n=e.start;t=Mv(`number`,n)}else t=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`)||e.getAttribute(`data-is-checklist`)===`1`)return!0;for(let t of e.childNodes)if(G(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?Mv(`check`):Mv(`bullet`);return Ff(t,e),{after:e=>function(e,t){let n=t.createListItemNode.bind(t),r=[];for(let t=0;t<e.length;t++){let i=e[t];if(K(i)){r.push(i);let e=i.getChildren();e.length>1&&e.forEach(e=>{q(e)&&r.push(n().append(e))})}else r.push(n().append(i))}return r}(e,t),node:t}}var jv={ol:`number`,ul:`bullet`};function Mv(e=`number`,t=1){return qd(new Ov(e,t))}function q(e){return e instanceof Ov}var Nv=P(`INSERT_CHECK_LIST_COMMAND`);function Pv(e,t){let n=t&&t.disableTakeFocusOnClick||!1,r=typeof n==`boolean`?()=>n:n.peek.bind(n),i=e=>{let t=e.target;if(!G(t))return!1;let n=t.__lexicalCheckListLastHandled;return n!==void 0&&e.timeStamp-n<500},a=e=>{let t=e.target;G(t)&&(t.__lexicalCheckListLastHandled=e.timeStamp)},o=e=>{i(e)||(a(e),Iv(e,r()))},s=e=>{e.pointerType===`touch`&&(i(e)||(a(e),Iv(e,r())))},c=e=>{(function(e,t){Fv(e,()=>{e.preventDefault(),t&&e.stopPropagation()})})(e,r())};return xm(e.registerCommand(Nv,()=>(mv(`check`),!0),1),e.registerCommand(Xo,t=>Rv(t,e,!1),1),e.registerCommand(Yo,t=>Rv(t,e,!0),1),e.registerCommand(es,()=>Lv(e)!=null&&(e.getRootElement()?.focus(),!0),1),e.registerCommand(Qo,t=>{let n=Lv(e);return!(n==null||!e.isEditable())&&(e.update(()=>{let e=ld(n);K(e)&&(t.preventDefault(),e.toggleChecked())}),!0)},1),e.registerCommand(qo,t=>e.read(`latest`,()=>{let n=R();if(I(n)&&n.isCollapsed()){let{anchor:r}=n,i=r.type===`element`;if(i||r.offset===0){let n=r.getNode(),a=Kf(n,e=>z(e)&&!e.isInline());if(K(a)){let r=a.getParent();if(q(r)&&r.getListType()===`check`&&(i||a.getFirstDescendant()===n)){let n=e.getElementByKey(a.__key);if(n!=null&&pf(n)!==n)return n.focus(),t.preventDefault(),!0}}}}return!1}),1),e.registerRootListener(e=>{if(e!==null)return xm(Sm(e,{click:o,pointerup:s}),Sm(e,{mousedown:c,pointerdown:c},{capture:!0}),Ss(e,`touchstart`,c,{capture:!0,passive:!1}))}))}function Fv(e,t){let n=e.target;if(!G(n))return;let r=n.firstChild;if(G(r)&&(r.tagName===`UL`||r.tagName===`OL`))return;let i=n.parentNode;if(!i||i.__lexicalListType!==`check`)return;let a=null,o=null;if(`clientX`in e)a=e.clientX;else if(`touches`in e){let t=e.touches;t.length>0&&(a=t[0].clientX,o=`touch`)}if(a==null)return;let s=n.getBoundingClientRect(),c=a/Km(n),l=n.ownerDocument.defaultView,u=l?l.getComputedStyle(n,`::before`):{width:`0px`},d=parseFloat(u.width),f=o===`touch`||`pointerType`in e&&e.pointerType===`touch`?32:0;(n.dir===`rtl`?c<s.right+f&&c>s.right-d-f:c>s.left-f&&c<s.left+d+f)&&t()}function Iv(e,t){Fv(e,()=>{if(G(e.target)){let n=e.target,r=Ku(n);r!=null&&r.isEditable()&&r.update(()=>{let e=ld(n);K(e)&&(t?(Ld(`skip-selection-focus`),Ld(`skip-dom-selection`)):n.focus(),e.toggleChecked())})}})}function Lv(e){let t=e.getRootElement(),n=t?pf(t):null;return G(n)&&n.tagName===`LI`&&n.parentNode!=null&&n.parentNode.__lexicalListType===`check`?n:null}function Rv(e,t,n){let r=Lv(t);return r!=null&&t.update(()=>{let i=ld(r);if(!K(i))return;let a=function(e,t){let n=t?e.getPreviousSibling():e.getNextSibling(),r=e;for(;n==null&&K(r);)r=r.getParentOrThrow().getParent(),r!=null&&(n=t?r.getPreviousSibling():r.getNextSibling());for(;K(n);){let e=t?n.getLastChild():n.getFirstChild();if(!q(e))return n;n=t?e.getLastChild():e.getFirstChild()}return null}(i,n);if(a!=null){a.selectStart();let n=t.getElementByKey(a.__key);n!=null&&(e.preventDefault(),setTimeout(()=>{n.focus()},0))}}),!1}qg.tag(`ol`,`ul`),qg.tag(`li`),qg.tag(`li`).classAll(`task-list-item`),qg.tag(`li`).classAll(`joplin-checkbox`);var zv=P(`UPDATE_LIST_START_COMMAND`),Bv=P(`INSERT_UNORDERED_LIST_COMMAND`),Vv=P(`INSERT_ORDERED_LIST_COMMAND`),Hv=P(`REMOVE_LIST_COMMAND`);function Uv(e,t){return xm(e.registerCommand(Vv,()=>(mv(`number`),!0),1),e.registerCommand(zv,e=>{let{listNodeKey:t,newStart:n}=e,r=H(t);return!!q(r)&&(r.getListType()===`number`&&(r.setStart(n),yv(r)),!0)},1),e.registerCommand(Bv,()=>(mv(`bullet`),!0),1),e.registerCommand(Hv,()=>(vv(),!0),1),e.registerCommand(Po,()=>Sv(!!(t&&t.restoreNumbering)),1),e.registerCommand($o,e=>{if(function(){let e=R();if(!I(e)||!e.isCollapsed()||e.anchor.offset!==0)return!1;let t=e.anchor.getNode(),n=Kf(t,K);if(!K(n))return!1;let r=n.getFirstDescendant();if(r===null||!n.is(t)&&!r.is(t))return!1;let i=n.getParent();if(!q(i)||!n.is(i.getFirstChild()))return!1;let a=i.getPreviousSibling();if(!B(a)||a.isIsolated()||!a.isKeyboardSelectable()&&a.isInline())return!1;let o=V().append(...n.getChildren());return i.insertBefore(o),n.remove(),i.isEmpty()&&i.remove(),o.selectStart(),!0}())return e.preventDefault(),!0;let t=R();if(!I(t)||!t.isCollapsed())return!1;let{anchor:n}=t;if(n.offset!==0)return!1;let r=n.getNode();for(;!K(r);){if(r.getPreviousSibling()!==null)return!1;let e=r.getParent();if(e===null)return!1;r=e}return!(!K(r)||!r.collapseAtStart(t))&&(e.preventDefault(),!0)},-8),e.registerNodeTransform(Cv,e=>{let t=e.getFirstChild();if(t){if(F(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=R();I(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}}),e.registerNodeTransform(Sc,e=>{let t=e.getParent();if(K(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}}))}function Wv(e){let t=e=>{let t=e.getParent();if(q(e.getFirstChild())||!q(t))return;let n=Kf(e,e=>K(e)&&q(e.getParent())&&K(e.getPreviousSibling()));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(K(n)){let r=n.getPreviousSibling();if(K(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;q(n);){let e=n.getLastChild();if(!K(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(q(n)){let r=lv(n);r+1<lv(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(Ov,e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(q(e)){for(let r of e.getChildren())if(K(r)){t(r);let e=r.getFirstChild();q(e)&&n.push(e)}}}})}function Gv(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ut(o,o.length,0,Kt(s,e.slice(r+1,n),t)),Ut(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ut(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bt(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bt(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Kv=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Zv.attention=Qv,Zv.peek=$v;function qv(){return{canContainEols:[`delete`],enter:{strikethrough:Yv},exit:{strikethrough:Xv}}}function Jv(){return{handlers:{delete:Zv},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Kv}]}}function Yv(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Xv(e){this.exit(e)}function Zv(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function Qv(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function $v(){return`~`}ay.peek=oy;var ey=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],ty={canContainEols:[`highlight`],enter:{highlight:ny},exit:{highlight:ry}};function ny(e){this.enter({type:`highlight`,children:[]},e)}function ry(e){this.exit(e)}var iy={unsafe:[{character:`=`,inConstruct:`phrasing`,notInConstruct:ey}],handlers:{highlight:ay}};function ay(e,t,n,r){let i=n.createTracker(r),a=n.enter(`highlight`),o=i.move(`==`);return o+=i.move(n.containerPhrasing(e,{before:o,after:`=`,...i.current()})),o+=i.move(`==`),a(),o}function oy(){return`=`}var sy=Object.prototype.hasOwnProperty;function cy(e,t,n){for(n of e.keys())if(ly(n,t))return n}function ly(e,t){var n,r,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&ly(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(i=r,i&&typeof i==`object`&&(i=cy(t,i),!i)||!t.has(i))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(i=r[0],i&&typeof i==`object`&&(i=cy(t,i),!i)||!ly(r[1],t.get(i)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(sy.call(e,n)&&++r&&!sy.call(t,n)||!(n in t)||!ly(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var uy,dy,fy,py,my=!0;typeof process<`u`&&({FORCE_COLOR:uy,NODE_DISABLE_COLORS:dy,NO_COLOR:fy,TERM:py}={},my=process.stdout&&process.stdout.isTTY);var hy={enabled:!dy&&fy==null&&py!==`dumb`&&(uy!=null&&uy!==`0`||my),reset:vy(0,0),bold:vy(1,22),dim:vy(2,22),italic:vy(3,23),underline:vy(4,24),inverse:vy(7,27),hidden:vy(8,28),strikethrough:vy(9,29),black:vy(30,39),red:vy(31,39),green:vy(32,39),yellow:vy(33,39),blue:vy(34,39),magenta:vy(35,39),cyan:vy(36,39),white:vy(37,39),gray:vy(90,39),grey:vy(90,39),bgBlack:vy(40,49),bgRed:vy(41,49),bgGreen:vy(42,49),bgYellow:vy(43,49),bgBlue:vy(44,49),bgMagenta:vy(45,49),bgCyan:vy(46,49),bgWhite:vy(47,49)};function gy(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function _y(e,t){let n={has:e,keys:t};return n.reset=hy.reset.bind(n),n.bold=hy.bold.bind(n),n.dim=hy.dim.bind(n),n.italic=hy.italic.bind(n),n.underline=hy.underline.bind(n),n.inverse=hy.inverse.bind(n),n.hidden=hy.hidden.bind(n),n.strikethrough=hy.strikethrough.bind(n),n.black=hy.black.bind(n),n.red=hy.red.bind(n),n.green=hy.green.bind(n),n.yellow=hy.yellow.bind(n),n.blue=hy.blue.bind(n),n.magenta=hy.magenta.bind(n),n.cyan=hy.cyan.bind(n),n.white=hy.white.bind(n),n.gray=hy.gray.bind(n),n.grey=hy.grey.bind(n),n.bgBlack=hy.bgBlack.bind(n),n.bgRed=hy.bgRed.bind(n),n.bgGreen=hy.bgGreen.bind(n),n.bgYellow=hy.bgYellow.bind(n),n.bgBlue=hy.bgBlue.bind(n),n.bgMagenta=hy.bgMagenta.bind(n),n.bgCyan=hy.bgCyan.bind(n),n.bgWhite=hy.bgWhite.bind(n),n}function vy(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:hy.enabled?gy(this.keys,t+``):t+``):t===void 0?_y([e],[n]):hy.enabled?gy([n],t+``):t+``}}function yy(){}yy.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_)f[n]=void 0;else{if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(by(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function by(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}new yy;var xy=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Sy=/\S/,Cy=new yy;Cy.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Sy.test(e)&&!Sy.test(t)},Cy.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&xy.test(t[n])&&xy.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var wy=new yy;wy.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
33
+ `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var Ty=new yy;Ty.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Ey=new yy;Ey.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Dy(e){"@babel/helpers - typeof";return Dy=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Dy(e)}var Oy=Object.prototype.toString,ky=new yy;ky.useLongestToken=!0,ky.tokenize=wy.tokenize,ky.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(Ay(e,null,null,i),i,` `)},ky.equals=function(e,t){return yy.prototype.equals.call(ky,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function Ay(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));for(var a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Oy.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Ay(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),Dy(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=Ay(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var jy=new yy;jy.tokenize=function(e){return e.slice()},jy.join=jy.removeEmpty=function(e){return e},hy.red,hy.grey,hy.green,hy.dim().italic,hy.dim(`→`),hy.dim(`·`),hy.dim(`↵`);function My(e){e=e.replace(/\r?\n/g,`
34
+ `);let t=e.match(/^[ \t]*(?=\S)/gm),n=0,r=1/0,i=(t||[]).length;for(;n<i;n++)r=Math.min(r,t[n].length);return i&&r?e.replace(RegExp(`^[ \\t]{${r}}`,`gm`),``):e}var Ny=class extends Error{constructor(e={}){super(e.message),this.name=`Assertion`,this.code=`ERR_ASSERTION`,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.details=e.details||!1,this.generated=!!e.generated,this.operator=e.operator,this.expects=e.expects,this.actual=e.actual}};function Py(e,t,n,r,i,a,o){if(e)return;let s=o||a;throw o instanceof Error?o:new Ny({actual:t,expects:n,operator:r,message:s,details:i&&i(t,n),generated:!o})}function Fy(e,t){Py(!!e,!1,!0,`ok`,!1,`Expected value to be truthy`,t)}function Iy(e,t){Py(!e,!0,!1,`not`,!1,`Expected value to be falsey`,t)}Iy.ok=Iy,Iy.equal=function(e,t,n){Py(!ly(e,t),e,t,`not.equal`,!1,`Expected values not to be deeply equal`,n)},Iy.type=function(e,t,n){let r=typeof e;Py(r!==t,r,t,`not.type`,!1,`Expected "${r}" not to be "${t}"`,n)},Iy.instance=function(e,t,n){let r="`"+(t.name||t.constructor.name)+"`";Py(!(e instanceof t),e,t,`not.instance`,!1,`Expected value not to be an instance of ${r}`,n)},Iy.snapshot=function(e,t,n){e=My(e),t=My(t),Py(e!==t,e,t,`not.snapshot`,!1,`Expected value not to match snapshot`,n)},Iy.fixture=function(e,t,n){e=My(e),t=My(t),Py(e!==t,e,t,`not.fixture`,!1,`Expected value not to match fixture`,n)},Iy.match=function(e,t,n){typeof t==`string`?Py(!e.includes(t),e,t,`not.match`,!1,`Expected value not to include "${t}" substring`,n):Py(!t.test(e),e,t,`not.match`,!1,`Expected value not to match \`${String(t)}\` pattern`,n)},Iy.throws=function(e,t,n){!n&&typeof t==`string`&&(n=t,t=null);try{e()}catch(e){typeof t==`function`?Py(!t(e),!0,!1,`not.throws`,!1,`Expected function not to throw matching exception`,n):t instanceof RegExp?Py(!t.test(e.message),!0,!1,`not.throws`,!1,`Expected function not to throw exception matching \`${String(t)}\` pattern`,n):t||Py(!1,!0,!1,`not.throws`,!1,`Expected function not to throw`,n)}};var Ly={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},Ry={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:`CDATA[`,characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:`content`,contentTypeDocument:`document`,contentTypeFlow:`flow`,contentTypeString:`string`,contentTypeText:`text`,hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4},zy={data:`data`,whitespace:`whitespace`,lineEnding:`lineEnding`,lineEndingBlank:`lineEndingBlank`,linePrefix:`linePrefix`,lineSuffix:`lineSuffix`,atxHeading:`atxHeading`,atxHeadingSequence:`atxHeadingSequence`,atxHeadingText:`atxHeadingText`,autolink:`autolink`,autolinkEmail:`autolinkEmail`,autolinkMarker:`autolinkMarker`,autolinkProtocol:`autolinkProtocol`,characterEscape:`characterEscape`,characterEscapeValue:`characterEscapeValue`,characterReference:`characterReference`,characterReferenceMarker:`characterReferenceMarker`,characterReferenceMarkerNumeric:`characterReferenceMarkerNumeric`,characterReferenceMarkerHexadecimal:`characterReferenceMarkerHexadecimal`,characterReferenceValue:`characterReferenceValue`,codeFenced:`codeFenced`,codeFencedFence:`codeFencedFence`,codeFencedFenceSequence:`codeFencedFenceSequence`,codeFencedFenceInfo:`codeFencedFenceInfo`,codeFencedFenceMeta:`codeFencedFenceMeta`,codeFlowValue:`codeFlowValue`,codeIndented:`codeIndented`,codeText:`codeText`,codeTextData:`codeTextData`,codeTextPadding:`codeTextPadding`,codeTextSequence:`codeTextSequence`,content:`content`,definition:`definition`,definitionDestination:`definitionDestination`,definitionDestinationLiteral:`definitionDestinationLiteral`,definitionDestinationLiteralMarker:`definitionDestinationLiteralMarker`,definitionDestinationRaw:`definitionDestinationRaw`,definitionDestinationString:`definitionDestinationString`,definitionLabel:`definitionLabel`,definitionLabelMarker:`definitionLabelMarker`,definitionLabelString:`definitionLabelString`,definitionMarker:`definitionMarker`,definitionTitle:`definitionTitle`,definitionTitleMarker:`definitionTitleMarker`,definitionTitleString:`definitionTitleString`,emphasis:`emphasis`,emphasisSequence:`emphasisSequence`,emphasisText:`emphasisText`,escapeMarker:`escapeMarker`,hardBreakEscape:`hardBreakEscape`,hardBreakTrailing:`hardBreakTrailing`,htmlFlow:`htmlFlow`,htmlFlowData:`htmlFlowData`,htmlText:`htmlText`,htmlTextData:`htmlTextData`,image:`image`,label:`label`,labelText:`labelText`,labelLink:`labelLink`,labelImage:`labelImage`,labelMarker:`labelMarker`,labelImageMarker:`labelImageMarker`,labelEnd:`labelEnd`,link:`link`,paragraph:`paragraph`,reference:`reference`,referenceMarker:`referenceMarker`,referenceString:`referenceString`,resource:`resource`,resourceDestination:`resourceDestination`,resourceDestinationLiteral:`resourceDestinationLiteral`,resourceDestinationLiteralMarker:`resourceDestinationLiteralMarker`,resourceDestinationRaw:`resourceDestinationRaw`,resourceDestinationString:`resourceDestinationString`,resourceMarker:`resourceMarker`,resourceTitle:`resourceTitle`,resourceTitleMarker:`resourceTitleMarker`,resourceTitleString:`resourceTitleString`,setextHeading:`setextHeading`,setextHeadingText:`setextHeadingText`,setextHeadingLine:`setextHeadingLine`,setextHeadingLineSequence:`setextHeadingLineSequence`,strong:`strong`,strongSequence:`strongSequence`,strongText:`strongText`,thematicBreak:`thematicBreak`,thematicBreakSequence:`thematicBreakSequence`,blockQuote:`blockQuote`,blockQuotePrefix:`blockQuotePrefix`,blockQuoteMarker:`blockQuoteMarker`,blockQuotePrefixWhitespace:`blockQuotePrefixWhitespace`,listOrdered:`listOrdered`,listUnordered:`listUnordered`,listItemIndent:`listItemIndent`,listItemMarker:`listItemMarker`,listItemPrefix:`listItemPrefix`,listItemPrefixWhitespace:`listItemPrefixWhitespace`,listItemValue:`listItemValue`,chunkDocument:`chunkDocument`,chunkContent:`chunkContent`,chunkFlow:`chunkFlow`,chunkText:`chunkText`,chunkString:`chunkString`},By=`highlightSequenceTemporary`,Vy=`highlightSequence`,Hy=`highlight`,Uy=`highlightText`;function Wy(){let e={name:`highlight`,tokenize:n,resolveAll:t};return{text:{[Ly.equalsTo]:e},insideSpan:{null:[e]},attentionMarkers:{null:[Ly.equalsTo]}};function t(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===By&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===By&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=Vy,e[r][1].type=Vy;let i={type:Hy,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:Uy,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ut(o,o.length,0,Kt(s,e.slice(r+1,n),t)),Ut(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ut(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===By&&(e[n][1].type=zy.data);return e}function n(e,t,n){let r=this.previous,i=this.events,a=0;return o;function o(t){return Fy(t===Ly.equalsTo,"expected `=`"),r===Ly.equalsTo&&i[i.length-1][1].type!==zy.characterEscape?n(t):(e.enter(By),s(t))}function s(i){let o=Bt(r);if(i===Ly.equalsTo)return a>1?n(i):(e.consume(i),a++,s);if(a<2)return n(i);let c=e.exit(By),l=Bt(i);return c._open=!l||l===Ry.attentionSideAfter&&!!o,c._close=!o||o===Ry.attentionSideAfter&&!!l,t(i)}}}var Gy=[`mdxJsxTextElement`,`mdxJsxFlowElement`];function Ky(e){return Gy.includes(e.type)&&qy.includes(e.name)}var qy=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.input.ins.kbd.label.legend.li.link.main.map.mark.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.param.picture.pre.progress.q.rp.rt.ruby.s.samp.script.section.select.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`);function Jy(e,t){let n=Yy(e),r=Yy(t);return Xy({...n,...r})}function Yy(e){let t={};return e.split(`;`).filter(e=>e.trim()!==``).forEach(e=>{let[n,r]=e.split(`:`).map(e=>e.trim());t[n]=r}),t}function Xy(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`; `)}function Zy(e){return e.data?.mdxEditorImport}function Qy(e){return e&&`localName`in e?e:void 0}function $y(e,t){return{...e,data:{...e.data,mdxEditorImport:t}}}function eb(e){return e.data?.mdxEditorImports||(e.data?.estree?.body??[]).flatMap(e=>e.type===`ImportDeclaration`?e.specifiers.map(t=>{let n=t.type===`ImportDefaultSpecifier`?`default`:t.type===`ImportNamespaceSpecifier`?`namespace`:`named`;return{source:String(e.source.value),defaultExport:n==="default",kind:n,importedName:t.type===`ImportSpecifier`?t.imported.type===`Identifier`?t.imported.name:String(t.imported.value):n==="default"?`default`:`*`,localName:t.local.name}}):[])}function tb(e){return(e.data?.estree?.body??[]).flatMap(e=>{if(e.type!==`ExportNamedDeclaration`||!e.declaration)return[];let t=e.declaration;return t.type===`VariableDeclaration`?t.declarations.flatMap(e=>e.id.type===`Identifier`?[e.id.name]:[]):[t.id.name]})}function nb(e){return`'${JSON.stringify(e).slice(1,-1).replace(/'/g,`\\'`)}'`}function rb(e){let t=e[0],n=t.kind==="default"?t.localName:t.kind===`namespace`?`* as ${t.localName}`:`{ ${e.map(({importedName:e,localName:t})=>e===t?t:`${/^[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*$/u.test(e)?e:nb(e)} as ${t}`).join(`, `)} }`,r={mdxEditorImports:e};return{type:`mdxjsEsm`,value:`import ${n} from ${nb(t.source)}`,data:r}}function ib(e){return e.children instanceof Array}function ab({root:e,visitors:t,jsxComponentDescriptors:n,jsxIsAvailable:r,addImportStatements:i=!0}){let a=null,o=new Set,s=new Map;t=[...t].sort((e,t)=>(t.priority??0)-(e.priority??0)),d(e,null);function c(e,t){e!==null&&(Qy(t)||RegExp(`^(?!\\p{Ll})[\\p{ID_Start}_$][\\p{ID_Continue}$\\u200C\\u200D]*$`,`u`).test(e))&&(o.add(e),t&&s.set(e,{...t}))}function l(e,n){if(a===null)return a=n,a;if(!ib(e))throw Error(`Attempting to append children to a non-parent`);let r=e.children,i=r.at(-1);if(i){let e=t.find(e=>e.shouldJoin?.call(e,i,n));if(e){let t=e.join(i,n);return r.splice(r.length-1,1,t),t}}return r.push(n),n}function u(e,t){e.getChildren().forEach(e=>{d(e,t)})}function d(e,n,r=null){var i;let a=t.find((t,n)=>!r?.has(n)&&t.testLexicalNode?.call(t,e));if(!a)throw Error(`no lexical visitor found for ${e.getType()}`,{cause:e});(i=a.visitLexicalNode)==null||i.call(a,{lexicalNode:e,mdastParent:n,actions:{addAndStepInto(t,r={},i=!0){let a={type:t,...r,...i?{children:[]}:{}};l(n,a),z(e)&&i&&u(e,a)},appendToParent:l,visitChildren:u,visit:d,registerReferredComponent:c,nextVisitor(){d(e,n,(r??new Set).add(t.indexOf(a)))}}})}if(a===null)throw Error(`traversal ended with no root element`);let f=a,p=new Set,m=e=>{if(e.type===`mdxjsEsm`){for(let t of eb(e))p.add(t.localName);for(let t of tb(e))p.add(t)}`children`in e&&e.children.forEach(m)};if(m(f),i){let e=t=>{(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)&&t.name!==null&&((n.find(e=>e.name===t.name)??n.find(e=>e.name===`*`))?.source||Zy(t))&&c(t.name,Zy(t)),`children`in t&&t.children.forEach(e)};e(f)}let h=new Map;for(let e of o){let t=s.get(e),r=Qy(t),a=r!==void 0&&r.localName!==e.split(`.`)[0],o=a?void 0:t,c=a?void 0:r,l=c?.localName??e;if(p.has(l)||h.has(l)||!i&&(!o||c?.inherited))continue;if(c){h.set(l,c);continue}let u=n.find(t=>t.name===e)??o??n.find(e=>e.name===`*`);if(!u)throw Error(`Component ${e} is used but not imported`);u.source&&h.set(l,{source:u.source,defaultExport:u.defaultExport??!1,kind:u.defaultExport?`default`:`named`,importedName:u.defaultExport?`default`:l,localName:l})}let g=new Map,_=[];for(let e of h.values())if(e.kind===`named`){let t=g.get(e.source)??[];t.push(e),g.set(e.source,t)}else _.push(e);let v=[...Array.from(g.values(),rb),..._.map(e=>rb([e]))],y=f.children.find(e=>e.type===`yaml`);return y?f.children.splice(f.children.indexOf(y)+1,0,...v):f.children.unshift(...v),lb(f),pb(f,[]),ob(f),r||sb(f),f}function ob(e){if(`children`in e&&e.children.length>0){if(Ky(e)&&e.children.length===1){let t=e.children[0];t.type===`mdxJsxTextElement`&&t.name===`span`&&(t.attributes.forEach(t=>{if(t.type===`mdxJsxAttribute`){let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t.name);if(n){if(t.name===`className`){let e=new Set([...n.value.split(` `),...t.value.split(` `)]);n.value=Array.from(e).join(` `)}else t.name===`style`&&(n.value=Jy(n.value,t.value))}else e.attributes.push(t)}}),e.children=t.children)}e.children.forEach(e=>{ob(e)})}}function sb(e){if(Object.hasOwn(e,`children`)){let t=e,n=[];t.children.forEach(e=>{e.type===`mdxJsxTextElement`&&e.name===`u`?n.push({type:`html`,value:`<u>`},...e.children,{type:`html`,value:`</u>`}):(n.push(e),sb(e))}),t.children=n}}var cb=/\n(?:[^\S\n]*\n)+/;function lb(e){if(!(`children`in e))return;let t=[];for(let n of e.children)n.type===`paragraph`&&n.children.some(e=>e.type===`text`&&cb.test(e.value))?t.push(...ub(n)):(lb(n),t.push(n));e.children=t}function ub(e){let t=[{type:`paragraph`,children:[]}];for(let n of e.children)n.type===`text`?n.value.split(cb).forEach((e,n)=>{n>0&&t.push({type:`paragraph`,children:[]}),e&&t.at(-1).children.push({type:`text`,value:e})}):t.at(-1).children.push(n);let n=t.filter(e=>e.children.length>0);return n.length>0?n:[{type:`paragraph`,children:[]}]}var db=/\s+$/,fb=/^\s+/;function pb(e,t){if(e.type===`strong`||e.type===`emphasis`){let n=e.children.at(-1);if(n?.type===`text`){let r=db.exec(n.value);if(r){n.value=n.value.replace(db,``);let i=t.at(-1);i&&(i.children.splice(i.children.indexOf(e)+1,0,{type:`text`,value:r[0]}),pb(i,t.slice(0,-1)))}}let r=e.children.at(0);if(r?.type===`text`){let n=fb.exec(r.value);if(n){r.value=r.value.replace(fb,``);let i=t.at(-1);i&&(i.children.splice(i.children.indexOf(e),0,{type:`text`,value:n[0]}),pb(i,t.slice(0,-1)))}}}if(`children`in e&&e.children.length>0){let n=e;n.children.forEach(e=>{pb(e,[...t,n])})}}function mb({root:e,toMarkdownOptions:t,toMarkdownExtensions:n,visitors:r,jsxComponentDescriptors:i,jsxIsAvailable:a}){return wr(ab({root:e,visitors:r,jsxComponentDescriptors:i,jsxIsAvailable:a}),{extensions:n,...t})+`
35
+ `}var hb=class extends Error{constructor(e,t,n,r){let i=e.name??`Fragment`,a=e.type===`mdxJsxFlowElement`?`flow`:`text`,o=r?` ${r}`:``;super(`JSX component "${i}" was parsed as ${a} but is declared as ${t.kind} (kindMismatchPolicy: "${n}").${o}`),this.name=`JsxKindMismatchError`}},gb=new Set([`paragraph`,`heading`,`emphasis`,`strong`,`delete`,`link`,`linkReference`,`tableCell`,`footnote`,`mdxJsxTextElement`,`textDirective`,`leafDirective`]),_b=new Set([`root`,`blockquote`,`listItem`,`footnoteDefinition`,`mdxJsxFlowElement`,`containerDirective`]);function vb(e){return e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`}function yb(e,t){return t.find(t=>t.name===e.name)??t.find(e=>e.name===`*`)}function bb(e,t){return(e.type===`mdxJsxFlowElement`?`flow`:`text`)!==t.kind}function xb(e,t,n){if(vb(e)){let r=yb(e,t);if(r&&n(e)&&bb(e,r))throw new hb(e,r,`error`)}`children`in e&&e.children.forEach(e=>{xb(e,t,n)})}function Sb(e,t,n){let r=e=>n(e)?yb(e,t):void 0;function i(e){let t=gb.has(e.type)?`phrasing`:_b.has(e.type)?`flow`:`structural`;return e.children=t===`phrasing`?e.children.flatMap(t=>s(t,e.type)):t===`flow`?e.children.flatMap(e=>l(e)):e.children.map(t=>o(t,e.type)),e}function a(e){return`children`in e&&i(e),e}function o(e,t){if(vb(e)){let n=r(e);if(n&&bb(e,n))throw new hb(e,n,`normalize`,`The ${t} parent does not declare whether its children are flow or phrasing content.`)}return a(e)}function s(e,t){if(!vb(e))return[a(e)];let n=r(e);if(!n||!bb(e,n))return[a(e)];if(e.type===`mdxJsxTextElement`)throw new hb(e,n,`normalize`,`It cannot be lifted from ${t} without changing surrounding phrasing content.`);return[a(u(e,n))]}function c(e){let t=e.children.find(e=>e.type===`mdxJsxTextElement`&&r(e)?.kind===`flow`);if(!t)return[i(e)];let n=r(t);if(e.children.length!==1)throw new hb(t,n,`normalize`,`It has surrounding phrasing content, and normalization would need to split the paragraph.`);return[a({...t,type:`mdxJsxFlowElement`,children:t.children.length===0?[]:[{type:`paragraph`,children:t.children}]})]}function l(e){if(e.type===`paragraph`)return c(e);if(!vb(e))return[a(e)];let t=r(e);if(!t||!bb(e,t))return[a(e)];if(e.type===`mdxJsxTextElement`)throw new hb(e,t,`normalize`,`A text JSX node can be normalized to flow only when it is the sole child of a paragraph.`);return[{type:`paragraph`,children:[a(u(e,t))]}]}function u(e,t){if(e.children.length===0)return{...e,type:`mdxJsxTextElement`,children:[]};if(e.children.length!==1||e.children[0].type!==`paragraph`)throw new hb(e,t,`normalize`,`Its block children cannot be represented as one phrasing-content sequence without data loss.`);return{...e,type:`mdxJsxTextElement`,children:e.children[0].children}}return i(e)}function Cb(e,t,n,r=()=>!0){return n===`source`?e:n===`error`?(xb(e,t,r),e):Sb(structuredClone(e),t,r)}function wb(e){return qy.includes(e)}function Tb(e){return e.children instanceof Array}var Eb=[`paragraph`,`heading`,`tableCell`],Db=class extends Error{constructor(e,t){super(e),this.name=`MarkdownParseError`,this.cause=t}},Ob=class extends Error{constructor(e){super(e),this.name=`UnrecognizedMarkdownConstructError`}};function kb(e){let t=new Map;if(e.type!==`root`)return{importDeclarations:{}};for(let n of e.children)if(n.type===`mdxjsEsm`)for(let e of eb(n))t.set(e.localName,e);function n(e,r=!1){if((e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&e.name){let n=t.get(e.name.split(`.`)[0]);n&&(e.data=$y(e,{...n,inherited:r}).data)}if(`children`in e){let t=r||e.type===`containerDirective`||e.type===`textDirective`||e.type===`leafDirective`||e.type===`table`||(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&(e.name===null||!wb(e.name));e.children.forEach(e=>{n(e,t)})}}return n(e),{importDeclarations:Object.fromEntries(t.entries())}}function Ab({root:e,markdown:t,visitors:n,syntaxExtensions:r,mdastExtensions:i,...a}){let o;try{o=qt(t,{extensions:r,mdastExtensions:i})}catch(e){throw e instanceof Error?new Db(`Error parsing markdown: ${e.message}`,e):new Db(`Error parsing markdown: ${e}`,e)}o.children.length===0&&o.children.push({type:`paragraph`,children:[]}),o.children.at(-1)?.type!==`paragraph`&&o.children.push({type:`paragraph`,children:[]}),jb({root:e,mdastRoot:o,visitors:n,...a})}function jb({root:e,mdastRoot:t,visitors:n,...r}){n=n.sort((e,t)=>(t.priority??0)-(e.priority??0));function i(e,t=null){return n.find((n,i)=>t?.has(i)?!1:typeof n.testNode==`string`?n.testNode===e.type:n.testNode(e,r))}t=Cb(t,r.jsxComponentDescriptors,r.jsxKindMismatchPolicy??`source`,e=>i(e)?.jsxKindReconciliationOwner===!0);let a=new WeakMap,o=new WeakMap,s=kb(t);function c(e,t){if(!Tb(e))throw Error(`Attempting to visit children of a non-parent`);e.children.forEach(n=>{if(Tb(n)&&!Eb.includes(n.type)){let t=a.get(e);t!==void 0&&!a.has(n)&&a.set(n,t);let r=o.get(e);r!==void 0&&!o.has(n)&&o.set(n,r)}l(n,t,e)})}function l(e,t,u,d=null){let f=i(e,d);if(!f)try{throw new Ob(`Unsupported markdown syntax: ${wr(e)}`)}catch{throw new Ob(`Parsing of the following markdown structure failed: ${JSON.stringify({type:e.type,name:`name`in e?e.name:`N/A`})}`)}f.visitNode({mdastNode:e,lexicalParent:t,mdastParent:u,descriptors:r,metaData:s,actions:{visitChildren:c,nextVisitor(){l(e,t,u,(d??new Set).add(n.indexOf(f)))},addAndStepInto(n){t.append(n),Tb(e)&&c(e,n)},addFormatting(t,n){n||Tb(e)&&(n=e),n&&a.set(n,t|(a.get(u)??0))},removeFormatting(t,n){n||Tb(e)&&(n=e),n&&a.set(n,t^(a.get(u)??0))},getParentFormatting(){return a.get(u)??0},addStyle(t,n){n||Tb(e)&&(n=e),n&&o.set(n,t)},getParentStyle(){return o.get(u)??``}}})}l(t,e,null)}function Mb(){}var Nb=Object.defineProperty,Pb=(e,t,n)=>t in e?Nb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fb=(e,t,n)=>Pb(e,typeof t==`symbol`?t:t+``,n),Ib=`generic-html`,Lb=class e extends cu{constructor(e,t,n,r){super(r),Fb(this,`__tag`),Fb(this,`__nodeType`),Fb(this,`__attributes`),this.__tag=e,this.__nodeType=t,this.__attributes=n}static getType(){return Ib}static clone(t){return new e(t.__tag,t.__nodeType,t.__attributes,t.__key)}getTag(){return this.__tag}getNodeType(){return this.__nodeType}getAttributes(){return this.__attributes}updateAttributes(e){let t=this.getWritable();t.__attributes=e}getStyle(){return this.__attributes.find(e=>e.name===`style`)?.value}createDOM(){let e=this.__tag,t=document.createElement(e);return this.__attributes.forEach(e=>{t.setAttribute(e.name,e.value)}),t}updateDOM(){return!1}static importDOM(){return{}}exportDOM(e){let{element:t}=super.exportDOM(e);return{element:t}}static importJSON(e){let t=Rb(e.tag,e.mdxType,e.attributes);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),attributes:this.__attributes,mdxType:this.__nodeType,type:Ib,version:1}}extractWithChild(){return!0}isInline(){return this.__nodeType===`mdxJsxTextElement`}};function Rb(e,t,n){return qd(new Lb(e,t,n))}function zb(e){return e instanceof Lb}var Bb={testLexicalNode:zb,visitLexicalNode({actions:e,lexicalNode:t}){e.addAndStepInto(`mdxJsxTextElement`,{name:t.getTag(),type:t.getNodeType(),attributes:t.getAttributes()})},priority:-100},Vb={testLexicalNode:Su,visitLexicalNode:({mdastParent:e,actions:t})=>{t.appendToParent(e,{type:`text`,value:`
36
+ `})}},Hb={testLexicalNode:Ou,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`paragraph`)}},Ub={testLexicalNode:fu,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`root`)}};function Wb(e){return e.type===`text`}var Gb=[`u`,`span`,`sub`,`sup`];function Kb(e,t){return{format:e,isTag:!0,matches:e=>e.type===`mdxJsxTextElement`&&e.name===t&&e.attributes.length===0,create:()=>({type:`mdxJsxTextElement`,name:t,children:[],attributes:[]})}}function qb(e,t){return{format:e,isTag:!1,matches:e=>e.type===t,create:()=>({type:t,children:[]})}}var Jb=[Kb(8,`u`),Kb(64,`sup`),Kb(32,`sub`),qb(2,`emphasis`),qb(1,`strong`),qb(4,`delete`),qb(128,`highlight`)];function Yb(e,t){let n=e.getStyle(),r=0,i=e.getNextSibling();for(;F(i)&&i.getFormat()&t&&i.getStyle()===n;)r++,i=i.getNextSibling();return r}var Xb={shouldJoin:(e,t)=>{if([`text`,`emphasis`,`strong`,`highlight`].includes(e.type))return e.type===t.type;if(e.type===`mdxJsxTextElement`&&t.type===`mdxJsxTextElement`&&Gb.includes(t.name)){let n=t;return e.name===n.name&&JSON.stringify(e.attributes)===JSON.stringify(n.attributes)}return!1},join(e,t){return Wb(e)&&Wb(t)?{type:`text`,value:e.value+t.value}:{...e,children:[...e.children,...t.children]}},testLexicalNode:F,visitLexicalNode:({lexicalNode:e,mdastParent:t,actions:n})=>{let r=e.getTextContent(),i=e.getFormat(),a=e.getStyle(),o=t;a&&(o=n.appendToParent(o,{type:`mdxJsxTextElement`,name:`span`,children:[],attributes:[{type:`mdxJsxAttribute`,name:`style`,value:a}]}));let s=0;for(;;){let e=o.children.at(-1),t=e&&Jb.find(t=>i&t.format&&!(s&t.format)&&t.matches(e));if(!t)break;s|=t.format,o=e}let c=Jb.filter(e=>i&e.format&&!(s&e.format)).map(t=>({container:t,runLength:Yb(e,t.format)})).sort((e,t)=>Number(t.container.isTag)-Number(e.container.isTag)||t.runLength-e.runLength);for(let{container:e}of c)o=n.appendToParent(o,e.create());i&16?n.appendToParent(o,{type:`inlineCode`,value:r}):n.appendToParent(o,{type:`text`,value:r})}},Zb={testNode:`break`,visitNode:function({lexicalParent:e}){e.append(xu())}};function Qb(e,t){return[{testNode:t=>t.type===`mdxJsxTextElement`&&t.name===e,visitNode({actions:e,mdastNode:n,lexicalParent:r}){e.addFormatting(t),e.visitChildren(n,r)}},{testNode:t=>t.type===`html`&&t.value===`<${e}>`,visitNode({actions:e,mdastParent:n}){e.addFormatting(t,n)}},{testNode:t=>t.type===`html`&&t.value===`</${e}>`,visitNode({actions:e,mdastParent:n}){e.removeFormatting(t,n)}}]}var $b={testNode:`delete`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(4),t.visitChildren(e,n)}},ex={testNode:`highlight`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(128),t.visitChildren(e,n)}},tx={testNode:`inlineCode`,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(jc(e.value).setFormat(t.getParentFormatting()|16))}},nx=[{testNode:`emphasis`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(2),t.visitChildren(e,n)}},{testNode:`strong`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(1),t.visitChildren(e,n)}},...Qb(`u`,8),...Qb(`code`,16),tx,$b,ex,...Qb(`sup`,64),...Qb(`sub`,32)],rx={testNode:Ky,visitNode:function({mdastNode:e,actions:t,lexicalParent:n}){e.name===`span`&&e.attributes.length===1&&e.attributes[0].type===`mdxJsxAttribute`&&e.attributes[0].name===`style`?(t.addStyle(e.attributes[0].value,e),t.visitChildren(e,n)):t.addAndStepInto(Rb(e.name,e.type,e.attributes))},priority:-100},ix=[`listitem`,`admonition`],ax={testNode:`paragraph`,visitNode:function({mdastNode:e,mdastParent:t,lexicalParent:n,actions:r}){let i=n.getType();if(ix.includes(i)){let a=t?.children.indexOf(e)??-1,o=a>0?t?.children.at(a-1):void 0;i===`listitem`&&o?.type===`paragraph`&&n.append(xu(),xu()),r.visitChildren(e,n)}else r.addAndStepInto(V())}},ox={testNode:`root`,visitNode({actions:e,mdastNode:t,lexicalParent:n}){e.visitChildren(t,n)}},sx={testNode:`text`,visitNode({mdastNode:e,actions:t}){let n=jc(e.value);n.setFormat(t.getParentFormatting());let r=t.getParentStyle();r!==``&&n.setStyle(r),t.addAndStepInto(n)}},cx={dash:45,eof:null,exclamationMark:33,greaterThan:62},lx={data:`data`,lineEnding:`lineEnding`,linePrefix:`linePrefix`};function ux(e){return{canContainEols:[`comment`],enter:{comment(e){this.buffer()}},exit:{comment(e){this.resume()}}}}var dx=(e,t,n)=>{return r;function r(t){return e.enter(`comment`),e.consume(t),i}function i(t){return t===cx.exclamationMark?(e.consume(t),a):n(t)}function a(t){return t===cx.dash?(e.consume(t),o):n(t)}function o(t){return t===cx.dash?(e.consume(t),s):n(t)}function s(t){return t===cx.greaterThan?n(t):Rt(t)?u(t):(e.enter(lx.data),t===cx.dash?(e.consume(t),c):l(t))}function c(e){return e===cx.greaterThan?n(e):l(e)}function l(t){return t===cx.eof?n(t):t===cx.dash?(e.consume(t),f):Rt(t)?(e.exit(lx.data),u(t)):(e.consume(t),l)}function u(t){return e.enter(lx.lineEnding),e.consume(t),e.exit(lx.lineEnding),Gt(e,d,lx.linePrefix)}function d(t){return Rt(t)?u(t):(e.enter(lx.data),l(t))}function f(t){return t===cx.dash?(e.consume(t),p):l(t)}function p(n){return n===cx.greaterThan?(e.exit(lx.data),e.enter(`commentEnd`),e.consume(n),e.exit(`commentEnd`),e.exit(`comment`),t(n)):n===cx.dash?(e.consume(n),p):l(n)}},fx={flow:{60:{tokenize:dx,concrete:!0}},text:{60:{tokenize:dx}}},px={bold:`_bold_6j9u9_10`,italic:`_italic_6j9u9_14`,underline:`_underline_6j9u9_18`,strikethrough:`_strikethrough_6j9u9_34`,underlineStrikethrough:`_underlineStrikethrough_6j9u9_38`,subscript:`_subscript_6j9u9_42`,superscript:`_superscript_6j9u9_47`,code:`_code_6j9u9_52`,quote:`_quote_6j9u9_59`,nestedListItem:`_nestedListItem_6j9u9_66`,listitem:`_listitem_6j9u9_76`,listItemChecked:`_listItemChecked_6j9u9_80`,listItemUnchecked:`_listItemUnchecked_6j9u9_81`,admonitionDanger:`_admonitionDanger_6j9u9_158`,admonitionInfo:`_admonitionInfo_6j9u9_159`,admonitionNote:`_admonitionNote_6j9u9_160`,admonitionTip:`_admonitionTip_6j9u9_161`,admonitionCaution:`_admonitionCaution_6j9u9_162`,mdxExpression:`_mdxExpression_6j9u9_195`},mx={quote:px.quote,text:{bold:px.bold,italic:px.italic,underline:px.underline,code:px.code,strikethrough:px.strikethrough,subscript:px.subscript,superscript:px.superscript,underlineStrikethrough:px.underlineStrikethrough},list:{listitem:px.listitem,listitemChecked:px.listItemChecked,listitemUnchecked:px.listItemUnchecked,nested:{listitem:px.nestedListItem}},admonition:{danger:px.admonitionDanger,info:px.admonitionInfo,note:px.admonitionNote,tip:px.admonitionTip,caution:px.admonitionCaution}},hx=(0,k.createContext)(null);function gx(){let e=(0,k.useContext)(hx);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function _x(){return U().getTextContent()}function vx(e,t=!0){if(e)return!1;let n=_x();return t&&(n=n.trim()),n===``}function yx(e){if(!vx(e,!1))return!1;let t=U().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(B(n))return!1;if(z(n)){if(!Ou(n)||n.__indent!==0)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++){let n=t[e];if(!F(n))return!1}}}return!0}function bx(e){return()=>yx(e)}var xx=si?k.useLayoutEffect:k.useEffect;function Sx({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g=`textbox`,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,k.useState)(e.isEditable()),T=(0,k.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,k.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(S,T),[T,S]);return xx(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]),(0,A.jsx)(`div`,{"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":C&&g===`combobox`?!!o:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:g,spellCheck:_,style:v,tabIndex:y??(C?void 0:-1),...x})}var Cx=(0,k.forwardRef)(Sx);function wx(e){return e.read(`latest`,bx(e.isComposing()))}var Tx=(0,k.forwardRef)(Ex);function Ex(e,t){let{placeholder:n,...r}=e,[i]=gx();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Cx,{editor:i,...r,ref:t}),n!=null&&(0,A.jsx)(Dx,{editor:i,content:n})]})}function Dx({content:e,editor:t}){let n=function(e){let[t,n]=(0,k.useState)(()=>wx(e));return xx(()=>{function t(){let t=wx(e);n(t)}return t(),xm(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,k.useState)(t.isEditable());if((0,k.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,A.jsx)(`div`,{"aria-hidden":!0,children:a})}var Ox=class extends k.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){this.props.onError(e instanceof Error?e:Error(String(e),{cause:e}),t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function kx({children:e,fallback:t,onError:n}){return(0,A.jsx)(Ox,{fallback:t===void 0?(0,A.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}):t,onError:n,children:e})}var Ax=pm({name:`@lexical/react/ReactProvider`}),jx=e(i(),1);function Mx(e,t){let[n]=t,r=e.decorators.map(e=>typeof e==`function`?(0,A.jsx)(e,{context:t}):e);return function(i){let{EditorChildrenComponent:a=e.EditorChildrenComponent,ErrorBoundary:o=e.ErrorBoundary,contentEditable:s=e.contentEditable,children:c}=i,l=function(e,t){let[n,r]=(0,k.useMemo)(()=>[t=>e.registerDecoratorListener(t),()=>e.getDecorators()],[e]),i=(0,k.useSyncExternalStore)(n,r,r);return(0,k.useMemo)(()=>{let n=[];for(let r in i){let a=e.getElementByKey(r);if(a!==null){let o=(0,A.jsx)(t,{onError:t=>{e._onError(t)},children:(0,A.jsx)(k.Suspense,{fallback:null,children:i[r]})});n.push((0,jx.createPortal)(o,a,r))}}return n},[t,i,e])}(n,o),u=(0,k.useMemo)(()=>r.map((e,t)=>(0,A.jsx)(o,{onError:e=>{n._onError(e)},children:(0,A.jsx)(k.Suspense,{fallback:null,children:e})},t)),[o]);return(0,A.jsx)(hx.Provider,{value:t,children:(0,A.jsxs)(a,{context:t,contentEditable:s,children:[c,u,l]})})}}function Nx({contentEditable:e,children:t}){return(0,A.jsxs)(A.Fragment,{children:[e,t]})}var Px=pm({build(e,t,n){n.getPeer(Ax.name)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...n.getDirectDependentNames()].join(` `));let r=[e,{getTheme:()=>e._config.theme}];return{Component:Mx(t,r),context:r}},config:{EditorChildrenComponent:Nx,ErrorBoundary:kx,contentEditable:(0,A.jsx)(Tx,{}),decorators:[]},mergeConfig(e,t){let n=_m(e,t);return t.decorators&&(n.decorators=t.decorators.length>0?[...e.decorators,...t.decorators]:e.decorators),n},name:`@lexical/react/React`,peerDependencies:[hm(Ax.name)]}),Fx=new WeakSet,Ix=new WeakMap,Lx=new Set([du,Sc,yu,Nc,Eu]),Rx=new WeakMap;function zx(e){return mm(ug,{createInitialHistoryState:()=>e,disabled:!1})}function Bx({name:e,namespace:t,nodes:n,theme:r,editable:i=!0,parentEditor:a,historyMode:o,historyState:s,initialEditorState:c,onError:l=e=>{throw e}}){let u=[Ax,mm(Px,{contentEditable:null}),mm(Bh,{setOptions:{tag:ic},updateOptions:{tag:ic}})];if(a&&u.push(mm(ng,{$getParentEditor:()=>a,inheritEditableFromParent:!0})),o===`nested-shared`)u.push(dg);else if(o===`root-shared`||o===`nested-external`){if(!s)throw Error(`${o} requires a historyState`);u.push(zx(s))}else o===`table-local`&&u.push(mm(ug,{disabled:!1}));let d=Hh(pm({name:e,namespace:t,nodes:n?.filter(e=>!Lx.has(e)),theme:r,editable:i,$initialEditorState:c,onError:l,dependencies:u})),f=Yh(d,ug.name)?.output.historyState.value;f&&Ix.set(d,f),f&&(Rx.has(f)||Rx.set(f,f.current));let p=f?d.registerUpdateListener(({dirtyElements:e,dirtyLeaves:t,tags:n})=>{let r=f.current;if(n.has(`historic`)||e.size>0||t.size>0){Rx.set(f,r);return}let i=Rx.get(f);r?.editor===d&&i&&i.editor!==d&&(f.undoStack.push({...i}),f.redoStack=[],d.dispatchCommand(_s,!0),d.dispatchCommand(gs,!1)),Rx.set(f,r)}):()=>void 0,m=new Set,h=f?d.registerCommand(vs,()=>{let e=setTimeout(()=>{m.delete(e),d.dispatchCommand(_s,f.undoStack.length>0),d.dispatchCommand(gs,f.redoStack.length>0)});return m.add(e),!1},1):()=>void 0,g=d.dispose.bind(d),_=!1;return d.dispose=()=>{_||(_=!0,m.forEach(clearTimeout),m.clear(),h(),p(),g())},o===`root-shared`&&Fx.add(d),d}function Vx(e){return Fx.has(e)}var Hx=P(`NESTED_EDITOR_UPDATED_COMMAND`),Ux=j(null),Wx=j(null),Gx=j(``),Kx=j(!0),qx=j(!1,e=>{e.sub(e.pipe(qx,Zr(Ux)),([e,t])=>{t?.setEditable(!e)})}),Jx=j(``),Yx=j(!1),Xx=j(!1),Zx=j(0),Qx=j(null),$x=Ur(e=>{e.link(e.pipe(Qx,$r(e=>e!==null)),$x)}),eS=Ur(e=>{e.sub(e.pipe(eS,Zr(Wx)),([e,t])=>{t?.dispatchCommand(Bo,e)})}),tS=j(null,e=>{e.sub(e.pipe(tS,Zr(Wx)),([t,n])=>{if(!t||!n)return;let r=t.anchor.getNode(),i=r.getKey()===`root`?r:Kf(r,e=>{let t=e.getParent();return t!==null&&Gd(t)});i??=r.getTopLevelElementOrThrow();let a=i.getKey();if(n.getElementByKey(a)!==null){let t=Y_(i)?i.getTag():i.getType();e.pub(nC,t)}})}),nS=j(``),rS=j(``),iS=j(!1),aS=Ur(e=>{e.link(rS,aS),e.sub(nS,t=>{e.pubIn({[iS]:!0,[rS]:t})})}),oS=Ur(e=>{e.link(e.pipe(aS,Zr(kS),$r(([,e])=>!e),Xr(([e])=>e)),oS)},!0),sS=j([]),cS=j([]),lS=j([]),uS=j([]),dS=j([]),fS=j([]),pS=j({}),mS=j(!1),hS=j([]),gS=j(`source`),_S=j([]),vS=j([]),yS=j(``),bS=j(null),xS=j(null),SS=j(null),CS=BS(cS),wS=BS(sS),TS=BS(lS),ES=BS(uS),DS=BS(dS),OS=BS(fS),kS=j(!1),AS=Ur(e=>{e.sub(e.pipe(AS,Zr(rS,Ux,Xx)),([t,n,r,i])=>{if(e.getValue(oC)!==`rich-text`){if(t!==e.getValue(sC)){let n=e.getValue(kS);e.pub(kS,!0);try{e.pub(sC,t)}finally{e.pub(kS,n)}}}else t.trim()!==n.trim()&&(e.pub(kS,!0),r?.update(()=>{U().clear(),WS(e,U(),t),i?r.focus():fd(null)},{onUpdate:()=>{e.pub(kS,!1)}}))})}),jS=j(null),MS=Ur(e=>{e.sub(e.pipe(MS,Zr(Wx,Xx)),([t,n,r])=>{e.getValue(jS)?.(t)||n?.update(()=>{let i=R();if(i!==null){let n={children:[],append(e){this.children.push(e)},getType(){return i.getNodes()[0].getType()}};WS(e,n,t),Sl(n.children)}r?n.focus():fd(null)})})});function NS(){return ei((e,[t,n])=>(e.forEach(e=>{if(!e)throw Error(`You have a subscription that does not return a teardown`);e()}),n?t.map(e=>e(n)):[]),[])}var PS=j(null),FS=j([],e=>{e.pipe(e.combine(FS,Wx),NS())}),IS=j([],e=>{e.pipe(e.combine(IS,Ux),NS())}),LS=j(null,Mb,(e,t)=>!!(e&&t&&e.editorRef===t.editorRef)),RS=Ur(),zS=j(e=>{throw Error(`No icon component for ${e}`)});function BS(e,t){return Ur((n,r)=>{n.changeWith(e,r,(e,t)=>{Array.isArray(t)||(t=[t]);let n=e;for(let r of t)e.includes(r)||(n=[...n,r]);return n}),t?.(n,r)})}function VS(e){let t=R();I(t)&&e.pubIn({[tS]:t,[Zx]:t.format})}var HS=BS(IS,(e,t)=>{e.pub(t,[t=>t.registerCommand(To,(t,n)=>(e.pubIn({[Wx]:n,[Xx]:!0}),n._parentEditor===null&&n.getEditorState().read(()=>{e.pub(LS,{rootNode:U(),editorType:`lexical`,editorRef:n})}),VS(e),!1),4),t=>t.registerUpdateListener(({dirtyElements:n,dirtyLeaves:r,editorState:i})=>{if(e.getValue(Qx)!==null||n.size===0&&r.size===0)return;let a;i.read(()=>{U().getLastChild()instanceof uu&&t.update(()=>{U().append(V())},{discrete:!0}),a=mb({root:U(),visitors:e.getValue(dS),jsxComponentDescriptors:e.getValue(hS),toMarkdownExtensions:e.getValue(fS),toMarkdownOptions:e.getValue(pS),jsxIsAvailable:e.getValue(mS)})}),e.pub(rS,a.trim()),e.pub(iS,!1)}),t=>t.registerCommand(vs,()=>(e.pub(Xx,!0),!1),4)])}),US=BS(FS,(e,t)=>{e.pub(t,[t=>t.registerUpdateListener(({editorState:t})=>{t.read(()=>{VS(e)})}),t=>t.registerCommand(ys,t=>{let n=e.getValue(Ux);return n&&(n.getRootElement()?.contains(t.relatedTarget)||e.pubIn({[Xx]:!1,[RS]:t})),!1},4)])});function WS(e,t,n){try{Ab({root:t,visitors:e.getValue(sS),mdastExtensions:e.getValue(uS),markdown:n,syntaxExtensions:e.getValue(lS),jsxComponentDescriptors:e.getValue(hS),jsxKindMismatchPolicy:e.getValue(gS),directiveDescriptors:e.getValue(_S),codeBlockEditorDescriptors:e.getValue(vS),defaultCodeBlockLanguage:e.getValue(yS)}),e.pub(Qx,null)}catch(t){if(t instanceof Db||t instanceof Ob||t instanceof hb)e.pubIn({[rS]:n,[Qx]:{error:t.message,source:n}});else throw t}}var GS=j([]),KS=BS(GS),qS=j([]);BS(qS);var JS=j([]);BS(JS);var YS=j([]);BS(YS);var XS=j([]),ZS=BS(XS),QS=j([]),$S=BS(QS),eC=j(!1,e=>{e.link(e.pipe(Wx,Xr(e=>[`td`,`th`].includes((e?.getRootElement()?.parentNode)?.nodeName.toLowerCase()??``))),eC)}),tC=j(lg()),nC=j(``);Ur();var rC=Ur(e=>{e.sub(e.pipe(rC,Zr(Wx)),([e,t])=>{t?.update(()=>{let n=R();I(n)&&(km(n,e),setTimeout(()=>{t.focus()}))})})});function iC(e){if(e.isInline()){Sl([e]),Gd(e.getParentOrThrow())&&Vm(e,V).selectEnd();return}let t=R();if(I(t)){let n=Kf(t.focus.getNode(),K);if(K(n)){let r=Yp(t.focus,`next`);for(;r!==null&&(Tp(r)||!n.is(r.getParentAtCaret()));)r=dm(r);if(r!==null){r.insert(e);return}}}Bm(e)}var aC=Ur(e=>{e.sub(e.pipe(aC,Zr(Wx)),([e,t])=>{t?.focus(()=>{t.getEditorState().read(()=>{I(R())&&(t.update(()=>{let t=e();iC(t),setTimeout(()=>{`select`in t&&typeof t.select==`function`&&t.select()})}),setTimeout(()=>{t.dispatchCommand(Hx,void 0)}))})},{defaultSelection:`rootEnd`})})}),oC=j(`rich-text`,e=>{function t(){return ei((e,t)=>({current:e.next,next:t}),{current:`rich-text`,next:`rich-text`})}e.sub(e.pipe(oC,t(),Zr(sC)),([{current:t,next:n},r])=>{(t===`source`||t===`diff`)&&n===`rich-text`&&e.pub(AS,r)}),e.sub(e.pipe(oC,t(),$r(e=>e.current===`rich-text`),Zr(Wx)),([,e])=>{e?.dispatchCommand(Hx,void 0)})}),sC=j(``,e=>{e.link(rS,sC),e.link(sC,aS)},!0),cC=j([]),lC=BS(cC),uC=j(()=>{throw Error(`No translation function provided`)}),dC=j(mx),fC=ii({init(e,t){let n=t?.initialMarkdown??``;e.register(HS),e.register(US),e.register(aS),e.register(sC),e.pubIn({[nS]:t?.trim?n.trim():n,[zS]:t?.iconComponentFor,[wS]:[ox,ax,sx,Zb,...nx],[CS]:[Eu,Sc,Lb],[DS]:[Ub,Hb,Xb,Vb,Bb],[Gx]:t?.contentEditableClassName,[Kx]:t?.spellCheck,[pS]:t?.toMarkdownOptions,[Yx]:t?.autoFocus,[Jx]:t?.placeholder,[qx]:t?.readOnly,[uC]:t?.translation,[tC]:lg(),[ES]:[qv(),ty],[TS]:[Gv(),Wy()],[OS]:[Pt(),Jv(),iy],[dC]:t?.lexicalTheme??mx}),e.singletonSub($x,t?.onError),e.singletonSub(oS,n=>{t?.onChange(n,e.getValue(iS))}),e.singletonSub(RS,t?.onBlur),t?.suppressHtmlProcessing||e.pubIn({[ES]:[It(),ux()],[TS]:[Vt(),Jt(),fx],[wS]:rx})},postInit(e,t){let n=Bx({name:`@mdxeditor/root`,editable:t?.readOnly!==!0,namespace:t?.lexicalEditorNamespace??`MDXEditor`,nodes:[...e.getValue(cS),...t?.additionalLexicalNodes??[]],theme:e.getValue(dC),historyMode:t?.suppressSharedHistory?`none`:`root-shared`,historyState:e.getValue(tC),initialEditorState:t?.editorState===null?null:()=>{let n=t?.initialMarkdown.trim()??``;WS(e,U(),n)}});ni(e,()=>{n.dispose()});let r=t?.autoFocus;if(t?.editorState!==null&&r){let t=setTimeout(()=>{n.focus(Mb,{defaultSelection:r===!0?`rootStart`:r.defaultSelection??`rootStart`})});ni(e,()=>{clearTimeout(t)})}e.pub(Ux,n),e.pub(Wx,n)},update(e,t){e.pubIn({[Gx]:t?.contentEditableClassName,[Kx]:t?.spellCheck,[pS]:t?.toMarkdownOptions,[Yx]:t?.autoFocus,[Jx]:t?.placeholder,[qx]:t?.readOnly}),e.singletonSub(oS,n=>{t?.onChange(n,e.getValue(iS))}),e.singletonSub(RS,t?.onBlur),e.singletonSub($x,t?.onError)}});function pC(){return qr(uC)}function mC({initialEditor:e,children:t}){let{Component:n}=Jh(e,Px).output;return(0,A.jsx)(n,{children:t})}var hC=si?k.useLayoutEffect:k.useEffect;function gC(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function _C(){return function(e){let[t]=gx(),n=(0,k.useMemo)(()=>e(t),[t,e]),[r,i]=(0,k.useState)(()=>n.initialValueFn()),a=(0,k.useRef)(r);return hC(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}(gC)}function vC(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var yC=si?k.useLayoutEffect:k.useEffect;function bC({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,k.useState)(()=>e.getDecorators());return yC(()=>e.registerDecoratorListener(e=>{(0,jx.flushSync)(()=>{r(e)})}),[e]),(0,k.useEffect)(()=>{r(e.getDecorators())},[e]),(0,k.useMemo)(()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,A.jsx)(t,{onError:t=>e._onError(t),children:(0,A.jsx)(k.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,jx.createPortal)(s,c,o))}return r},[t,n,e])}(e,t)}function xC({editor:e,ErrorBoundary:t}){return function(e){let t=qh.maybeFromEditor(e);if(t&&t.hasExtensionByName(Ax.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&vC(320,e);return!0}return!1}(e)?null:(0,A.jsx)(bC,{editor:e,ErrorBoundary:t})}function SC(e){return e.read(`latest`,bx(e.isComposing()))}function CC({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=gx();return function(e){yC(()=>xm(sv(e),L_(e)),[e])}(r),(0,A.jsxs)(A.Fragment,{children:[e,(0,A.jsx)(wC,{content:t}),(0,A.jsx)(xC,{editor:r,ErrorBoundary:n})]})}function wC({content:e}){let[t]=gx(),n=function(e){let[t,n]=(0,k.useState)(()=>SC(e));return yC(()=>{function t(){let t=SC(e);n(t)}return t(),xm(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=_C();return n?typeof e==`function`?e(r):e:null}var TC=t(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()})),EC={undo:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M7.202 18.5V17H14.3788C15.4224 17 16.3205 16.6554 17.073 15.9663C17.8257 15.2773 18.202 14.4263 18.202 13.4135C18.202 12.4007 17.8257 11.5512 17.073 10.8652C16.3205 10.1794 15.4224 9.8365 14.3788 9.8365H7.35775L10.1402 12.6193L9.0865 13.673L4.5 9.0865L9.0865 4.5L10.1402 5.55375L7.35775 8.3365H14.3788C15.8416 8.3365 17.0945 8.82467 18.1375 9.801C19.1805 10.7773 19.702 11.9815 19.702 13.4135C19.702 14.8455 19.1805 16.0513 18.1375 17.0308C17.0945 18.0103 15.8416 18.5 14.3788 18.5H7.202Z`,fill:`currentColor`})),redo:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M9.6211 18.5C8.15827 18.5 6.90535 18.0103 5.86235 17.0308C4.81935 16.0513 4.29785 14.8455 4.29785 13.4135C4.29785 11.9815 4.81935 10.7773 5.86235 9.801C6.90535 8.82467 8.15827 8.3365 9.6211 8.3365H16.6421L13.8596 5.55375L14.9134 4.5L19.4999 9.0865L14.9134 13.673L13.8596 12.6193L16.6421 9.8365H9.6211C8.57744 9.8365 7.67935 10.1794 6.92685 10.8652C6.17418 11.5512 5.79785 12.4007 5.79785 13.4135C5.79785 14.4263 6.17418 15.2773 6.92685 15.9663C7.67935 16.6554 8.57744 17 9.6211 17H16.7979V18.5H9.6211Z`,fill:`currentColor`})),format_bold:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M7.33838 18.625V5.375H12.1999C13.219 5.375 14.1405 5.69233 14.9644 6.327C15.788 6.9615 16.1999 7.816 16.1999 8.8905C16.1999 9.63783 16.0194 10.2471 15.6584 10.7182C15.2975 11.1894 14.9088 11.5314 14.4921 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3158 16.6614 14.0193 16.6614 14.9038C16.6614 16.1819 16.1902 17.1217 15.2479 17.723C14.3055 18.3243 13.3562 18.625 12.3999 18.625H7.33838ZM9.48838 16.6328H12.3191C13.1063 16.6328 13.6627 16.4142 13.9884 15.977C14.314 15.5398 14.4769 15.1206 14.4769 14.7192C14.4769 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8058 12.2729 12.8058H9.48838V16.6328ZM9.48838 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5279 10.3538C13.8835 10.0064 14.0614 9.59042 14.0614 9.10575C14.0614 8.59042 13.8733 8.16925 13.4971 7.84225C13.1208 7.51542 12.6595 7.352 12.1134 7.352H9.48838V10.875Z`,fill:`currentColor`})),format_italic:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.39404 18.625V16.8173H9.21129L12.4518 7.18275H8.63454V5.375H17.7883V7.18275H14.2785L11.0383 16.8173H14.5478V18.625H5.39404Z`,fill:`currentColor`})),format_underlined:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.34619 22.125V20.625H18.6537V22.125H5.34619ZM11.9999 18.5287C10.4448 18.5287 9.23102 18.0566 8.35869 17.1125C7.48619 16.1683 7.04994 14.9032 7.04994 13.3172V5.41345H8.90369V13.4095C8.90369 14.4198 9.17228 15.2295 9.70944 15.8385C10.2466 16.4475 11.0101 16.752 11.9999 16.752C12.9898 16.752 13.7533 16.4475 14.2904 15.8385C14.8276 15.2295 15.0962 14.4198 15.0962 13.4095V5.41345H16.9499V13.3172C16.9499 14.9032 16.5137 16.1683 15.6412 17.1125C14.7689 18.0566 13.5551 18.5287 11.9999 18.5287Z`,fill:`currentColor`})),format_highlight:k.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`},k.createElement(`path`,{d:`m9 11-6 6v3h9l3-3`}),k.createElement(`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`})),code:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M7.99994 17.6537L2.34619 11.9999L7.99994 6.34619L9.06919 7.41544L4.46919 12.0154L9.05369 16.5999L7.99994 17.6537ZM15.9999 17.6537L14.9307 16.5844L19.5307 11.9844L14.9462 7.39994L15.9999 6.34619L21.6537 11.9999L15.9999 17.6537Z`,fill:`currentColor`})),strikeThrough:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M12.15 19.6923C10.9732 19.6923 9.9315 19.359 9.025 18.6923C8.11867 18.0256 7.45525 17.1128 7.03475 15.9538L8.6385 15.2635C8.91667 16.0444 9.3545 16.6867 9.952 17.1905C10.5493 17.6944 11.2923 17.9463 12.1808 17.9463C12.9578 17.9463 13.6744 17.7508 14.3307 17.3598C14.9872 16.9686 15.3155 16.3487 15.3155 15.5C15.3155 15.123 15.2555 14.7968 15.1355 14.5213C15.0157 14.2456 14.8462 13.9885 14.627 13.75H16.677C16.7987 13.9705 16.8932 14.2256 16.9605 14.5153C17.0278 14.8051 17.0615 15.1334 17.0615 15.5C17.0615 16.8372 16.5747 17.8702 15.601 18.599C14.6272 19.3279 13.4768 19.6923 12.15 19.6923ZM2.25 11.75V10.25H21.75V11.75H2.25ZM12.05 4.19629C13.0475 4.19629 13.9123 4.42704 14.6443 4.88854C15.3763 5.35004 15.9673 6.05896 16.4173 7.01529L14.823 7.73079C14.6218 7.26029 14.2978 6.84462 13.851 6.48379C13.4042 6.12279 12.8141 5.94229 12.0808 5.94229C11.2244 5.94229 10.5392 6.16221 10.025 6.60204C9.51083 7.04171 9.264 7.59104 9.2845 8.25004H7.5385C7.50133 7.16421 7.89783 6.21712 8.728 5.40879C9.558 4.60046 10.6653 4.19629 12.05 4.19629Z`,fill:`currentColor`})),superscript:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M16.6924 8V6.2115C16.6924 5.95383 16.7786 5.73875 16.9511 5.56625C17.1235 5.39392 17.3385 5.30775 17.5961 5.30775H19.5001V4.38475H16.6924V3.5H19.4809C19.7385 3.5 19.9536 3.58625 20.1261 3.75875C20.2985 3.93108 20.3846 4.14617 20.3846 4.404V5.2885C20.3846 5.54617 20.2985 5.76125 20.1261 5.93375C19.9536 6.10608 19.7385 6.19225 19.4809 6.19225H17.5771V7.1155H20.3846V8H16.6924ZM4.44238 18.5L8.84638 11.6287L4.77713 5.30775H6.74438L9.95963 10.404H10.0214L13.2501 5.30775H15.2329L11.1194 11.6287L15.5579 18.5H13.5751L10.0214 12.9308H9.95963L6.42513 18.5H4.44238Z`,fill:`currentColor`})),subscript:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M16.6924 20.5V18.7115C16.6924 18.4538 16.7786 18.2387 16.9511 18.0662C17.1235 17.8939 17.3385 17.8077 17.5961 17.8077H19.5001V16.8845H16.6924V16H19.4809C19.7385 16 19.9536 16.0863 20.1261 16.2587C20.2985 16.4311 20.3846 16.6461 20.3846 16.9038V17.7885C20.3846 18.0462 20.2985 18.2612 20.1261 18.4337C19.9536 18.6061 19.7385 18.6923 19.4809 18.6923H17.5771V19.6152H20.3846V20.5H16.6924ZM4.44238 18.6923L8.84638 11.8212L4.77713 5.5H6.74438L9.95963 10.5962H10.0214L13.2501 5.5H15.2329L11.1194 11.8212L15.5579 18.6923H13.5751L10.0214 13.123H9.95963L6.42513 18.6923H4.44238Z`,fill:`currentColor`})),format_list_bulleted:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M9.30775 18.75V17.25H20.5V18.75H9.30775ZM9.30775 12.75V11.25H20.5V12.75H9.30775ZM9.30775 6.75005V5.25005H20.5V6.75005H9.30775ZM5.1635 19.6635C4.706 19.6635 4.31442 19.5006 3.98875 19.1748C3.66292 18.8491 3.5 18.4575 3.5 18C3.5 17.5425 3.66292 17.151 3.98875 16.8253C4.31442 16.4995 4.706 16.3365 5.1635 16.3365C5.621 16.3365 6.01258 16.4995 6.33825 16.8253C6.66408 17.151 6.827 17.5425 6.827 18C6.827 18.4575 6.66408 18.8491 6.33825 19.1748C6.01258 19.5006 5.621 19.6635 5.1635 19.6635ZM5.1635 13.6635C4.706 13.6635 4.31442 13.5006 3.98875 13.1748C3.66292 12.8491 3.5 12.4575 3.5 12C3.5 11.5425 3.66292 11.151 3.98875 10.8253C4.31442 10.4995 4.706 10.3365 5.1635 10.3365C5.621 10.3365 6.01258 10.4995 6.33825 10.8253C6.66408 11.151 6.827 11.5425 6.827 12C6.827 12.4575 6.66408 12.8491 6.33825 13.1748C6.01258 13.5006 5.621 13.6635 5.1635 13.6635ZM5.1635 7.66355C4.706 7.66355 4.31442 7.50063 3.98875 7.1748C3.66292 6.84913 3.5 6.45755 3.5 6.00005C3.5 5.54255 3.66292 5.15096 3.98875 4.8253C4.31442 4.49946 4.706 4.33655 5.1635 4.33655C5.621 4.33655 6.01258 4.49946 6.33825 4.8253C6.66408 5.15096 6.827 5.54255 6.827 6.00005C6.827 6.45755 6.66408 6.84913 6.33825 7.1748C6.01258 7.50063 5.621 7.66355 5.1635 7.66355Z`,fill:`currentColor`})),format_list_numbered:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M3.5 21.5V20.3078H6V19.25H4.5V18.0577H6V17H3.5V15.8077H6.34625C6.58592 15.8077 6.78683 15.8888 6.949 16.051C7.11117 16.2132 7.19225 16.4141 7.19225 16.6538V17.8462C7.19225 18.0859 7.11117 18.2868 6.949 18.449C6.78683 18.6112 6.58592 18.6923 6.34625 18.6923C6.58592 18.6923 6.78683 18.7733 6.949 18.9355C7.11117 19.0977 7.19225 19.2987 7.19225 19.5385V20.6538C7.19225 20.8936 7.11117 21.0946 6.949 21.2568C6.78683 21.4189 6.58592 21.5 6.34625 21.5H3.5ZM3.5 14.8463V12.25C3.5 12.0103 3.58108 11.8093 3.74325 11.647C3.90542 11.4848 4.10642 11.4038 4.34625 11.4038H6V10.3462H3.5V9.15375H6.34625C6.58592 9.15375 6.78683 9.23483 6.949 9.397C7.11117 9.55933 7.19225 9.76033 7.19225 10V11.75C7.19225 11.9897 7.11117 12.1907 6.949 12.353C6.78683 12.5152 6.58592 12.5963 6.34625 12.5963H4.69225V13.6538H7.19225V14.8463H3.5ZM5 8.19225V3.69225H3.5V2.5H6.19225V8.19225H5ZM9.30775 18.75V17.25H20.5V18.75H9.30775ZM9.30775 12.75V11.25H20.5V12.75H9.30775ZM9.30775 6.75V5.25H20.5V6.75H9.30775Z`,fill:`currentColor`})),format_list_checked:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.69425 18.452L2.5 15.2578L3.54425 14.2135L5.66925 16.3385L9.91925 12.0885L10.9635 13.1578L5.69425 18.452ZM5.69425 10.8365L2.5 7.64227L3.54425 6.59802L5.66925 8.72302L9.91925 4.47302L10.9635 5.54227L5.69425 10.8365ZM13.0095 16.5578V15.0578H21.5095V16.5578H13.0095ZM13.0095 8.94227V7.44227H21.5095V8.94227H13.0095Z`,fill:`currentColor`})),link:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M10.8077 16.5385H7.0385C5.78283 16.5385 4.7125 16.096 3.8275 15.211C2.9425 14.3262 2.5 13.256 2.5 12.0005C2.5 10.745 2.9425 9.67471 3.8275 8.78955C4.7125 7.90421 5.78283 7.46155 7.0385 7.46155H10.8077V8.96155H7.0385C6.19867 8.96155 5.48233 9.25805 4.8895 9.85105C4.2965 10.444 4 11.1604 4 12C4 12.8397 4.2965 13.556 4.8895 14.149C5.48233 14.742 6.19867 15.0385 7.0385 15.0385H10.8077V16.5385ZM8.25 12.75V11.25H15.75V12.75H8.25ZM13.1923 16.5385V15.0385H16.9615C17.8013 15.0385 18.5177 14.742 19.1105 14.149C19.7035 13.556 20 12.8397 20 12C20 11.1604 19.7035 10.444 19.1105 9.85105C18.5177 9.25805 17.8013 8.96155 16.9615 8.96155H13.1923V7.46155H16.9615C18.2172 7.46155 19.2875 7.90405 20.1725 8.78905C21.0575 9.67388 21.5 10.744 21.5 11.9995C21.5 13.255 21.0575 14.3254 20.1725 15.2105C19.2875 16.0959 18.2172 16.5385 16.9615 16.5385H13.1923Z`,fill:`currentColor`})),add_photo:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.11537 20.5C4.6182 20.5 4.19262 20.323 3.83862 19.969C3.48462 19.615 3.30762 19.1894 3.30762 18.6922V5.30773C3.30762 4.81056 3.48462 4.38498 3.83862 4.03098C4.19262 3.67698 4.6182 3.49998 5.11537 3.49998H13.8076V4.99998H5.11537C5.02553 4.99998 4.95178 5.02881 4.89412 5.08648C4.83645 5.14415 4.80762 5.2179 4.80762 5.30773V18.6922C4.80762 18.7821 4.83645 18.8558 4.89412 18.9135C4.95178 18.9711 5.02553 19 5.11537 19H18.4999C18.5895 19 18.6633 18.9711 18.7211 18.9135C18.7788 18.8558 18.8076 18.7821 18.8076 18.6922V9.99998H20.3076V18.6922C20.3076 19.1894 20.1306 19.615 19.7766 19.969C19.4226 20.323 18.997 20.5 18.4999 20.5H5.11537ZM17.1921 8.61523V6.61523H15.1921V5.11548H17.1921V3.11548H18.6921V5.11548H20.6921V6.61523H18.6921V8.61523H17.1921ZM6.55762 16.75H17.1344L13.8459 12.3655L11.0384 16.0192L9.03837 13.4615L6.55762 16.75Z`,fill:`currentColor`})),table:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M3.5 18.6923V5.30775C3.5 4.81058 3.677 4.385 4.031 4.031C4.385 3.677 4.81058 3.5 5.30775 3.5H18.6923C19.1894 3.5 19.615 3.677 19.969 4.031C20.323 4.385 20.5 4.81058 20.5 5.30775V18.6923C20.5 19.1894 20.323 19.615 19.969 19.969C19.615 20.323 19.1894 20.5 18.6923 20.5H5.30775C4.81058 20.5 4.385 20.323 4.031 19.969C3.677 19.615 3.5 19.1894 3.5 18.6923ZM5 9.077H19V5.30775C19 5.21792 18.9712 5.14417 18.9135 5.0865C18.8558 5.02883 18.7821 5 18.6923 5H5.30775C5.21792 5 5.14417 5.02883 5.0865 5.0865C5.02883 5.14417 5 5.21792 5 5.30775V9.077ZM10.1615 14.0385H13.8385V10.577H10.1615V14.0385ZM10.1615 19H13.8385V15.5385H10.1615V19ZM5 14.0385H8.6615V10.577H5V14.0385ZM15.3385 14.0385H19V10.577H15.3385V14.0385ZM5.30775 19H8.6615V15.5385H5V18.6923C5 18.7821 5.02883 18.8558 5.0865 18.9135C5.14417 18.9712 5.21792 19 5.30775 19ZM15.3385 19H18.6923C18.7821 19 18.8558 18.9712 18.9135 18.9135C18.9712 18.8558 19 18.7821 19 18.6923V15.5385H15.3385V19Z`,fill:`currentColor`})),horizontal_rule:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M4.5 12.75V11.25H19.5V12.75H4.5Z`,fill:`currentColor`})),frontmatter:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M4.5 8.75V7.25H8.5V8.75H4.5Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M4.5 14.75V13.25H8.5V14.75H4.5Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M9.5 8.75V7.25H13.5V8.75H9.5Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M9.5 14.75V13.25H13.5V14.75H9.5Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M14.5 8.75V7.25H18.5V8.75H14.5Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M14.5 14.75V13.25H18.5V14.75H14.5Z`,fill:`currentColor`})),frame_source:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M8.6 15.2443L5.35575 12L8.6 8.75575L9.64425 9.825L7.46925 12L9.64425 14.175L8.6 15.2443ZM15.4 15.2443L14.3558 14.175L16.5307 12L14.3558 9.825L15.4 8.75575L18.6443 12L15.4 15.2443ZM5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V15H5V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19H9V20.5H5.30775ZM15 20.5V19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V15H20.5V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H15ZM3.5 9V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H9V5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V9H3.5ZM19 9V5.30775C19 5.23075 18.9679 5.16025 18.9038 5.09625C18.8398 5.03208 18.7692 5 18.6923 5H15V3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V9H19Z`,fill:`currentColor`})),arrow_drop_down:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M11.9999 14.6537L7.59619 10.25H16.4037L11.9999 14.6537Z`,fill:`currentColor`})),admonition:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M12.0001 21.4C11.7654 21.4 11.5385 21.3548 11.3193 21.2645C11.1002 21.174 10.9002 21.0435 10.7193 20.873L3.1271 13.2807C2.9566 13.0999 2.8261 12.8999 2.7356 12.6807C2.64526 12.4616 2.6001 12.2346 2.6001 12C2.6001 11.7653 2.64526 11.5358 2.7356 11.3115C2.8261 11.0871 2.9566 10.8897 3.1271 10.7192L10.7193 3.12698C10.9002 2.94614 11.1002 2.81314 11.3193 2.72798C11.5385 2.64264 11.7654 2.59998 12.0001 2.59998C12.2348 2.59998 12.4643 2.64264 12.6886 2.72798C12.9129 2.81314 13.1103 2.94614 13.2808 3.12698L20.8731 10.7192C21.0539 10.8897 21.1869 11.0871 21.2721 11.3115C21.3574 11.5358 21.4001 11.7653 21.4001 12C21.4001 12.2346 21.3574 12.4616 21.2721 12.6807C21.1869 12.8999 21.0539 13.0999 20.8731 13.2807L13.2808 20.873C13.1103 21.0435 12.9129 21.174 12.6886 21.2645C12.4643 21.3548 12.2348 21.4 12.0001 21.4ZM12.2213 19.8037L19.8039 12.2212C19.8552 12.1699 19.8808 12.0961 19.8808 12C19.8808 11.9038 19.8552 11.8301 19.8039 11.7787L12.2213 4.19623C12.17 4.14489 12.0963 4.11923 12.0001 4.11923C11.9039 4.11923 11.8302 4.14489 11.7788 4.19623L4.19635 11.7787C4.14501 11.8301 4.11935 11.9038 4.11935 12C4.11935 12.0961 4.14501 12.1699 4.19635 12.2212L11.7788 19.8037C11.8302 19.8551 11.9039 19.8807 12.0001 19.8807C12.0963 19.8807 12.17 19.8551 12.2213 19.8037ZM11.2501 13.0865H12.7501V7.47123H11.2501V13.0865ZM12.0001 15.702C12.2258 15.702 12.4168 15.6237 12.5731 15.4672C12.7296 15.3109 12.8078 15.1199 12.8078 14.8942C12.8078 14.6686 12.7296 14.4776 12.5731 14.3212C12.4168 14.1647 12.2258 14.0865 12.0001 14.0865C11.7744 14.0865 11.5834 14.1647 11.4271 14.3212C11.2706 14.4776 11.1923 14.6686 11.1923 14.8942C11.1923 15.1199 11.2706 15.3109 11.4271 15.4672C11.5834 15.6237 11.7744 15.702 12.0001 15.702Z`,fill:`currentColor`})),rich_text:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM5.30775 19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V5.30775C19 5.23075 18.9679 5.16025 18.9038 5.09625C18.8398 5.03208 18.7692 5 18.6923 5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19ZM6.75 17H17.3268L14 12.3655L11.2308 16.0192L9 13.4615L6.75 17Z`,fill:`currentColor`}),k.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6 12V6.5H9.1925C9.5925 6.5 9.9425 6.65 10.2425 6.95C10.5425 7.25 10.6925 7.6 10.6925 8V8.6925C10.6925 9.03733 10.605 9.32675 10.43 9.56075C10.255 9.79458 10.0168 9.97817 9.7155 10.1115L10.6155 12H9.404L8.504 10.1925H7.1925V12H6ZM9.1925 9H7.1925V7.6925H9.1925C9.26933 7.6925 9.33983 7.7245 9.404 7.7885C9.468 7.85267 9.5 7.92317 9.5 8V8.6925C9.5 8.76933 9.468 8.83983 9.404 8.904C9.33983 8.968 9.26933 9 9.1925 9Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M12.5 7H17.5V8.25H12.5V7Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M12.5 9.25H17.5V10.5H12.5V9.25Z`,fill:`currentColor`})),difference:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM18.6923 19H5.30775C5.23075 19 5.16025 18.9679 5.09625 18.9038C5.03208 18.8398 5 18.7692 5 18.6923V5.30775C5 5.23075 5.03208 5.16025 5.09625 5.09625C5.16025 5.03208 5.23075 5 5.30775 5H18.6923C18.7692 5 18.8398 5.03208 18.9038 5.09625C18.9679 5.16025 19 5.23075 19 5.30775V18.6923C19 18.7692 18.9679 18.8398 18.9038 18.9038C18.8398 18.9679 18.7692 19 18.6923 19Z`,fill:`currentColor`}),k.createElement(`rect`,{x:`9`,y:`10`,width:`5.5`,height:`1.5`,fill:`currentColor`}),k.createElement(`rect`,{x:`9`,y:`15`,width:`5.5`,height:`1.5`,fill:`currentColor`}),k.createElement(`rect`,{x:`11`,y:`8`,width:`1.5`,height:`5.5`,fill:`currentColor`})),markdown:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM18.6923 19H5.30775C5.23075 19 5.16025 18.9679 5.09625 18.9038C5.03208 18.8398 5 18.7692 5 18.6923V5.30775C5 5.23075 5.03208 5.16025 5.09625 5.09625C5.16025 5.03208 5.23075 5 5.30775 5H18.6923C18.7692 5 18.8398 5.03208 18.9038 5.09625C18.9679 5.16025 19 5.23075 19 5.30775V18.6923C19 18.7692 18.9679 18.8398 18.9038 18.9038C18.8398 18.9679 18.7692 19 18.6923 19Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M13 15H11.5V11L9.5 14L7.5 11V15H6V8H7.5L9.5 11L11.5 8H13V15Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M15.9921 15.5833L13.2886 12.8797L14.0546 12.1137L15.4504 13.5016V7.99597L16.5336 7.99993V13.5016L17.9296 12.1137L18.6954 12.8797L15.9921 15.5833Z`,fill:`currentColor`})),open_in_new:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H11.6152V5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V12.3848H20.5V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM9.71925 15.3345L8.6655 14.2808L17.9462 5H14V3.5H20.5V10H19V6.05375L9.71925 15.3345Z`,fill:`currentColor`})),link_off:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M18.8843 16.1038L17.7498 14.9385C18.4228 14.7552 18.9661 14.3946 19.3796 13.8568C19.7931 13.319 19.9998 12.7 19.9998 12C19.9998 11.1604 19.705 10.444 19.1153 9.85105C18.5255 9.25805 17.8139 8.96155 16.9806 8.96155H13.1728V7.46155H16.9806C18.2293 7.46155 19.2947 7.90422 20.1768 8.78955C21.0588 9.67472 21.4998 10.7449 21.4998 12C21.4998 12.8859 21.262 13.6951 20.7863 14.4278C20.3107 15.1606 19.6767 15.7193 18.8843 16.1038ZM15.5806 12.75L14.0806 11.25H15.7306V12.75H15.5806ZM20.1461 22.2538L1.74609 3.8538L2.79984 2.80005L21.1998 21.2L20.1461 22.2538ZM10.8268 16.5386H7.03834C5.78318 16.5386 4.71301 16.0959 3.82784 15.2105C2.94251 14.3254 2.49984 13.2552 2.49984 12C2.49984 10.8885 2.85784 9.91322 3.57384 9.07405C4.28984 8.23505 5.18826 7.72838 6.26909 7.55405H6.49984L7.90759 8.96155H7.03834C6.19851 8.96155 5.48218 9.25805 4.88934 9.85105C4.29634 10.444 3.99984 11.1604 3.99984 12C3.99984 12.8397 4.29634 13.556 4.88934 14.149C5.48218 14.742 6.19851 15.0385 7.03834 15.0385H10.8268V16.5386ZM8.26909 12.75V11.25H10.2113L11.6863 12.75H8.26909Z`,fill:`currentColor`})),edit:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M5 19H6.2615L16.498 8.7635L15.2365 7.502L5 17.7385V19ZM3.5 20.5V17.1155L16.6905 3.93075C16.8417 3.79342 17.0086 3.68733 17.1913 3.6125C17.3741 3.5375 17.5658 3.5 17.7663 3.5C17.9668 3.5 18.1609 3.53558 18.3488 3.60675C18.5367 3.67792 18.7032 3.79108 18.848 3.94625L20.0693 5.18275C20.2244 5.32758 20.335 5.49425 20.401 5.68275C20.467 5.87125 20.5 6.05975 20.5 6.24825C20.5 6.44942 20.4657 6.64133 20.397 6.824C20.3283 7.00683 20.2191 7.17383 20.0693 7.325L6.8845 20.5H3.5ZM15.8562 8.14375L15.2365 7.502L16.498 8.7635L15.8562 8.14375Z`,fill:`currentColor`})),content_copy:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M9.05775 17.5C8.55258 17.5 8.125 17.325 7.775 16.975C7.425 16.625 7.25 16.1974 7.25 15.6923V4.30775C7.25 3.80258 7.425 3.375 7.775 3.025C8.125 2.675 8.55258 2.5 9.05775 2.5H17.4423C17.9474 2.5 18.375 2.675 18.725 3.025C19.075 3.375 19.25 3.80258 19.25 4.30775V15.6923C19.25 16.1974 19.075 16.625 18.725 16.975C18.375 17.325 17.9474 17.5 17.4423 17.5H9.05775ZM9.05775 16H17.4423C17.5192 16 17.5898 15.9679 17.6538 15.9038C17.7179 15.8398 17.75 15.7692 17.75 15.6923V4.30775C17.75 4.23075 17.7179 4.16025 17.6538 4.09625C17.5898 4.03208 17.5192 4 17.4423 4H9.05775C8.98075 4 8.91025 4.03208 8.84625 4.09625C8.78208 4.16025 8.75 4.23075 8.75 4.30775V15.6923C8.75 15.7692 8.78208 15.8398 8.84625 15.9038C8.91025 15.9679 8.98075 16 9.05775 16ZM5.55775 21C5.05258 21 4.625 20.825 4.275 20.475C3.925 20.125 3.75 19.6974 3.75 19.1923V6.30775H5.25V19.1923C5.25 19.2693 5.28208 19.3398 5.34625 19.4038C5.41025 19.4679 5.48075 19.5 5.55775 19.5H15.4423V21H5.55775Z`,fill:`currentColor`})),more_horiz:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M6.23096 13.5C5.81846 13.5 5.46537 13.3531 5.17171 13.0592C4.87787 12.7656 4.73096 12.4125 4.73096 12C4.73096 11.5875 4.87787 11.2344 5.17171 10.9408C5.46537 10.6469 5.81846 10.5 6.23096 10.5C6.64346 10.5 6.99662 10.6469 7.29046 10.9408C7.58412 11.2344 7.73096 11.5875 7.73096 12C7.73096 12.4125 7.58412 12.7656 7.29046 13.0592C6.99662 13.3531 6.64346 13.5 6.23096 13.5ZM12.0002 13.5C11.5877 13.5 11.2346 13.3531 10.941 13.0592C10.6471 12.7656 10.5002 12.4125 10.5002 12C10.5002 11.5875 10.6471 11.2344 10.941 10.9408C11.2346 10.6469 11.5877 10.5 12.0002 10.5C12.4127 10.5 12.7658 10.6469 13.0595 10.9408C13.3533 11.2344 13.5002 11.5875 13.5002 12C13.5002 12.4125 13.3533 12.7656 13.0595 13.0592C12.7658 13.3531 12.4127 13.5 12.0002 13.5ZM17.7695 13.5C17.357 13.5 17.0038 13.3531 16.71 13.0592C16.4163 12.7656 16.2695 12.4125 16.2695 12C16.2695 11.5875 16.4163 11.2344 16.71 10.9408C17.0038 10.6469 17.357 10.5 17.7695 10.5C18.182 10.5 18.535 10.6469 18.8287 10.9408C19.1225 11.2344 19.2695 11.5875 19.2695 12C19.2695 12.4125 19.1225 12.7656 18.8287 13.0592C18.535 13.3531 18.182 13.5 17.7695 13.5Z`,fill:`currentColor`})),more_vert:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M12 19.2692C11.5875 19.2692 11.2344 19.1223 10.9408 18.8285C10.6469 18.5348 10.5 18.1817 10.5 17.7692C10.5 17.3567 10.6469 17.0035 10.9408 16.7097C11.2344 16.416 11.5875 16.2692 12 16.2692C12.4125 16.2692 12.7656 16.416 13.0592 16.7097C13.3531 17.0035 13.5 17.3567 13.5 17.7692C13.5 18.1817 13.3531 18.5348 13.0592 18.8285C12.7656 19.1223 12.4125 19.2692 12 19.2692ZM12 13.5C11.5875 13.5 11.2344 13.353 10.9408 13.0592C10.6469 12.7655 10.5 12.4125 10.5 12C10.5 11.5875 10.6469 11.2344 10.9408 10.9407C11.2344 10.6469 11.5875 10.5 12 10.5C12.4125 10.5 12.7656 10.6469 13.0592 10.9407C13.3531 11.2344 13.5 11.5875 13.5 12C13.5 12.4125 13.3531 12.7655 13.0592 13.0592C12.7656 13.353 12.4125 13.5 12 13.5ZM12 7.73071C11.5875 7.73071 11.2344 7.58388 10.9408 7.29021C10.6469 6.99638 10.5 6.64321 10.5 6.23071C10.5 5.81821 10.6469 5.46513 10.9408 5.17146C11.2344 4.87763 11.5875 4.73071 12 4.73071C12.4125 4.73071 12.7656 4.87763 13.0592 5.17146C13.3531 5.46513 13.5 5.81821 13.5 6.23071C13.5 6.64321 13.3531 6.99638 13.0592 7.29021C12.7656 7.58388 12.4125 7.73071 12 7.73071Z`,fill:`currentColor`})),close:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M6.39994 18.6538L5.34619 17.6L10.9462 12L5.34619 6.4L6.39994 5.34625L11.9999 10.9463L17.5999 5.34625L18.6537 6.4L13.0537 12L18.6537 17.6L17.5999 18.6538L11.9999 13.0538L6.39994 18.6538Z`,fill:`currentColor`})),settings:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M9.69225 21.5L9.3115 18.4538C9.04367 18.3641 8.769 18.2385 8.4875 18.077C8.20617 17.9153 7.95459 17.7422 7.73275 17.5577L4.9115 18.75L2.604 14.75L5.04425 12.9058C5.02125 12.7571 5.00492 12.6077 4.99525 12.4578C4.98559 12.3078 4.98075 12.1583 4.98075 12.0095C4.98075 11.8673 4.98559 11.7228 4.99525 11.576C5.00492 11.4292 5.02125 11.2686 5.04425 11.0943L2.604 9.25L4.9115 5.26925L7.723 6.452C7.96417 6.261 8.22159 6.08633 8.49525 5.928C8.76892 5.76967 9.03784 5.64242 9.302 5.54625L9.69225 2.5H14.3078L14.6885 5.55575C14.9885 5.66475 15.2599 5.792 15.5028 5.9375C15.7458 6.083 15.991 6.2545 16.2385 6.452L19.0885 5.26925L21.396 9.25L18.9173 11.123C18.9531 11.2845 18.9727 11.4355 18.976 11.576C18.9792 11.7163 18.9808 11.8577 18.9808 12C18.9808 12.1358 18.9775 12.274 18.971 12.4145C18.9647 12.5548 18.9417 12.7154 18.902 12.8963L21.3615 14.75L19.0538 18.75L16.2385 17.548C15.991 17.7455 15.7384 17.9202 15.4808 18.072C15.2231 18.224 14.959 18.3481 14.6885 18.4443L14.3078 21.5H9.69225ZM11 20H12.9655L13.325 17.3212C13.8353 17.1879 14.3017 16.9985 14.724 16.753C15.1465 16.5073 15.5539 16.1916 15.9463 15.8057L18.4308 16.85L19.4155 15.15L17.2463 13.5155C17.3296 13.2565 17.3863 13.0026 17.4163 12.7537C17.4464 12.5051 17.4615 12.2538 17.4615 12C17.4615 11.7397 17.4464 11.4884 17.4163 11.2463C17.3863 11.0039 17.3296 10.7564 17.2463 10.5038L19.4345 8.85L18.45 7.15L15.9365 8.2095C15.6018 7.85183 15.2009 7.53583 14.7338 7.2615C14.2664 6.98717 13.7937 6.79292 13.3155 6.67875L13 4H11.0155L10.6845 6.66925C10.1743 6.78975 9.70325 6.97433 9.27125 7.223C8.83909 7.47183 8.42684 7.79233 8.0345 8.1845L5.55 7.15L4.5655 8.85L6.725 10.4595C6.64167 10.6968 6.58334 10.9437 6.55 11.2C6.51667 11.4563 6.5 11.7262 6.5 12.0095C6.5 12.2698 6.51667 12.525 6.55 12.775C6.58334 13.025 6.6385 13.2718 6.7155 13.5155L4.5655 15.15L5.55 16.85L8.025 15.8C8.4045 16.1897 8.81025 16.5089 9.24225 16.7578C9.67442 17.0064 10.152 17.1974 10.675 17.3307L11 20ZM12.0115 15C12.8435 15 13.5515 14.708 14.1355 14.124C14.7195 13.54 15.0115 12.832 15.0115 12C15.0115 11.168 14.7195 10.46 14.1355 9.876C13.5515 9.292 12.8435 9 12.0115 9C11.1692 9 10.4586 9.292 9.87975 9.876C9.30092 10.46 9.0115 11.168 9.0115 12C9.0115 12.832 9.30092 13.54 9.87975 14.124C10.4586 14.708 11.1692 15 12.0115 15Z`,fill:`currentColor`})),delete_big:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M7.30775 20.5C6.80908 20.5 6.38308 20.3234 6.02975 19.9702C5.67658 19.6169 5.5 19.1909 5.5 18.6922V5.99998H4.5V4.49998H9V3.61548H15V4.49998H19.5V5.99998H18.5V18.6922C18.5 19.1974 18.325 19.625 17.975 19.975C17.625 20.325 17.1974 20.5 16.6923 20.5H7.30775ZM17 5.99998H7V18.6922C7 18.7821 7.02883 18.8558 7.0865 18.9135C7.14417 18.9711 7.21792 19 7.30775 19H16.6923C16.7692 19 16.8398 18.9679 16.9038 18.9037C16.9679 18.8397 17 18.7692 17 18.6922V5.99998ZM9.404 17H10.9037V7.99998H9.404V17ZM13.0962 17H14.596V7.99998H13.0962V17Z`,fill:`currentColor`})),delete_small:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M7.30775 20.5C6.80908 20.5 6.38308 20.3234 6.02975 19.9702C5.67658 19.6169 5.5 19.1909 5.5 18.6922V5.99998H4.5V4.49998H9V3.61548H15V4.49998H19.5V5.99998H18.5V18.6922C18.5 19.1974 18.325 19.625 17.975 19.975C17.625 20.325 17.1974 20.5 16.6923 20.5H7.30775ZM17 5.99998H7V18.6922C7 18.7821 7.02883 18.8558 7.0865 18.9135C7.14417 18.9711 7.21792 19 7.30775 19H16.6923C16.7692 19 16.8398 18.9679 16.9038 18.9037C16.9679 18.8397 17 18.7692 17 18.6922V5.99998ZM9.404 17H10.9037V7.99998H9.404V17ZM13.0962 17H14.596V7.99998H13.0962V17Z`,fill:`currentColor`})),format_align_center:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M3.5 20.5V19H20.5V20.5H3.5ZM7.5 16.625V15.125H16.5V16.625H7.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM7.5 8.875V7.375H16.5V8.875H7.5ZM3.5 5V3.5H20.5V5H3.5Z`,fill:`currentColor`})),format_align_left:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M3.5 20.5V19H20.5V20.5H3.5ZM3.5 16.625V15.125H14.5V16.625H3.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM3.5 8.875V7.375H14.5V8.875H3.5ZM3.5 5V3.5H20.5V5H3.5Z`,fill:`currentColor`})),format_align_right:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M3.5 5V3.5H20.5V5H3.5ZM9.5 8.875V7.375H20.5V8.875H9.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM9.5 16.625V15.125H20.5V16.625H9.5ZM3.5 20.5V19H20.5V20.5H3.5Z`,fill:`currentColor`})),add_row:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.025 10.2077C4.375 9.85775 4.80258 9.68275 5.30775 9.68275H6.5V11.1827H5.30775C5.21792 11.1827 5.14417 11.2116 5.0865 11.2693C5.02883 11.3269 5 11.4007 5 11.4905V16.1923C5 16.2821 5.02883 16.3558 5.0865 16.4135C5.14417 16.4712 5.21792 16.5 5.30775 16.5H18.6923C18.7821 16.5 18.8558 16.4712 18.9135 16.4135C18.9712 16.3558 19 16.2821 19 16.1923V11.4905C19 11.4007 18.9712 11.3269 18.9135 11.2693C18.8558 11.2116 18.7821 11.1827 18.6923 11.1827H17.6923V9.68275H18.6923C19.1974 9.68275 19.625 9.85775 19.975 10.2077C20.325 10.5577 20.5 10.9853 20.5 11.4905V16.1923C20.5 16.6974 20.325 17.125 19.975 17.475C19.625 17.825 19.1974 18 18.6923 18H5.30775C4.80258 18 4.375 17.825 4.025 17.475C3.675 17.125 3.5 16.6974 3.5 16.1923V11.4905C3.5 10.9853 3.675 10.5577 4.025 10.2077Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M11.3848 9.68275V7.5H12.8848V9.68275H15V11.1827H12.8848V13.2307H11.3848V11.1827H9.26925V9.68275H11.3848Z`,fill:`currentColor`})),add_column:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.70775 4.025C9.35775 4.375 9.18275 4.80258 9.18275 5.30775V6.5H10.6827V5.30775C10.6827 5.21792 10.7116 5.14417 10.7693 5.0865C10.8269 5.02883 10.9007 5 10.9905 5H15.6923C15.7821 5 15.8558 5.02883 15.9135 5.0865C15.9712 5.14417 16 5.21792 16 5.30775V18.6923C16 18.7821 15.9712 18.8558 15.9135 18.9135C15.8558 18.9712 15.7821 19 15.6923 19H10.9905C10.9007 19 10.8269 18.9712 10.7693 18.9135C10.7116 18.8558 10.6827 18.7821 10.6827 18.6923V17.6923H9.18275V18.6923C9.18275 19.1974 9.35775 19.625 9.70775 19.975C10.0577 20.325 10.4853 20.5 10.9905 20.5H15.6923C16.1974 20.5 16.625 20.325 16.975 19.975C17.325 19.625 17.5 19.1974 17.5 18.6923V5.30775C17.5 4.80258 17.325 4.375 16.975 4.025C16.625 3.675 16.1974 3.5 15.6923 3.5H10.9905C10.4853 3.5 10.0577 3.675 9.70775 4.025Z`,fill:`currentColor`}),k.createElement(`path`,{d:`M9.18275 11.3848H7V12.8848H9.18275V15H10.6827V12.8848H12.7307V11.3848H10.6827V9.26925H9.18275V11.3848Z`,fill:`currentColor`})),insert_col_left:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M13.0001 20.1152H8.67713H8.75388H8.69238H13.0001ZM7.19238 19.8075C7.19238 20.3127 7.36738 20.7402 7.71738 21.0902C8.06738 21.4402 8.49497 21.6152 9.00013 21.6152H12.6924C13.1975 21.6152 13.6251 21.4402 13.9751 21.0902C14.3251 20.7402 14.5001 20.3127 14.5001 19.8075V10.423H13.0001V19.8075C13.0001 19.8973 12.9713 19.9711 12.9136 20.0287C12.856 20.0864 12.7822 20.1152 12.6924 20.1152H9.00013C8.9103 20.1152 8.83655 20.0864 8.77888 20.0287C8.72122 19.9711 8.69238 19.8973 8.69238 19.8075V4.69223C8.26422 4.74357 7.90722 4.93299 7.62138 5.26048C7.33538 5.58798 7.19238 5.97548 7.19238 6.42298V19.8075ZM13.0001 2.49998V4.61523H10.8846V6.11523H13.0001V8.23073H14.5001V6.11523H16.6154V4.61523H14.5001V2.49998H13.0001Z`,fill:`currentColor`})),insert_row_above:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M20.1152 9.99987V14.3229V14.2461V14.3076V9.99987ZM19.8075 15.8076C20.3127 15.8076 20.7402 15.6326 21.0902 15.2826C21.4402 14.9326 21.6152 14.505 21.6152 13.9999V10.3076C21.6152 9.80245 21.4402 9.37487 21.0902 9.02487C20.7402 8.67487 20.3127 8.49987 19.8075 8.49987H10.423V9.99987H19.8075C19.8973 9.99987 19.9711 10.0287 20.0287 10.0864C20.0864 10.144 20.1152 10.2178 20.1152 10.3076V13.9999C20.1152 14.0897 20.0864 14.1635 20.0287 14.2211C19.9711 14.2788 19.8973 14.3076 19.8075 14.3076H4.69223C4.74357 14.7358 4.93299 15.0928 5.26048 15.3786C5.58798 15.6646 5.97548 15.8076 6.42298 15.8076H19.8075ZM2.49998 9.99987H4.61523V12.1154H6.11523V9.99987H8.23073V8.49987H6.11523V6.38462H4.61523V8.49987H2.49998V9.99987Z`,fill:`currentColor`})),insert_row_below:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M20.1152 14.1924V9.86939V9.94614V9.88464V14.1924ZM19.8075 8.38464C20.3127 8.38464 20.7402 8.55964 21.0902 8.90964C21.4402 9.25964 21.6152 9.68723 21.6152 10.1924V13.8846C21.6152 14.3898 21.4402 14.8174 21.0902 15.1674C20.7402 15.5174 20.3127 15.6924 19.8075 15.6924H10.423V14.1924H19.8075C19.8973 14.1924 19.9711 14.1636 20.0287 14.1059C20.0864 14.0482 20.1152 13.9745 20.1152 13.8846V10.1924C20.1152 10.1026 20.0864 10.0288 20.0287 9.97114C19.9711 9.91348 19.8973 9.88464 19.8075 9.88464H4.69223C4.74357 9.45648 4.93299 9.09948 5.26048 8.81364C5.58798 8.52764 5.97548 8.38464 6.42298 8.38464H19.8075ZM2.49998 14.1924H4.61523V12.0769H6.11523V14.1924H8.23073V15.6924H6.11523V17.8076H4.61523V15.6924H2.49998V14.1924Z`,fill:`currentColor`})),insert_col_right:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M10.8075 20.1152H15.1305H15.0537H15.1152H10.8075ZM16.6152 19.8075C16.6152 20.3127 16.4402 20.7402 16.0902 21.0902C15.7402 21.4402 15.3127 21.6152 14.8075 21.6152H11.1152C10.6101 21.6152 10.1825 21.4402 9.83248 21.0902C9.48248 20.7402 9.30748 20.3127 9.30748 19.8075V10.423H10.8075V19.8075C10.8075 19.8973 10.8363 19.9711 10.894 20.0287C10.9517 20.0864 11.0254 20.1152 11.1152 20.1152H14.8075C14.8973 20.1152 14.9711 20.0864 15.0287 20.0287C15.0864 19.9711 15.1152 19.8973 15.1152 19.8075V4.69223C15.5434 4.74357 15.9004 4.93299 16.1862 5.26048C16.4722 5.58798 16.6152 5.97548 16.6152 6.42298V19.8075ZM10.8075 2.49998V4.61523H12.923V6.11523H10.8075V8.23073H9.30748V6.11523H7.19223V4.61523H9.30748V2.49998H10.8075Z`,fill:`currentColor`})),check:k.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},k.createElement(`path`,{d:`M9.54983 17.6537L4.21533 12.3192L5.28433 11.25L9.54983 15.5155L18.7153 6.34998L19.7843 7.41923L9.54983 17.6537Z`,fill:`currentColor`}))},J={editorRoot:`_editorRoot_eoiyl_53`,editorWrapper:`_editorWrapper_eoiyl_155`,toolbarRoot:`_toolbarRoot_eoiyl_162`,readOnlyToolbarRoot:`_readOnlyToolbarRoot_eoiyl_189`,toolbarToggleItem:`_toolbarToggleItem_eoiyl_208`,toolbarGroupOfGroups:`_toolbarGroupOfGroups_eoiyl_219`,toolbarToggleSingleGroup:`_toolbarToggleSingleGroup_eoiyl_224`,toolbarButton:`_toolbarButton_eoiyl_239`,activeToolbarButton:`_activeToolbarButton_eoiyl_275`,toolbarButtonDropdownContainer:`_toolbarButtonDropdownContainer_eoiyl_286`,selectContainer:`_selectContainer_eoiyl_288`,selectItem:`_selectItem_eoiyl_301`,toolbarButtonSelectTrigger:`_toolbarButtonSelectTrigger_eoiyl_307`,selectTrigger:`_selectTrigger_eoiyl_308`,selectDropdownArrow:`_selectDropdownArrow_eoiyl_373`,contentEditable:`_contentEditable_eoiyl_379`,codeMirrorWrapper:`_codeMirrorWrapper_eoiyl_391`,codeMirrorToolbar:`_codeMirrorToolbar_eoiyl_408`,propertyPanelTitle:`_propertyPanelTitle_eoiyl_430`,propertyEditorTable:`_propertyEditorTable_eoiyl_438`,iconButton:`_iconButton_eoiyl_456`,readOnlyColumnCell:`_readOnlyColumnCell_eoiyl_461`,buttonsFooter:`_buttonsFooter_eoiyl_474`,propertyEditorInput:`_propertyEditorInput_eoiyl_480`,primaryButton:`_primaryButton_eoiyl_506`,secondaryButton:`_secondaryButton_eoiyl_507`,smallButton:`_smallButton_eoiyl_522`,dialogForm:`_dialogForm_eoiyl_534`,linkDialogEditForm:`_linkDialogEditForm_eoiyl_540`,linkDialogInputContainer:`_linkDialogInputContainer_eoiyl_548`,linkDialogInputWrapper:`_linkDialogInputWrapper_eoiyl_554`,linkDialogInput:`_linkDialogInput_eoiyl_548`,linkDialogAnchor:`_linkDialogAnchor_eoiyl_586`,linkDialogPopoverContent:`_linkDialogPopoverContent_eoiyl_600`,tableColumnEditorPopoverContent:`_tableColumnEditorPopoverContent_eoiyl_601`,dialogContent:`_dialogContent_eoiyl_602`,largeDialogContent:`_largeDialogContent_eoiyl_614`,dialogTitle:`_dialogTitle_eoiyl_624`,visuallyHidden:`_visuallyHidden_eoiyl_631`,dialogCloseButton:`_dialogCloseButton_eoiyl_644`,popoverContent:`_popoverContent_eoiyl_651`,popoverArrow:`_popoverArrow_eoiyl_663`,linkDialogPreviewAnchor:`_linkDialogPreviewAnchor_eoiyl_667`,tooltipTrigger:`_tooltipTrigger_eoiyl_690`,tooltipContent:`_tooltipContent_eoiyl_694`,actionButton:`_actionButton_eoiyl_708`,primaryActionButton:`_primaryActionButton_eoiyl_715`,tableEditor:`_tableEditor_eoiyl_727`,toolCell:`_toolCell_eoiyl_738`,tableColumnEditorTrigger:`_tableColumnEditorTrigger_eoiyl_757`,addRowButton:`_addRowButton_eoiyl_759`,addColumnButton:`_addColumnButton_eoiyl_760`,tableColumnEditorToolbar:`_tableColumnEditorToolbar_eoiyl_802`,toggleGroupRoot:`_toggleGroupRoot_eoiyl_815`,tableToolsColumn:`_tableToolsColumn_eoiyl_833`,leftAlignedCell:`_leftAlignedCell_eoiyl_842`,rightAlignedCell:`_rightAlignedCell_eoiyl_846`,centeredCell:`_centeredCell_eoiyl_850`,dialogOverlay:`_dialogOverlay_eoiyl_883`,focusedImage:`_focusedImage_eoiyl_929`,imageWrapper:`_imageWrapper_eoiyl_933`,editImageToolbar:`_editImageToolbar_eoiyl_946`,editImageButton:`_editImageButton_eoiyl_950`,inlineEditor:`_inlineEditor_eoiyl_956`,blockEditor:`_blockEditor_eoiyl_965`,nestedEditor:`_nestedEditor_eoiyl_974`,genericComponentName:`_genericComponentName_eoiyl_993`,diffSourceToggleWrapper:`_diffSourceToggleWrapper_eoiyl_999`,ggDiffSourceToggle:`_ggDiffSourceToggle_eoiyl_1007`,diffSourceToggle:`_diffSourceToggle_eoiyl_999`,selectWithLabel:`_selectWithLabel_eoiyl_1025`,toolbarTitleMode:`_toolbarTitleMode_eoiyl_1040`,imageControlWrapperResizing:`_imageControlWrapperResizing_eoiyl_1045`,imageResizer:`_imageResizer_eoiyl_1049`,imageResizerN:`_imageResizerN_eoiyl_1058`,imageResizerNe:`_imageResizerNe_eoiyl_1064`,imageResizerE:`_imageResizerE_eoiyl_1070`,imageResizerSe:`_imageResizerSe_eoiyl_1076`,imageResizerS:`_imageResizerS_eoiyl_1076`,imageResizerSw:`_imageResizerSw_eoiyl_1088`,imageResizerW:`_imageResizerW_eoiyl_1094`,imageResizerNw:`_imageResizerNw_eoiyl_1100`,imagePlaceholder:`_imagePlaceholder_eoiyl_1106`,imageDimensionsContainer:`_imageDimensionsContainer_eoiyl_1114`,placeholder:`_placeholder_eoiyl_1119`,rootContentEditableWrapper:`_rootContentEditableWrapper_eoiyl_1132`,downshiftInputWrapper:`_downshiftInputWrapper_eoiyl_1142`,downshiftInput:`_downshiftInput_eoiyl_1142`,downshiftAutocompleteContainer:`_downshiftAutocompleteContainer_eoiyl_1173`,textInput:`_textInput_eoiyl_1219`,multiFieldForm:`_multiFieldForm_eoiyl_1227`,formField:`_formField_eoiyl_1233`,markdownParseError:`_markdownParseError_eoiyl_1244`,popupContainer:`_popupContainer_eoiyl_1253`,inputSizer:`_inputSizer_eoiyl_1258`};function DC(e,t){let n=null,r=[],i=``;e.getEditorState().read(()=>{let t=R();!t||I(t)&&t.isCollapsed()||t.getNodes().length===0||(r=b_(e,t).nodes,r.length>0&&(n=Nu()))},{editor:e});let a=n;if(!a||r.length===0)return``;let o={error:void 0,failed:!1};if(a.update(()=>{try{let e=U(),n=x_(r),a=V(),o=()=>{a.isEmpty()||(e.append(a),a=V())};for(let t of n)t.isInline()?a.append(t):(o(),e.append(t));o(),i=mb({root:e,...t})}catch(e){o.failed=!0,o.error=e}},{discrete:!0,skipTransforms:!0}),o.failed)throw o.error;return i.replace(/\n+$/u,``)}var OC=e(TC(),1),kC=({children:e})=>{let t=qr(Ux);return k.createElement(mC,{initialEditor:t},e)},AC=()=>{let e=pC(),t=Yr(SS),n=Yr(PS),r=e=>{n(e),t(e?{current:e}:null)},[i,a,o,s,c,l,u]=Jr(Gx,Kx,GS,qS,YS,Jx,JS);return k.createElement(k.Fragment,null,s.map((e,t)=>k.createElement(e,{key:t})),k.createElement(PC,{wrappers:c},k.createElement(`div`,{className:(0,OC.default)(J.rootContentEditableWrapper,`mdxeditor-root-contenteditable`)},k.createElement(CC,{contentEditable:k.createElement(`div`,{ref:r,className:`mdxeditor-contenteditable-wrapper`},k.createElement(Tx,{className:(0,OC.default)(J.contentEditable,i),ariaLabel:e(`contentArea.editableMarkdown`,`editable markdown`),spellCheck:a})),placeholder:k.createElement(`div`,{className:(0,OC.default)(J.contentEditable,J.placeholder,i)},k.createElement(`p`,null,l)),ErrorBoundary:kx}))),o.map((e,t)=>k.createElement(e,{key:t})),u.map((e,t)=>k.createElement(e,{key:t})))},jC={listItemIndent:`one`},MC=e=>EC[e];function NC(e,t,n={}){let r=t;for(let[e,t]of Object.entries(n))r=r.replaceAll(`{{${e}}}`,String(t));return r}var PC=({wrappers:e,children:t})=>{if(e.length===0)return k.createElement(k.Fragment,null,t);let n=e[0];return k.createElement(n,null,k.createElement(PC,{wrappers:e.slice(1)},t))},FC=({children:e,className:t,overlayContainer:n})=>{let r=k.useRef(null),i=k.useRef(null),a=Yr(bS),o=Yr(xS);return k.useEffect(()=>{let e=document.createElement(`div`);return e.classList.add(`mdxeditor-popup-container`,J.editorRoot,J.popupContainer,...(t??``).trim().split(` `).filter(Boolean)),(n??document.body).appendChild(e),r.current=e,a(r),o(i),()=>{e.remove()}},[t,r,n,a,o]),k.createElement(`div`,{className:(0,OC.default)(`mdxeditor`,J.editorRoot,J.editorWrapper,t),ref:i},e)};function IC(e){return{getMarkdown:()=>{let t=e.getValue(oC);return t===`source`||t===`diff`?e.getValue(sC):e.getValue(rS)},setMarkdown:t=>{e.pub(AS,t)},insertMarkdown:t=>{e.pub(MS,t)},focus:(t,n)=>{var r;(r=e.getValue(Ux))==null||r.focus(t,n)},getContentEditableHTML:()=>e.getValue(SS)?.current.innerHTML??``,getSelectionMarkdown:()=>{let t=e.getValue(oC);if(t===`source`||t===`diff`)return``;let n=e.getValue(Wx);return n?DC(n,{visitors:e.getValue(dS),toMarkdownExtensions:e.getValue(fS),toMarkdownOptions:e.getValue(pS),jsxComponentDescriptors:e.getValue(hS),jsxIsAvailable:e.getValue(mS)}):``}}}var LC=({onReady:e,onDispose:t})=>{let n=Kr(),r=k.useMemo(()=>IC(n),[n]);return k.useLayoutEffect(()=>(e(r),()=>{t(r)}),[r,t,e]),null},RC=k.forwardRef((e,t)=>{let n=k.useRef(null),r=k.useRef(null),i=k.useRef([]),a=k.useRef(e.trim===!1?e.markdown:e.markdown.trim()),o=k.useCallback(e=>{let t=n.current;t&&r.current===null?e(t):i.current.push(e)},[]),s=k.useMemo(()=>({getMarkdown:()=>n.current?.getMarkdown()??a.current,setMarkdown:e=>{a.current=e,o(t=>{t.setMarkdown(e)})},insertMarkdown:e=>{o(t=>{t.insertMarkdown(e)})},focus:(e,t)=>{o(n=>{n.focus(e,t)})},getContentEditableHTML:()=>n.current?.getContentEditableHTML()??``,getSelectionMarkdown:()=>n.current?.getSelectionMarkdown()??``}),[o]),c=k.useCallback(e=>{if(n.current=e,r.current===e)return;if(i.current.length===0){a.current=e.getMarkdown();return}r.current=e;let t=()=>{if(n.current!==e){r.current===e&&(r.current=null);return}let o=i.current.shift();o?(o(e),queueMicrotask(t)):(r.current=null,a.current=e.getMarkdown())};t()},[]),l=k.useCallback(e=>{n.current===e&&(a.current=e.getMarkdown(),n.current=null)},[]);return k.useImperativeHandle(t,()=>s,[s]),k.createElement(ai,{plugins:[fC({contentEditableClassName:e.contentEditableClassName??``,spellCheck:e.spellCheck??!0,initialMarkdown:e.markdown,onChange:e.onChange??Mb,onBlur:e.onBlur??Mb,toMarkdownOptions:e.toMarkdownOptions??jC,autoFocus:e.autoFocus??!1,placeholder:e.placeholder??``,readOnly:!!e.readOnly,iconComponentFor:e.iconComponentFor??MC,suppressHtmlProcessing:e.suppressHtmlProcessing??!1,onError:e.onError??Mb,translation:e.translation??NC,trim:e.trim??!0,lexicalTheme:e.lexicalTheme,...`editorState`in e?{editorState:e.editorState}:{},suppressSharedHistory:e.suppressSharedHistory??!1,additionalLexicalNodes:e.additionalLexicalNodes??[],lexicalEditorNamespace:e.lexicalEditorNamespace??`MDXEditor`}),...e.plugins??[]]},k.createElement(FC,{className:e.className,overlayContainer:e.overlayContainer},k.createElement(kC,null,k.createElement(AC,null))),k.createElement(LC,{onReady:c,onDispose:l}))}),zC=typeof window<`u`&&window.document.createElement!==void 0,BC=zC&&(()=>{let e=navigator.userAgentData?.platform;return e?/mac/i.test(e):/Mac|iPod|iPhone|iPad/.test(navigator.userAgent)})();function VC(e,t){return BC?e:t}var HC={testLexicalNode:Y_,visitLexicalNode:({lexicalNode:e,actions:t})=>{let n=parseInt(e.getTag()[1],10);t.addAndStepInto(`heading`,{depth:n})}},UC={testNode:`heading`,visitNode:function({mdastNode:e,actions:t}){t.addAndStepInto(J_(`h${e.depth}`))}},WC=[`Digit0`,`Digit1`,`Digit2`,`Digit3`,`Digit4`,`Digit5`,`Digit6`],GC=[1,2,3,4,5,6],KC={Digit1:1,Digit2:2,Digit3:3,Digit4:4,Digit5:5,Digit6:6},qC=j(GC,e=>{e.pub(HS,t=>t.registerCommand(Wo,n=>{let{code:r,ctrlKey:i,metaKey:a,altKey:o}=n;return WC.includes(r)&&VC(a,i)&&o?(n.preventDefault(),t.update(()=>{if(r===`Digit0`)e.pub(rC,()=>V());else{let t=e.getValue(qC),n=KC[r];t.includes(n)&&e.pub(rC,()=>J_(`h${n}`))}}),!0):!1},1))}),JC=ii({init(e,t){e.pubIn({[lC]:`headings`,[wS]:UC,[CS]:W_,[DS]:HC}),e.pub(qC,t?.allowedHeadingLevels??GC)},update(e,t){e.pub(qC,t?.allowedHeadingLevels??GC)}});function YC(e,t){return e.read(`latest`,()=>{let e=H(t);return e!==null&&e.isSelected()})}function XC(e){let[t]=gx(),[n,r]=(0,k.useState)(()=>YC(t,e));return(0,k.useEffect)(()=>{let n=!0,i=t.registerUpdateListener(()=>{n&&r(YC(t,e))});return()=>{n=!1,i()}},[t,e]),[n,(0,k.useCallback)(n=>{t.update(()=>{let t=R();L(t)||(t=dl(),fd(t)),L(t)&&(n?t.add(e):t.delete(e))})},[t,e]),(0,k.useCallback)(()=>{t.update(()=>{let e=R();L(e)&&e.clear()})},[t])]}function ZC({nodeKey:e}){let[t]=gx(),[n,r,i]=XC(e);return(0,k.useEffect)(()=>xm(t.registerCommand(Do,a=>{let o=t.getElementByKey(e);return hf(a)===o&&(a.shiftKey||i(),r(!n),!0)},1)),[i,t,n,e,r]),(0,k.useEffect)(()=>{let r=t.getElementByKey(e),i=t._config.theme.hrSelected??`selected`;r!==null&&(n?ym(r,i):bm(r,i))},[t,n,e]),null}var QC=class e extends Qh{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return ew().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:$C,priority:0})}}decorate(){return(0,A.jsx)(ZC,{nodeKey:this.__key})}};function $C(){return{node:ew()}}function ew(){return qd(new QC)}function tw(){let[e]=gx();return(0,k.useEffect)(()=>e.registerCommand(Zh,e=>{let t=R();return I(t)?(t.focus.getNode()!==null&&Bm(ew()),!0):!1},0),[e]),null}var nw={testLexicalNode:e=>e instanceof QC,visitLexicalNode({actions:e}){e.addAndStepInto(`thematicBreak`)}},rw={testNode:`thematicBreak`,visitNode({actions:e}){e.addAndStepInto(ew())}},iw=Wr(e=>{e.sub(e.pipe(iw,Zr(Wx)),([,e])=>{e?.dispatchCommand(Zh,void 0)})}),aw=ii({init(e){e.pubIn({[lC]:`thematicBreak`,[wS]:rw,[CS]:QC,[DS]:nw,[KS]:tw})}}),ow={testNode:`list`,visitNode:function({mdastNode:e,lexicalParent:t,actions:n}){let r=Mv(e.children.some(e=>typeof e.checked==`boolean`)?`check`:e.ordered?`number`:`bullet`,e.start??void 0);if(K(t)){let e=Dv();e.append(r),t.insertAfter(e)}else t.append(r);n.visitChildren(e,r)}},sw={testNode:`listItem`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){let r=n.getListType()===`check`?e.checked??!1:void 0;t.addAndStepInto(Dv(r))}},cw={testLexicalNode:q,visitLexicalNode:({lexicalNode:e,actions:t})=>{let n=e.getListType()===`number`;t.addAndStepInto(`list`,{ordered:n,...n?{start:e.getStart()}:{},spread:!1})}},lw={testLexicalNode:K,visitLexicalNode:({lexicalNode:e,mdastParent:t,actions:n})=>{let r=e.getChildren(),i=r[0];if(r.length===1&&q(i)){let r=t.children.at(-1);r?(i.getListType()===`number`&&i.getStart()!==1&&(r.spread=!0),n.visitChildren(e,r)):n.visitChildren(i,t)}else{let r=e.getParent(),i=n.appendToParent(t,{type:`listItem`,checked:r.getListType()===`check`?!!e.getChecked():void 0,spread:!1,children:[]}),a=null;for(let t of e.getChildren())F(t)||Su(t)||t.isInline()&&(z(t)||B(t))?(a??=n.appendToParent(i,{type:`paragraph`,children:[]}),n.visit(t,a)):(a=null,n.visit(t,i))}}};function uw({maxIndent:e,$canIndent:t}){let[n]=gx();return(0,k.useEffect)(()=>ig(n,e,t),[n,e,t]),null}function dw({disableTakeFocusOnClick:e=!1}){let[t]=gx();return(0,k.useEffect)(()=>Pv(t,{disableTakeFocusOnClick:e}),[t,e]),null}function fw({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){let[n]=gx();return(0,k.useEffect)(()=>{if(!n.hasNodes([Ov,Cv]))throw Error(`ListPlugin: ListNode and/or ListItemNode not registered on editor`)},[n]),(0,k.useEffect)(()=>xm(Uv(n,{restoreNumbering:t}),e?Wv(n):()=>{}),[n,e,t]),function(e){(0,k.useEffect)(()=>Uv(e),[e])}(n),null}var pw=new Map([[`number`,Vv],[`bullet`,Bv],[`check`,Nv],[``,Hv]]),mw=j(``,e=>{e.sub(e.pipe(tS,Zr(Wx)),([t,n])=>{if(!t||!n)return;let r=t.anchor.getNode(),i=r.getKey()===`root`?r:Kf(r,e=>{let t=e.getParent();return t!==null&&Gd(t)});i??=r.getTopLevelElementOrThrow();let a=i.getKey();if(n.getElementByKey(a)!==null){if(q(i)){let t=Rm(r,Ov),n=t?t.getListType():i.getListType();e.pub(mw,n)}else e.pub(mw,``)}})}),hw=Ur(e=>{e.sub(e.pipe(hw,Zr(Wx)),([e,t])=>{t?.dispatchCommand(pw.get(e),void 0)})}),gw=ii({init(e){var t;(t=e.getValue(Ux))==null||t.registerCommand(is,()=>!vw(7),4),e.pubIn({[lC]:`lists`,[ES]:Oe(),[TS]:Ue(),[wS]:[ow,sw],[CS]:[Cv,Ov],[DS]:[cw,lw],[OS]:ge(),[KS]:[uw,fw,dw],[ZS]:[uw,fw,dw]})}});function _w(e){let t=e.getNodes();return t.length===0?new Set([e.anchor.getNode().getParentOrThrow(),e.focus.getNode().getParentOrThrow()]):new Set(t.map(e=>z(e)?e:e.getParentOrThrow()))}function vw(e){let t=R();if(!I(t))return!1;let n=_w(t),r=0;for(let e of n)if(q(e))r=Math.max(lv(e)+1,r);else if(K(e)){let t=e.getParent();if(t?.getChildren().length===1){let e=t.getParent();if(K(e)&&e.getChildren().length===1)return!1}if(!q(t))throw Error(`ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.`);r=Math.max(lv(t)+1,r)}return r<=e}function yw(e){return JSON.stringify(e,(e,t)=>e===`position`&&typeof t==`object`?void 0:t)}function bw(e,t){return yw(e)===yw(t)}var xw=globalThis?.document?k.useLayoutEffect:()=>{},Sw=Object.defineProperty,Cw=(e,t)=>Sw(e,`name`,{value:t,configurable:!0}),ww=!!(typeof window<`u`&&window.document&&window.document.createElement);function Tw(e,t,{checkForDefaultPrevented:n=!0}={}){return Cw(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Cw(Tw,`composeEventHandlers`);function Ew(e){if(!ww)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Cw(Ew,`getOwnerWindow`);function Dw(e){if(!ww)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Cw(Dw,`getOwnerDocument`);function Ow(e,t=!1){let{activeElement:n}=Dw(e);if(!n?.nodeName)return null;if(kw(n)&&n.contentDocument)return Ow(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Dw(n).getElementById(e);if(t)return t}}return n}Cw(Ow,`getActiveElement`);function kw(e){return e.tagName===`IFRAME`}Cw(kw,`isFrame`);var Aw=Object.defineProperty,jw=(e,t)=>Aw(e,`name`,{value:t,configurable:!0});function Mw(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}jw(Mw,`setRef`);function Nw(...e){return t=>{let n=!1,r=e.map(e=>{let r=Mw(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Mw(e[t],null)}}}}jw(Nw,`composeRefs`);function Pw(...e){return k.useCallback(Nw(...e),e)}jw(Pw,`useComposedRefs`);var Fw=Object.defineProperty,Iw=(e,t)=>Fw(e,`name`,{value:t,configurable:!0});function Lw(e,t){let n=k.createContext(t);n.displayName=e+`Context`;let r=Iw(e=>{let{children:t,...r}=e,i=k.useMemo(()=>r,Object.values(r));return(0,A.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=k.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Iw(i,`useContext`),[r,i]}Iw(Lw,`createContext`);function Rw(e,t=[]){let n=[];function r(t,r){let i=k.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Iw(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=k.useMemo(()=>o,Object.values(o));return(0,A.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=k.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Iw(s,`useContext`),[o,s]}Iw(r,`createContext`);let i=Iw(()=>{let t=n.map(e=>k.createContext(e));return Iw(function(n){let r=n?.[e]||t;return k.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,zw(i,...t)]}Iw(Rw,`createContextScope`);function zw(...e){let t=e[0];if(e.length===1)return t;let n=Iw(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Iw(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Iw(zw,`composeContextScopes`);var Bw=Object.defineProperty,Vw=(e,t)=>Bw(e,`name`,{value:t,configurable:!0});function Hw(e){let t=k.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];r=Qw(r),k.Children.forEach(r,e=>{if(Jw(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;for(;Xw(n)&&typeof nT==`function`;)n=nT(n._payload);a=Gw(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=k.cloneElement(a,void 0,s):!o&&k.Children.count(r)===1&&k.isValidElement(r)&&(a=r);let c=a?qw(a):void 0,l=Pw(n,c);if(!a){if(r||r===0)throw Error(o?tT(e):eT(e));return r}let u=Kw(i,a.props??{});return a.type!==k.Fragment&&(u.ref=n?l:c),k.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}Vw(Hw,`createSlot`);var Uw=Symbol.for(`radix.slottable`);function Ww(e){let t=Vw(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Uw,t}Vw(Ww,`createSlottable`);var Gw=Vw((e,t)=>`child`in e.props?k.isValidElement(t)?k.cloneElement(t,void 0,e.props.children(t.props.children)):null:k.isValidElement(t)?t:null,`getSlottableElementFromSlottable`);function Kw(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=$w(a,i))}return{...e,...n}}Vw(Kw,`mergeProps`);function qw(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Vw(qw,`getElementRef`);function Jw(e){return k.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Uw}Vw(Jw,`isSlottable`);var Yw=Symbol.for(`react.lazy`);function Xw(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Yw&&`_payload`in e&&Zw(e._payload)}Vw(Xw,`isLazyComponent`);function Zw(e){return typeof e==`object`&&!!e&&`then`in e}Vw(Zw,`isPromiseLike`);function Qw(e){let t=e;for(;Xw(t)&&typeof nT==`function`;)t=nT(t._payload);return t}Vw(Qw,`useUnwrappedLazy`);function $w(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Vw($w,`concatAriaDescribedby`);var eT=Vw(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),tT=Vw(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),nT=k.use,rT=Object.defineProperty,iT=(e,t)=>rT(e,`name`,{value:t,configurable:!0}),aT=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Hw(`Primitive.${t}`),r=k.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,A.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function oT(e,t){e&&jx.flushSync(()=>e.dispatchEvent(t))}iT(oT,`dispatchDiscreteCustomEvent`);var sT=Object.defineProperty,cT=(e,t)=>sT(e,`name`,{value:t,configurable:!0}),lT=k.useInsertionEffect;function uT(e){let t=k.useRef(e);return typeof lT==`function`?lT(()=>{t.current=e}):xw(()=>{t.current=e}),k.useMemo(()=>((...e)=>t.current?.(...e)),[])}cT(uT,`useCallbackRef`);var dT=Object.defineProperty,fT=(e,t)=>dT(e,`name`,{value:t,configurable:!0}),pT=`dismissableLayer.update`,mT=`dismissableLayer.pointerDownOutside`,hT=`dismissableLayer.focusOutside`,gT,_T=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vT=k.forwardRef(fT(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=k.useContext(_T),[d,f]=k.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=k.useState({}),h=Pw(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=k.useRef(!1),C=xT(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:k.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=ST(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=uT(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return k.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),k.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(gT=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),CT(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=gT))}},[d,p,n,u]),k.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),CT())},[d,u]),k.useEffect(()=>{let e=fT(()=>m({}),`handleUpdate`);return document.addEventListener(pT,e),()=>document.removeEventListener(pT,e)},[]),(0,A.jsx)(aT.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Tw(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Tw(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Tw(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function yT(){let e=k.useContext(_T),[t,n]=k.useState(null);return k.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}fT(yT,`useDismissableLayerSurface`);var bT=fT(()=>!0,`IS_TRUE`);function xT(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=bT}=t,s=uT(e),c=k.useRef(!1),l=k.useRef(!1),u=k.useRef(new Map),d=k.useRef(()=>{});return k.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}fT(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}fT(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}fT(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}fT(p,`handleInteractionBubble`);let m=fT(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||wT(mT,s,p,{discrete:!0})};if(fT(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:fT(()=>c.current=!0,`onPointerDownCapture`)}}fT(xT,`usePointerDownOutside`);function ST(e,t=globalThis?.document){let n=uT(e),r=k.useRef(!1);return k.useEffect(()=>{let e=fT(e=>{e.target&&!r.current&&wT(hT,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:fT(()=>r.current=!0,`onFocusCapture`),onBlurCapture:fT(()=>r.current=!1,`onBlurCapture`)}}fT(ST,`useFocusOutside`);function CT(){let e=new CustomEvent(pT);document.dispatchEvent(e)}fT(CT,`dispatchUpdate`);function wT(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?oT(i,a):i.dispatchEvent(a)}fT(wT,`handleAndDispatchCustomEvent`);var TT=Object.defineProperty,ET=(e,t)=>TT(e,`name`,{value:t,configurable:!0}),DT=0,OT=null;function kT(e){return AT(),e.children}ET(kT,`FocusGuards`);function AT(){k.useEffect(()=>{OT||={start:jT(),end:jT()};let{start:e,end:t}=OT;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),DT++,()=>{DT===1&&(OT?.start.remove(),OT?.end.remove(),OT=null),DT=Math.max(0,DT-1)}},[])}ET(AT,`useFocusGuards`);function jT(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}ET(jT,`createFocusGuard`);var MT=Object.defineProperty,NT=(e,t)=>MT(e,`name`,{value:t,configurable:!0}),PT=`focusScope.autoFocusOnMount`,FT=`focusScope.autoFocusOnUnmount`,IT={bubbles:!1,cancelable:!0},LT=k.forwardRef(NT(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=k.useState(null),u=uT(a),d=uT(o),f=k.useRef(null),p=Pw(t,l),m=k.useRef(i);k.useEffect(()=>{m.current=i});let h=k.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:JT(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||JT(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&JT(c)};NT(e,`handleFocusIn`),NT(t,`handleFocusOut`),NT(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),k.useEffect(()=>{if(c){YT.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(PT,IT);c.addEventListener(PT,u),c.dispatchEvent(t),t.defaultPrevented||(HT(QT(WT(c)),{select:!0}),document.activeElement===e&&JT(c))}return()=>{c.removeEventListener(PT,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(FT,IT);c.addEventListener(FT,d),c.dispatchEvent(r),r.defaultPrevented||JT(e??t.body,{select:!0}),c.removeEventListener(FT,d),YT.remove(g)},0)}}},[c,u,d,g]);let _=k.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=UT(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&JT(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&JT(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,A.jsx)(aT.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),RT=k.createContext(null);function zT({registry:e,children:t}){return e?(0,A.jsx)(RT.Provider,{value:e,children:t}):t}NT(zT,`FocusScopeBranchProvider`);function BT(){let[e,t]=k.useState([]);return{nodes:e,registry:k.useMemo(()=>({add:NT(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:NT(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}NT(BT,`useFocusScopeBranchRegistry`);function VT(e){let t=k.useContext(RT);k.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}NT(VT,`useFocusScopeBranch`);function HT(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(JT(r,{select:t}),document.activeElement!==n)return}NT(HT,`focusFirst`);function UT(e){let t=WT(e);return[GT(t,e),GT(t.reverse(),e)]}NT(UT,`getTabbableEdges`);function WT(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:NT(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}NT(WT,`getTabbableCandidates`);function GT(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):KT(r,{upTo:t})))return r}NT(GT,`findVisible`);function KT(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}NT(KT,`isHidden`);function qT(e){return e.tagName===`INPUT`&&typeof e.select==`function`}NT(qT,`isSelectableInput`);function JT(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&qT(e)&&t&&e.select()}}NT(JT,`focus`);var YT=XT();function XT(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ZT(e,t),e.unshift(t)},remove(t){e=ZT(e,t),e[0]?.resume()}}}NT(XT,`createFocusScopesStack`);function ZT(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}NT(ZT,`arrayRemove`);function QT(e){return e.filter(e=>e.tagName!==`A`)}NT(QT,`removeLinks`);var $T=Object.defineProperty,eE=(e,t)=>$T(e,`name`,{value:t,configurable:!0}),tE=k.useId||(()=>void 0),nE=0;function rE(e){let[t,n]=k.useState(tE());return xw(()=>{e||n(e=>e??String(nE++))},[e]),e||(t?`radix-${t}`:``)}eE(rE,`useId`);var iE=Object.defineProperty,aE=k.forwardRef(((e,t)=>iE(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,A.jsx)(aT.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,A.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),oE=Object.defineProperty,sE=(e,t)=>oE(e,`name`,{value:t,configurable:!0});function cE(e){let[t,n]=k.useState(void 0);return xw(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}sE(cE,`useSize`);var lE=Object.defineProperty,uE=(e,t)=>lE(e,`name`,{value:t,configurable:!0}),dE={Partial:`partial`,Always:`always`},fE={Optimized:`optimized`,Always:`always`},pE=`Popper`,[mE,hE]=Rw(pE),[gE,_E]=mE(pE),vE=uE(e=>{let{__scopePopper:t,children:n}=e,[r,i]=k.useState(null),[a,o]=k.useState(void 0);return(0,A.jsx)(gE,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),yE=`PopperAnchor`,bE=k.forwardRef(uE(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=_E(yE,n),o=k.useRef(null),s=a.onAnchorChange,c=Pw(t,k.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=k.useRef(null);k.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&AE(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,A.jsx)(aT.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),xE=`PopperContent`,[SE,CE]=mE(xE),wE=k.forwardRef(uE(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=dE.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=fE.Optimized,onPlaced:m,...h}=e,g=_E(xE,n),[_,v]=k.useState(null),y=Pw(t,v),[b,x]=k.useState(null),S=cE(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},ee=Array.isArray(l)?l:[l],D=ee.length>0,te={padding:E,boundary:ee.filter(OE),altBoundary:D},{refs:ne,floatingStyles:re,placement:ie,isPositioned:ae,middlewareData:oe}=xt({strategy:`fixed`,placement:T,whileElementsMounted:uE((...e)=>Tt(...e,{animationFrame:p===fE.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[At({mainAxis:i+w,alignmentAxis:o}),c&&yt({mainAxis:!0,crossAxis:!1,...d===dE.Partial?{limiter:wt()}:{},...te}),c&&St({...te}),Et({...te,apply:uE(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&bt({element:b,padding:s}),kE({arrowWidth:C,arrowHeight:w}),f&&Ct(D?{strategy:`referenceHidden`,...te}:{strategy:`referenceHidden`,padding:te.padding,altBoundary:te.altBoundary})]}),se=g.setPlacementState;xw(()=>(se(ie),()=>{se(void 0)}),[ie,se]);let[ce,le]=AE(ie),ue=uT(m);xw(()=>{ae&&ue?.()},[ae,ue]);let de=oe.arrow?.x,fe=oe.arrow?.y,pe=oe.arrow?.centerOffset!==0,[me,he]=k.useState();return xw(()=>{_&&he(window.getComputedStyle(_).zIndex)},[_]),(0,A.jsx)(`div`,{ref:ne.setFloating,"data-radix-popper-content-wrapper":``,style:{...re,transform:ae?re.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:me,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,A.jsx)(SE,{scope:n,placedSide:ce,placedAlign:le,onArrowChange:x,arrowX:de,arrowY:fe,shouldHideArrow:pe,children:(0,A.jsx)(aT.div,{"data-side":ce,"data-align":le,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`)),TE=`PopperArrow`,EE={top:`bottom`,right:`left`,bottom:`top`,left:`right`},DE=k.forwardRef(uE(function(e,t){let{__scopePopper:n,...r}=e,i=CE(TE,n),a=EE[i.placedSide];return(0,A.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,A.jsx)(aE,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function OE(e){return e!==null}uE(OE,`isNotNull`);var kE=uE(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=AE(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function AE(e){let[t,n=`center`]=e.split(`-`);return[t,n]}uE(AE,`getSideAndAlignFromPlacement`);var jE=Object.defineProperty,ME=k.forwardRef(((e,t)=>jE(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=k.useState(!1);xw(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?jx.createPortal((0,A.jsx)(aT.div,{...r,ref:t}),o):null},`Portal`)),NE=Object.defineProperty,PE=(e,t)=>NE(e,`name`,{value:t,configurable:!0});function FE(e,t){return k.useReducer((e,n)=>t[e][n]??e,e)}PE(FE,`useStateMachine`);var IE=PE(e=>{let{present:t,children:n}=e,r=LE(t),i=typeof n==`function`?n({present:r.isPresent}):k.Children.only(n),a=zE(r.ref,VE(i));return typeof n==`function`||r.isPresent?k.cloneElement(i,{ref:a}):null},`Presence`);function LE(e){let[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),a=k.useRef(`none`),o=k.useRef(void 0),[s,c]=FE(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return k.useEffect(()=>{s===`mounted`?(a.current=o.current??BE(r.current),o.current=void 0):a.current=`none`},[s]),xw(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=BE(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),xw(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=PE(a=>{let o=BE(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=PE(e=>{e.target===t&&(a.current=BE(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:k.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=BE(t)}else r.current=null;n(e)},[])}}PE(LE,`usePresence`);function RE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}PE(RE,`setRef`);function zE(...e){let t=k.useRef(e);return t.current=e,k.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=RE(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():RE(n[e],null)}}},[])}PE(zE,`useStableComposedRefs`);function BE(e){return e?.animationName||`none`}PE(BE,`getAnimationName`);function VE(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}PE(VE,`getElementRef`);var HE=Object.defineProperty,UE=(e,t)=>HE(e,`name`,{value:t,configurable:!0}),WE=k.useEffectEvent,GE=k.useInsertionEffect;function KE(e){if(typeof WE==`function`)return WE(e);let t=k.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof GE==`function`?GE(()=>{t.current=e}):xw(()=>{t.current=e}),k.useMemo(()=>((...e)=>t.current?.(...e)),[])}UE(KE,`useEffectEvent`);var qE=Object.defineProperty,JE=(e,t)=>qE(e,`name`,{value:t,configurable:!0}),YE=k.useInsertionEffect||xw;function XE({prop:e,defaultProp:t,onChange:n=JE(()=>{},`onChange`),caller:r}){let[i,a,o]=ZE({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,k.useCallback(t=>{if(s){let n=QE(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}JE(XE,`useControllableState`);function ZE({defaultProp:e,onChange:t}){let[n,r]=k.useState(e),i=k.useRef(n),a=k.useRef(t);return YE(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}JE(ZE,`useUncontrolledState`);function QE(e){return typeof e==`function`}JE(QE,`isFunction`);var $E=Symbol(`RADIX:SYNC_STATE`);function eD(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=KE(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=k.useReducer((t,n)=>{if(n.type===$E)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=k.useRef(p);k.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=k.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return k.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:$E,state:i})},[i,d.state,c]),[h,f]}JE(eD,`useControllableStateReducer`);var tD=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},nD=new WeakMap,rD=new WeakMap,iD={},aD=0,oD=function(e){return e&&(e.host||oD(e.parentNode))},sD=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=oD(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},cD=function(e,t,n,r){var i=sD(t,Array.isArray(e)?e:[e]);iD[n]||(iD[n]=new WeakMap);var a=iD[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(nD.get(e)||0)+1,l=(a.get(e)||0)+1;nD.set(e,c),a.set(e,l),o.push(e),c===1&&i&&rD.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),aD++,function(){o.forEach(function(e){var t=nD.get(e)-1,i=a.get(e)-1;nD.set(e,t),a.set(e,i),t||(rD.has(e)||e.removeAttribute(r),rD.delete(e)),i||e.removeAttribute(n)}),aD--,aD||(nD=new WeakMap,nD=new WeakMap,rD=new WeakMap,iD={})}},lD=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||tD(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),cD(r,i,n,`aria-hidden`)):function(){return null}},uD=function(){return uD=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},uD.apply(this,arguments)};function dD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function fD(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var pD=`right-scroll-bar-position`,mD=`width-before-scroll-bar`,hD=`with-scroll-bars-hidden`,gD=`--removed-body-scroll-bar-size`;function _D(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function vD(e,t){var n=(0,k.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var yD=typeof window<`u`?k.useLayoutEffect:k.useEffect,bD=new WeakMap;function xD(e,t){var n=vD(t||null,function(t){return e.forEach(function(e){return _D(e,t)})});return yD(function(){var t=bD.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||_D(e,null)}),i.forEach(function(e){r.has(e)||_D(e,a)})}bD.set(n,e)},[e]),n}function SD(e){return e}function CD(e,t){t===void 0&&(t=SD);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function wD(e){e===void 0&&(e={});var t=CD(null);return t.options=uD({async:!0,ssr:!1},e),t}var TD=function(e){var t=e.sideCar,n=dD(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return k.createElement(r,uD({},n))};TD.isSideCarExport=!0;function ED(e,t){return e.useMedium(t),TD}var DD=wD(),OD=function(){},kD=k.forwardRef(function(e,t){var n=k.useRef(null),r=k.useState({onScrollCapture:OD,onWheelCapture:OD,onTouchMoveCapture:OD}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=dD(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=xD([n,t]),C=uD(uD({},b),i);return k.createElement(k.Fragment,null,u&&k.createElement(x,{sideCar:DD,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?k.cloneElement(k.Children.only(s),uD(uD({},C),{ref:S})):k.createElement(v,uD({},C,{className:c,ref:S}),s))});kD.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},kD.classNames={fullWidth:mD,zeroRight:pD};var AD=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function jD(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=AD();return t&&e.setAttribute(`nonce`,t),e}function MD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ND(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var PD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=jD())&&(MD(t,n),ND(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FD=function(){var e=PD();return function(t,n){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ID=function(){var e=FD();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},LD={left:0,top:0,right:0,gap:0},RD=function(e){return parseInt(e||``,10)||0},zD=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[RD(n),RD(r),RD(i)]},BD=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return LD;var t=zD(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},VD=ID(),HD=`data-scroll-locked`,UD=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
37
+ .${hD} {
38
+ overflow: hidden ${r};
39
+ padding-right: ${s}px ${r};
40
+ }
41
+ body[${HD}] {
42
+ overflow: hidden ${r};
43
+ overscroll-behavior: contain;
44
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
45
+ padding-left: ${i}px;
46
+ padding-top: ${a}px;
47
+ padding-right: ${o}px;
48
+ margin-left:0;
49
+ margin-top:0;
50
+ margin-right: ${s}px ${r};
51
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
52
+ }
53
+
54
+ .${pD} {
55
+ right: ${s}px ${r};
56
+ }
57
+
58
+ .${mD} {
59
+ margin-right: ${s}px ${r};
60
+ }
61
+
62
+ .${pD} .${pD} {
63
+ right: 0 ${r};
64
+ }
65
+
66
+ .${mD} .${mD} {
67
+ margin-right: 0 ${r};
68
+ }
69
+
70
+ body[${HD}] {
71
+ ${gD}: ${s}px;
72
+ }
73
+ `},WD=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},GD=function(){k.useEffect(function(){return document.body.setAttribute(HD,(WD()+1).toString()),function(){var e=WD()-1;e<=0?document.body.removeAttribute(HD):document.body.setAttribute(HD,e.toString())}},[])},KD=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;GD();var a=k.useMemo(function(){return BD(i)},[i]);return k.createElement(VD,{styles:UD(a,!t,i,n?``:`!important`)})},qD=!1;if(typeof window<`u`)try{var JD=Object.defineProperty({},"passive",{get:function(){return qD=!0,!0}});window.addEventListener(`test`,JD,JD),window.removeEventListener(`test`,JD,JD)}catch{qD=!1}var YD=qD?{passive:!1}:!1,XD=function(e){return e.tagName===`TEXTAREA`},ZD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!XD(e)&&n[t]===`visible`)},QD=function(e){return ZD(e,`overflowY`)},$D=function(e){return ZD(e,`overflowX`)},eO=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rO(e,r)){var i=iO(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tO=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nO=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rO=function(e,t){return e===`v`?QD(t):$D(t)},iO=function(e,t){return e===`v`?tO(t):nO(t)},aO=function(e,t){return e===`h`&&t===`rtl`?-1:1},oO=function(e,t,n,r,i){var a=aO(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=iO(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rO(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sO=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cO=function(e){return[e.deltaX,e.deltaY]},lO=function(e){return e&&`current`in e?e.current:e},uO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dO=function(e){return`
74
+ .block-interactivity-${e} {pointer-events: none;}
75
+ .allow-interactivity-${e} {pointer-events: all;}
76
+ `},fO=0,pO=[];function mO(e){var t=k.useRef([]),n=k.useRef([0,0]),r=k.useRef(),i=k.useState(fO++)[0],a=k.useState(ID)[0],o=k.useRef(e);k.useEffect(function(){o.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fD([e.lockRef.current],(e.shards||[]).map(lO),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=k.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sO(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=eO(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=eO(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return oO(h,t,e,h===`h`?s:c,!0)},[]),c=k.useCallback(function(e){var n=e;if(pO.length&&pO[pO.length-1]===a){var r=`deltaY`in n?cO(n):sO(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&uO(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(lO).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=k.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hO(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=k.useCallback(function(e){n.current=sO(e),r.current=void 0},[]),d=k.useCallback(function(t){l(t.type,cO(t),t.target,s(t,e.lockRef.current))},[]),f=k.useCallback(function(t){l(t.type,sO(t),t.target,s(t,e.lockRef.current))},[]);k.useEffect(function(){return pO.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,YD),document.addEventListener(`touchmove`,c,YD),document.addEventListener(`touchstart`,u,YD),function(){pO=pO.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,YD),document.removeEventListener(`touchmove`,c,YD),document.removeEventListener(`touchstart`,u,YD)}},[]);var p=e.removeScrollBar,m=e.inert;return k.createElement(k.Fragment,null,m?k.createElement(a,{styles:dO(i)}):null,p?k.createElement(KD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gO=ED(DD,mO),_O=k.forwardRef(function(e,t){return k.createElement(kD,uD({},e,{ref:t,sideCar:gO}))});_O.classNames=kD.classNames;var vO=Object.defineProperty,yO=(e,t)=>vO(e,`name`,{value:t,configurable:!0}),bO=`Popover`,[xO,SO]=Rw(bO,[hE]),CO=hE(),[wO,TO]=xO(bO),EO=yO(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=CO(t),c=k.useRef(null),[l,u]=k.useState(!1),[d,f]=k.useState(0),[p,m]=k.useState(0),[h,g]=XE({prop:r,defaultProp:i??!1,onChange:a,caller:bO});return(0,A.jsx)(vE,{...s,children:(0,A.jsx)(wO,{scope:t,contentId:rE(),titleId:rE(),descriptionId:rE(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:k.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:k.useCallback(()=>u(!0),[]),onCustomAnchorRemove:k.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),DO=`PopoverTrigger`,OO=k.forwardRef(yO(function(e,t){let{__scopePopover:n,...r}=e,i=TO(DO,n),a=CO(n),o=Pw(t,i.triggerRef),s=(0,A.jsx)(aT.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":BO(i.open),...r,ref:o,onClick:Tw(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,A.jsx)(bE,{asChild:!0,...a,children:s})},`PopoverTrigger`)),kO=`PopoverPortal`,[AO,jO]=xO(kO,{forceMount:void 0}),MO=yO(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=TO(kO,t);return(0,A.jsx)(AO,{scope:t,forceMount:n,children:(0,A.jsx)(IE,{present:n||a.open,children:(0,A.jsx)(ME,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),NO=`PopoverContent`,PO=k.forwardRef(yO(function(e,t){let n=jO(NO,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=TO(NO,e.__scopePopover);return(0,A.jsx)(IE,{present:r||a.open,children:a.modal?(0,A.jsx)(IO,{...i,ref:t}):(0,A.jsx)(LO,{...i,ref:t})})},`PopoverContent`)),FO=Hw(`PopoverContent.RemoveScroll`),IO=k.forwardRef(yO(function(e,t){let n=TO(NO,e.__scopePopover),r=k.useRef(null),i=Pw(t,r),a=k.useRef(!1),{nodes:o,registry:s}=BT();return k.useEffect(()=>{let e=r.current;if(e)return lD(e)},[]),(0,A.jsx)(_O,{as:FO,allowPinchZoom:!0,shards:k.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,A.jsx)(RO,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tw(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Tw(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Tw(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),LO=k.forwardRef(yO(function(e,t){let n=TO(NO,e.__scopePopover),r=k.useRef(!1),i=k.useRef(!1);return(0,A.jsx)(RO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),RO=k.forwardRef(yO(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=TO(NO,n),g=CO(n),[_,v]=k.useState(null),y=Pw(t,v);return VT(_),AT(),(0,A.jsx)(zT,{registry:p,children:(0,A.jsx)(LT,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,A.jsx)(vT,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,A.jsx)(wE,{"data-state":BO(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?VO(d,h.descriptionId):d,...g,...m,ref:y,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),zO=k.forwardRef(yO(function(e,t){let{__scopePopover:n,...r}=e,i=CO(n);return(0,A.jsx)(DE,{...i,...r,ref:t})},`PopoverArrow`));function BO(e){return e?`open`:`closed`}yO(BO,`getState`);function VO(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}yO(VO,`concatAriaDescribedby`);var HO=Object.defineProperty,UO=(e,t)=>HO(e,`name`,{value:t,configurable:!0});function WO(e){let t=e+`CollectionProvider`,[n,r]=Rw(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=UO(e=>{let{scope:t,children:n}=e,r=k.useRef(null),a=k.useRef(new Map).current;return(0,A.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Hw(s),l=k.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Pw(t,a(s,n).collectionRef);return(0,A.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Hw(u),p=k.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=k.useRef(null),s=Pw(t,o),c=a(u,n);return k.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,A.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return k.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return UO(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}UO(WO,`createCollection`);var GO=new WeakMap,KO=class e extends Map{static{UO(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],GO.set(this,!0)}set(e,t){return GO.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=YO(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=qO(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=qO(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return qO(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function qO(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=JO(e,t);return n===-1?void 0:e[n]}UO(qO,`at`);function JO(e,t){let n=e.length,r=YO(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}UO(JO,`toSafeIndex`);function YO(e){return e!==e||e===0?0:Math.trunc(e)}UO(YO,`toSafeInteger`);function XO(e){let t=e+`CollectionProvider`,[n,r]=Rw(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=UO(({state:e,...t})=>e?(0,A.jsx)(u,{...t,state:e}):(0,A.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=UO(e=>{let t=_();return(0,A.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=UO(e=>{let{scope:t,children:n,state:r}=e,a=k.useRef(null),[s,c]=k.useState(null),l=Pw(a,c),[u,d]=r,f=k.useRef(new KO),p=k.useCallback(()=>{let e=f.current;return $O(e)||e.sort(ek),e},[]);return k.useEffect(()=>{if(!s)return;let e=tk(()=>{d(e=>{let t=e.toSorted(ek);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,A.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,A.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=Hw(d),p=k.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Pw(t,a(d,n).collectionElementRef);return(0,A.jsx)(f,{ref:i,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,h=Hw(m),g=k.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=k.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=k.useRef(i);ZO(l.current,i)||(l.current=i);let u=l.current,d=Pw(t,k.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),o);xw(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let f=k.useRef(null);return k.useEffect(()=>{let e=o.current,t=f.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(f.current=e?{element:e,itemData:u}:null,s(n=>{let r=new KO(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(ek)}))}),k.useEffect(()=>()=>{let e=f.current;f.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new KO(t);return n.delete(e.element),n})},[s]),(0,A.jsx)(h,{"data-radix-collection-item":``,ref:d,children:r})});g.displayName=m;function _(){return k.useState(new KO)}UO(_,`useInitCollection`);function v(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}UO(v,`useCollection`);function y(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return UO(y,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:g},{createCollectionScope:r,useCollection:v,useGetCollection:y,useInitCollection:_}]}UO(XO,`createCollection`);function ZO(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}UO(ZO,`shallowEqual`);function QO(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}UO(QO,`isElementPreceding`);function $O(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}UO($O,`isInDocumentOrder`);function ek(e,t){return!e[1].element||!t[1].element?0:QO(e[1].element,t[1].element)?-1:1}UO(ek,`sortByDocumentPosition`);function tk(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}UO(tk,`getChildListObserver`);var nk=Object.defineProperty,rk=(e,t)=>nk(e,`name`,{value:t,configurable:!0}),ik={LTR:`ltr`,RTL:`rtl`},ak=k.createContext(void 0);function ok(e){let t=k.useContext(ak);return e||t||ik.LTR}rk(ok,`useDirection`);var sk=Object.defineProperty,ck=(e,t)=>sk(e,`name`,{value:t,configurable:!0}),lk=!1;function uk(){let[e,t]=k.useState(lk);return k.useEffect(()=>{lk||(lk=!0,t(!0))},[]),e}ck(uk,`useIsHydrated`);var dk=k.useSyncExternalStore;function fk(){return()=>{}}ck(fk,`subscribe`);function pk(){return dk(fk,()=>!0,()=>!1)}ck(pk,`useIsHydratedModern`);var mk=typeof dk==`function`?pk:uk,hk=Object.defineProperty,gk=(e,t)=>hk(e,`name`,{value:t,configurable:!0}),_k=`rovingFocusGroup.onEntryFocus`,vk={bubbles:!1,cancelable:!0},yk=`RovingFocusGroup`,[bk,xk,Sk]=WO(yk),[Ck,wk]=Rw(yk,[Sk]),Tk={Vertical:`vertical`,Horizontal:`horizontal`},Ek={LTR:`ltr`,RTL:`rtl`},[Dk,Ok]=Ck(yk),kk=k.forwardRef(gk(function(e,t){return(0,A.jsx)(bk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(bk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(Ak,{...e,ref:t})})})},`RovingFocusGroup`)),Ak=k.forwardRef(gk(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=k.useRef(null),p=Pw(t,f),m=ok(a),[h,g]=XE({prop:o,defaultProp:s??null,onChange:c,caller:yk}),[_,v]=k.useState(!1),y=uT(l),b=xk(n),x=k.useRef(!1),[S,C]=k.useState(0);return k.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(_k,y),()=>e.removeEventListener(_k,y)},[y]),(0,A.jsx)(Dk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:k.useCallback(e=>g(e),[g]),onItemShiftTab:k.useCallback(()=>v(!0),[]),onFocusableItemAdd:k.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:k.useCallback(()=>C(e=>e-1),[]),children:(0,A.jsx)(aT.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Tw(e.onMouseDown,()=>{x.current=!0}),onFocus:Tw(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(_k,vk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Ik([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:Tw(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),jk=`RovingFocusGroupItem`,Mk=k.forwardRef(gk(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=rE(),l=a||c,u=Ok(jk,n),d=u.currentTabStopId===l,f=xk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=mk();return xw(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),k.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,A.jsx)(bk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,A.jsx)(aT.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Tw(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Tw(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Tw(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Fk(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Lk(n,r+1):n.slice(r+1)}setTimeout(()=>Ik(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),Nk={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Pk(e,t){return t===Ek.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}gk(Pk,`getDirectionAwareKey`);function Fk(e,t,n){let r=Pk(e.key,n);if(!(t===Tk.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Tk.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Nk[r]}gk(Fk,`getFocusIntent`);function Ik(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}gk(Ik,`focusFirst`);function Lk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}gk(Lk,`wrapArray`);var Rk=Object.defineProperty,zk=(e,t)=>Rk(e,`name`,{value:t,configurable:!0}),Bk={Horizontal:`horizontal`,Vertical:`vertical`},Vk=Bk.Horizontal,Hk=Object.values(Bk),Uk=k.forwardRef(zk(function(e,t){let{decorative:n,orientation:r=Vk,...i}=e,a=Wk(r)?r:Vk,o=a===Bk.Vertical?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,A.jsx)(aT.div,{"data-orientation":a,...s,...i,ref:t})},`Separator`));function Wk(e){return Hk.includes(e)}zk(Wk,`isValidOrientation`);var Gk=Object.defineProperty,Kk=(e,t)=>Gk(e,`name`,{value:t,configurable:!0}),qk=`Toggle`,Jk=k.forwardRef(Kk(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=XE({prop:n,onChange:i,defaultProp:r??!1,caller:qk});return(0,A.jsx)(aT.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Tw(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Yk=Object.defineProperty,Xk=(e,t)=>Yk(e,`name`,{value:t,configurable:!0}),Zk=`ToggleGroup`,Qk={Single:`single`,Multiple:`multiple`},[$k,eA]=Rw(Zk,[wk]),tA=wk(),nA=k.forwardRef(Xk(function(e,t){let{type:n,...r}=e;if(n===Qk.Single)return(0,A.jsx)(aA,{role:`radiogroup`,...r,ref:t});if(n===Qk.Multiple)return(0,A.jsx)(oA,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Zk}\``)},`ToggleGroup`)),[rA,iA]=$k(Zk),aA=k.forwardRef(Xk(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Xk(()=>{},`onValueChange`),...a}=e,[o,s]=XE({prop:n,defaultProp:r??``,onChange:i,caller:Zk});return(0,A.jsx)(rA,{scope:e.__scopeToggleGroup,type:Qk.Single,value:k.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:k.useCallback(()=>s(``),[s]),children:(0,A.jsx)(lA,{...a,ref:t})})},`ToggleGroupImplSingle`)),oA=k.forwardRef(Xk(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Xk(()=>{},`onValueChange`),...a}=e,[o,s]=XE({prop:n,defaultProp:r??[],onChange:i,caller:Zk}),c=k.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=k.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,A.jsx)(rA,{scope:e.__scopeToggleGroup,type:Qk.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,A.jsx)(lA,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[sA,cA]=$k(Zk),lA=k.forwardRef(Xk(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=tA(n),u=ok(o),d={dir:u,...c};return(0,A.jsx)(sA,{scope:n,rovingFocus:i,disabled:r,children:i?(0,A.jsx)(kk,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,A.jsx)(aT.div,{...d,ref:t})}):(0,A.jsx)(aT.div,{...d,ref:t})})},`ToggleGroupImpl`)),uA=`ToggleGroupItem`,dA=k.forwardRef(Xk(function(e,t){let n=iA(uA,e.__scopeToggleGroup),r=cA(uA,e.__scopeToggleGroup),i=tA(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=k.useRef(null);return r.rovingFocus?(0,A.jsx)(Mk,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,A.jsx)(fA,{...s,ref:t})}):(0,A.jsx)(fA,{...s,ref:t})},`ToggleGroupItem`)),fA=k.forwardRef(Xk(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=iA(uA,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===Qk.Single?o:void 0;return(0,A.jsx)(Jk,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),pA=Object.defineProperty,mA=(e,t)=>pA(e,`name`,{value:t,configurable:!0}),hA=`Toolbar`,[gA,_A]=Rw(hA,[wk,eA]),vA=wk(),yA=eA(),[bA,xA]=gA(hA),SA=k.forwardRef(mA(function(e,t){let{__scopeToolbar:n,orientation:r=`horizontal`,dir:i,loop:a=!0,...o}=e,s=vA(n),c=ok(i);return(0,A.jsx)(bA,{scope:n,orientation:r,dir:c,children:(0,A.jsx)(kk,{asChild:!0,...s,orientation:r,dir:c,loop:a,children:(0,A.jsx)(aT.div,{role:`toolbar`,"aria-orientation":r,dir:c,...o,ref:t})})})},`Toolbar`)),CA=`ToolbarSeparator`,wA=k.forwardRef(mA(function(e,t){let{__scopeToolbar:n,...r}=e,i=xA(CA,n);return(0,A.jsx)(Uk,{orientation:i.orientation===`horizontal`?`vertical`:`horizontal`,...r,ref:t})},`ToolbarSeparator`)),TA=k.forwardRef(mA(function(e,t){let{__scopeToolbar:n,...r}=e,i=vA(n);return(0,A.jsx)(Mk,{asChild:!0,...i,focusable:!e.disabled,children:(0,A.jsx)(aT.button,{type:`button`,...r,ref:t})})},`ToolbarButton`)),EA=`ToolbarToggleGroup`,DA=k.forwardRef(mA(function(e,t){let{__scopeToolbar:n,...r}=e,i=xA(EA,n),a=yA(n);return(0,A.jsx)(nA,{"data-orientation":i.orientation,dir:i.dir,...a,...r,ref:t,rovingFocus:!1})},`ToolbarToggleGroup`)),OA=k.forwardRef(mA(function(e,t){let{__scopeToolbar:n,...r}=e,i=yA(n),a={__scopeToolbar:e.__scopeToolbar};return(0,A.jsx)(TA,{asChild:!0,...a,children:(0,A.jsx)(dA,{...i,...r,ref:t})})},`ToolbarToggleItem`));function kA(e,t){return e===null||e===t?!1:e.dataset.editorDialog!==void 0||e.dataset.toolbarItem!==void 0||e.dataset.editorDropdown?!0:kA(e.parentElement,t)}function AA(){let e=[...Array(256).keys()].map(e=>e.toString(16).padStart(2,`0`)),t=crypto.getRandomValues(new Uint8Array(16));return t[6]=t[6]&15|64,t[8]=t[8]&63|128,[...t.entries()].map(([t,n])=>[4,6,8,10].includes(t)?`-${e[n]}`:e[n]).join(``)}var jA=e=>e===0?`th`:`td`,MA={center:J.centeredCell,left:J.leftAlignedCell,right:J.rightAlignedCell};function NA(e){let t=H(e);return KA(t)?t:null}function PA(e){let t=R();if(!I(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=e?0:z(n)?n.getChildrenSize():n.getTextContentSize();if(t.anchor.offset!==r)return!1;for(;n!==null&&!fu(n);){if((e?n.getPreviousSibling():n.getNextSibling())!==null)return!1;n=n.getParent()}return!0}var FA=({mdastNode:e,parentEditor:t,lexicalTable:n})=>{let r=n.getKey(),[i,a]=k.useState(null),[o,s]=Jr(zS,qx),c=k.useMemo(()=>e=>(e.__cacheKey??=AA(),e.__cacheKey),[]),l=k.useCallback(e=>{let[n,i]=t.getEditorState().read(()=>{let e=NA(r);return e?[e.getColCount(),e.getRowCount()]:[0,0]});if(e===null){a(null);return}let[o,s]=e;o>n-1&&(o=0,s++),o<0&&(o=n-1,--s),s>i-1?(a(null),t.update(()=>{let e=NA(r);if(e){if(e.getNextSibling())e.selectNext();else{let t=V();e.insertAfter(t),t.select()}}})):s<0?(a(null),t.update(()=>{var e;(e=NA(r))==null||e.selectPrevious()})):a([o,s])},[t,r]);k.useEffect(()=>{n.focusEmitter.subscribe(l)},[n,l]);let u=k.useCallback(e=>{e.preventDefault();let n=null;t.update(()=>{let e=NA(r);e&&(n=[0,e.getRowCount()],e.addRowToBottom())},{onUpdate:()=>{n&&a(n)}})},[t,r]),d=k.useCallback(e=>{e.preventDefault();let n=null;t.update(()=>{let e=NA(r);e&&(n=[e.getColCount(),0],e.addColumnToRight())},{onUpdate:()=>{n&&a(n)}})},[t,r]),[f,p]=k.useState([-1,-1]),m=k.useCallback(e=>{let t=e.target;for(;t&&![`TH`,`TD`].includes(t.tagName);){if(t===e.currentTarget)return;t=t.parentElement}if(t===null)return;let n=t.parentElement,r=n.parentElement.tagName===`TFOOT`?-1:Array.from(n.children).indexOf(t),i=t.tagName===`TH`?-1:Array.from(n.parentElement.children).indexOf(n);p([r,i])},[]),h=pC();return k.createElement(`table`,{className:J.tableEditor,onMouseOver:m,onMouseLeave:()=>{p([-1,-1])}},k.createElement(`colgroup`,null,s?null:k.createElement(`col`,null),Array.from({length:e.children[0].children.length},(t,n)=>{let r=MA[(e.align??[])[n]??`left`];return k.createElement(`col`,{key:n,className:r})}),s?null:k.createElement(`col`,null)),s||k.createElement(`thead`,null,k.createElement(`tr`,null,k.createElement(`th`,{className:J.tableToolsColumn}),Array.from({length:e.children[0].children.length},(r,i)=>k.createElement(`th`,{key:i,"data-tool-cell":!0},k.createElement(RA,{setActiveCellWithBoundaries:l,parentEditor:t,colIndex:i,highlightedCoordinates:f,lexicalTable:n,align:(e.align??[])[i]}))),k.createElement(`th`,{className:J.tableToolsColumn,"data-tool-cell":!0},k.createElement(`button`,{className:J.iconButton,type:`button`,title:h(`table.deleteTable`,`Delete table`),onClick:e=>{e.preventDefault(),t.update(()=>{let e=NA(r);e&&(e.selectNext(),e.remove())})}},o(`delete_small`))))),k.createElement(`tbody`,null,e.children.map((r,a)=>{let u=jA(a);return k.createElement(`tr`,{key:a},s||k.createElement(u,{className:J.toolCell,"data-tool-cell":!0},k.createElement(zA,{setActiveCellWithBoundaries:l,parentEditor:t,rowIndex:a,highlightedCoordinates:f,lexicalTable:n})),r.children.map((r,o)=>k.createElement(IA,{align:e.align?.[o],key:c(r),contents:r.children,setActiveCell:l,rowIndex:a,colIndex:o,lexicalTable:n,parentEditor:t,activeCell:s?[-1,-1]:i})),s||a===0&&k.createElement(`th`,{rowSpan:n.getRowCount(),"data-tool-cell":!0},k.createElement(`button`,{type:`button`,className:J.addColumnButton,onClick:d},o(`add_column`))))})),s||k.createElement(`tfoot`,null,k.createElement(`tr`,null,k.createElement(`th`,null),k.createElement(`th`,{colSpan:n.getColCount(),"data-tool-cell":!0},k.createElement(`button`,{type:`button`,className:J.addRowButton,onClick:u},o(`add_row`))),k.createElement(`th`,null))))},IA=({align:e,...t})=>{let{activeCell:n,setActiveCell:r}=t,i=n?.[0]===t.colIndex&&n[1]===t.rowIndex,a=MA[e??`left`],o=jA(t.rowIndex);return k.createElement(o,{className:a,"data-active":i,onClick:()=>{r([t.colIndex,t.rowIndex])}},k.createElement(LA,{...t,focus:i}))},LA=({focus:e,setActiveCell:t,parentEditor:n,lexicalTable:r,contents:i,colIndex:a,rowIndex:o})=>{let s=r.getKey(),[c,l,u,d,f,p,m,h,g,_]=Jr(sS,dS,cS,hS,_S,vS,yS,mS,Ux,QS),[v,y]=k.useState(null);k.useEffect(()=>{let e=Bx({name:`@mdxeditor/table-cell`,nodes:u,namespace:`TableCellEditor`,parentEditor:n,historyMode:`table-local`,initialEditorState:()=>{jb({root:U(),mdastRoot:{type:`root`,children:[{type:`paragraph`,children:i}]},visitors:c,jsxComponentDescriptors:d,directiveDescriptors:f,codeBlockEditorDescriptors:p,defaultCodeBlockLanguage:m})}});return y(e),()=>{e.dispose()}},[]);let b=k.useRef(i);k.useEffect(()=>{if(!v||bw(b.current,i)||(b.current=i,bw(v.getEditorState().read(()=>ab({root:U(),jsxComponentDescriptors:d,visitors:l,jsxIsAvailable:h,addImportStatements:!1}).children.find(e=>e.type===`paragraph`)?.children??[]),i)))return;v.update(()=>{jb({root:U().clear(),mdastRoot:{type:`root`,children:[{type:`paragraph`,children:i}]},visitors:c,jsxComponentDescriptors:d,directiveDescriptors:f,codeBlockEditorDescriptors:p,defaultCodeBlockLanguage:m})},{discrete:!0,tag:[ic,cc]});let e=xm(v.registerCommand(_s,()=>!0,4),v.registerCommand(gs,()=>!0,4));try{v.dispatchCommand(hs,void 0)}finally{e()}},[v,i,l,c,d,h,f,p,m]);let x=k.useCallback(()=>{v&&v.getEditorState().read(()=>{let e=ab({root:U(),jsxComponentDescriptors:d,visitors:l,jsxIsAvailable:h,addImportStatements:!1}).children.find(e=>e.type===`paragraph`)?.children??[],t=n.getEditorState().read(()=>(NA(s)?.getMdastNode().children[o])?.children[a]?.children);bw(t,b.current)&&!bw(t,e)&&(n.update(()=>{let t=NA(s);t&&(t.updateCellContents(a,o,e),b.current=e)},{discrete:!0,tag:cc}),n.dispatchCommand(Hx,void 0))})},[a,v,l,d,h,n,o,s]),S=k.useCallback(e=>{x(),t(e)},[x,t]);return k.useEffect(()=>{if(v)return xm(v.registerCommand(ns,e=>{e.preventDefault();let t=e.shiftKey?[a-1,o]:[a+1,o];return S(t),!0},4),v.registerCommand(vs,()=>(t([a,o]),!1),1),v.registerCommand(Zo,e=>{e?.preventDefault();let t=e?.shiftKey?[a,o-1]:[a,o+1];return S(t),!0},4),v.registerCommand(Mo,PA,4),v.registerCommand(Ro,PA,4),v.registerCommand(zo,PA,4),v.registerCommand(ys,e=>{let t=e.relatedTarget;return!kA(t,g.getRootElement())&&(S(null),!0)},0),v.registerCommand(Hx,()=>(e?S(null):x(),!0),0))},[a,v,e,g,o,x,S,t]),k.useEffect(()=>{e&&v&&v.focus()},[e,v]),v?k.createElement(mC,{initialEditor:v},k.createElement(CC,{contentEditable:k.createElement(Tx,null),placeholder:k.createElement(`div`,null),ErrorBoundary:kx}),_.map((e,t)=>k.createElement(e,{key:t}))):null},RA=({parentEditor:e,highlightedCoordinates:t,align:n,lexicalTable:r,colIndex:i,setActiveCellWithBoundaries:a})=>{let o=r.getKey(),[s,c]=Jr(bS,zS),l=k.useCallback(t=>{let n=!1;e.update(()=>{let e=NA(o);e&&(e.insertColumnAt(t),n=!0)},{onUpdate:()=>{n&&a([t,0])}})},[e,a,o]),u=k.useCallback(t=>{e.update(()=>{var e;(e=NA(o))==null||e.deleteColumnAt(t)})},[e,o]),d=k.useCallback((t,n)=>{e.update(()=>{var e;(e=NA(o))==null||e.setColumnAlign(t,n)})},[e,o]),f=pC();return k.createElement(EO,null,k.createElement(OO,{className:J.tableColumnEditorTrigger,"data-active":t[0]===i+1,title:f(`table.columnMenu`,`Column menu`)},c(`more_horiz`)),k.createElement(MO,{container:s?.current},k.createElement(PO,{className:(0,OC.default)(J.tableColumnEditorPopoverContent),onOpenAutoFocus:e=>{e.preventDefault()},sideOffset:5,side:`top`},k.createElement(SA,{className:J.tableColumnEditorToolbar},k.createElement(DA,{className:J.toggleGroupRoot,onValueChange:e=>{d(i,e)},value:n??`left`,type:`single`,"aria-label":f(`table.textAlignment`,`Text alignment`)},k.createElement(OA,{value:`left`,title:f(`table.alignLeft`,`Align left`)},c(`format_align_left`)),k.createElement(OA,{value:`center`,title:f(`table.alignCenter`,`Align center`)},c(`format_align_center`)),k.createElement(OA,{value:`right`,title:f(`table.alignRight`,`Align right`)},c(`format_align_right`))),k.createElement(wA,null),k.createElement(TA,{onClick:l.bind(null,i),title:f(`table.insertColumnLeft`,`Insert a column to the left of this one`)},c(`insert_col_left`)),k.createElement(TA,{onClick:l.bind(null,i+1),title:f(`table.insertColumnRight`,`Insert a column to the right of this one`)},c(`insert_col_right`)),k.createElement(TA,{onClick:u.bind(null,i),title:f(`table.deleteColumn`,`Delete this column`)},c(`delete_small`))),k.createElement(zO,{className:J.popoverArrow}))))},zA=({parentEditor:e,highlightedCoordinates:t,lexicalTable:n,rowIndex:r,setActiveCellWithBoundaries:i})=>{let a=n.getKey(),[o,s]=Jr(bS,zS),c=k.useCallback(t=>{let n=!1;e.update(()=>{let e=NA(a);e&&(e.insertRowAt(t),n=!0)},{onUpdate:()=>{n&&i([0,t])}})},[e,i,a]),l=k.useCallback(t=>{e.update(()=>{var e;(e=NA(a))==null||e.deleteRowAt(t)})},[e,a]),u=pC();return k.createElement(EO,null,k.createElement(OO,{className:J.tableColumnEditorTrigger,"data-active":t[1]===r,title:u(`table.rowMenu`,`Row menu`)},s(`more_horiz`)),k.createElement(MO,{container:o?.current},k.createElement(PO,{className:(0,OC.default)(J.tableColumnEditorPopoverContent),onOpenAutoFocus:e=>{e.preventDefault()},sideOffset:5,side:`bottom`},k.createElement(SA,{className:J.tableColumnEditorToolbar},k.createElement(TA,{onClick:c.bind(null,r),title:u(`table.insertRowAbove`,`Insert a row above this one`)},s(`insert_row_above`)),k.createElement(TA,{onClick:c.bind(null,r+1),title:u(`table.insertRowBelow`,`Insert a row below this one`)},s(`insert_row_below`)),k.createElement(TA,{onClick:l.bind(null,r),title:u(`table.deleteRow`,`Delete this row`)},s(`delete_small`))),k.createElement(zO,{className:J.popoverArrow}))))},BA=Object.defineProperty,VA=(e,t,n)=>t in e?BA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HA=(e,t,n)=>VA(e,typeof t==`symbol`?t:t+``,n),UA={type:`tableCell`,children:[]};function WA(){let e=Mb;return{publish:t=>{e(t)},subscribe:t=>{e=t}}}var GA=class e extends uu{constructor(e,t){super(t),HA(this,`__mdastNode`),HA(this,`focusEmitter`,WA()),this.__mdastNode=e??{type:`table`,children:[]}}static getType(){return`table`}static clone(t){return new e(structuredClone(t.__mdastNode),t.__key)}static importJSON(e){return qA(e.mdastNode)}static importDOM(){return{table:()=>({conversion:JA,priority:3})}}exportJSON(){return{mdastNode:structuredClone(this.__mdastNode),type:`table`,version:1}}getMdastNode(){return this.__mdastNode}getRowCount(){return this.__mdastNode.children.length}getColCount(){return this.__mdastNode.children[0]?.children.length||0}createDOM(){return document.createElement(`div`)}updateDOM(){return!1}updateCellContents(e,t,n){let r=this.getLatest().__mdastNode.children[t].children[e].children;if(bw(r,n))return;let i=this.getWritable().__mdastNode,a=i.children[t],o=a.children,s=o[e],c=Array.from(o),l={...s,children:n},u={...a,children:c};c[e]=l,i.children[t]=u}insertColumnAt(e){let t=this.getWritable().__mdastNode;for(let n=0;n<t.children.length;n++){let r=t.children[n],i=r.children,a=Array.from(i),o={...r,children:a};a.splice(e,0,structuredClone(UA)),t.children[n]=o}t.align&&t.align.length>0&&t.align.splice(e,0,`left`)}deleteColumnAt(e){let t=this.getWritable().__mdastNode;for(let n=0;n<t.children.length;n++){let r=t.children[n],i=r.children,a=Array.from(i),o={...r,children:a};a.splice(e,1),t.children[n]=o}}insertRowAt(e){let t=this.getWritable().__mdastNode,n={type:`tableRow`,children:Array.from({length:this.getColCount()},()=>structuredClone(UA))};t.children.splice(e,0,n)}deleteRowAt(e){this.getRowCount()===1?(this.selectNext(),this.remove()):this.getWritable().__mdastNode.children.splice(e,1)}addRowToBottom(){this.insertRowAt(this.getRowCount())}addColumnToRight(){this.insertColumnAt(this.getColCount())}setColumnAlign(e,t){let n=this.getWritable().__mdastNode;n.align??=[],n.align[e]=t}decorate(e){return k.createElement(FA,{lexicalTable:this,mdastNode:this.__mdastNode,parentEditor:e})}select(e){this.focusEmitter.publish(e??[0,0])}isInline(){return!1}};function KA(e){return e instanceof GA}function qA(e){return new GA(e)}function JA(e){let t=e.querySelectorAll(`tr`);return{node:new GA({type:`table`,children:Array.from(t).map(e=>({type:`tableRow`,children:Array.from(e.querySelectorAll(`td, th`)).map(e=>({type:`tableCell`,children:[{type:`text`,value:e.textContent}]}))}))})}}var YA={testLexicalNode:KA,visitLexicalNode({actions:e,mdastParent:t,lexicalNode:n}){e.appendToParent(t,n.getMdastNode())}},XA={testNode:`table`,visitNode({mdastNode:e,lexicalParent:t}){t.append(qA(e))}};function ZA(e=1,t=1){let n={type:`table`,children:[]};for(let r=0;r<e;r++){let e={type:`tableRow`,children:[]};for(let n=0;n<t;n++)e.children.push({type:`tableCell`,children:[]});n.children.push(e)}return n}var QA=Ur(e=>{e.link(e.pipe(QA,Xr(({rows:e,columns:t})=>()=>qA(ZA(e,t)))),aC)}),$A=ii({init(e,t){e.pubIn({[ES]:we(),[TS]:he(),[wS]:XA,[CS]:GA,[DS]:YA,[OS]:Le({tableCellPadding:t?.tableCellPadding??!0,tablePipeAlign:t?.tablePipeAlign??!0})})}}),ej=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),tj=class e extends cu{__url;__target;__rel;__title;static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){let t=of().createElement(`a`);return this.updateLinkDOM(null,t,e),ym(t,e.theme.link),t}updateLinkDOM(e,t,n){if(gf(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:aj,priority:1})}}static importJSON(e){return oj().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){let t=e;e=hj(e);try{let t=new URL(hj(e));if(!ej.has(t.protocol))return`about:blank`}catch{let e=t.replace(/[\u0000-\u001F\u007F\s]/g,``).match(/^([a-z][a-z0-9+.-]*):/i);if(e!=null&&!ej.has(`${e[1].toLowerCase()}:`))return`about:blank`}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=Kd(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!I(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return(this.is(r)||this.isParentOf(r))&&(this.is(i)||this.isParentOf(i))&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function nj(e){let t=Yp(e,`next`);return[t,t.getFlipped()]}function rj(e,t){for(let n of t)if(n.origin.isAttached()){Xp(e,im(n));return}}function ij(e){let t=R(),n=null,r=null;function i(){I(t)&&(rj(t.anchor,n),rj(t.focus,r),Ea(t))}I(t)&&(n=nj(t.anchor),r=nj(t.focus));let a=!1;for(let t of Fp(e,`next`)){let n=t.origin;if(z(n)&&!n.isInline()){let r=n.getChildren();if(r.length>0){let t=Kd(e);t.append(...r),n.append(t),a=!0}fm(n,em(t),{$shouldSplit:()=>!1})}}function o(e,t,n){let[r,i]=e,a=e=>Ep(e)&&e.origin.is(t);if(!a(r)&&!a(i))return e;let o=im(Fp(n,`next`));return[o,o.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(sj(t)&&t.shouldMergeAdjacentLink(e))return n&&=o(n,t,e),r&&=o(r,t,e),t.append(...e.getChildren()),e.remove(),void i();let s=e.getNextSibling();sj(s)&&e.shouldMergeAdjacentLink(s)&&(n&&=o(n,e,s),r&&=o(r,e,s),e.append(...s.getChildren()),s.remove(),a=!0)}if(a){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}i()}}function aj(e){let t=null;if(gf(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=oj(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function oj(e=``,t){return qd(new tj(e,t))}function sj(e){return e instanceof tj}var cj=class e extends tj{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?of().createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return lj().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){let n=lj(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function lj(e=``,t){return qd(new cj(e,t))}function uj(e){return e instanceof cj}var dj=P(`TOGGLE_LINK_COMMAND`);function fj(e,t){if(e.type===`element`){let n=e.getNode();return z(n)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function pj(e,t={}){let n;if(e&&typeof e==`object`){let{url:r,...i}=e;n=r,t={...i,...t}}else n=e;let{target:r,title:i}=t,a=t.rel===void 0?`noreferrer`:t.rel,o=R();if(o===null||!I(o)&&!L(o))return;if(L(o)){let e=o.getNodes();if(e.length===0)return;e.forEach(e=>{if(n===null){let t=Kf(e,e=>!uj(e)&&sj(e));t&&(t.insertBefore(e),t.getChildren().length===0&&t.remove())}else{let t=Kf(e,e=>!uj(e)&&sj(e));if(t)t.setURL(n),r!==void 0&&t.setTarget(r),a!==void 0&&t.setRel(a);else{let t=oj(n,{rel:a,target:r});e.insertBefore(t),t.append(e)}}});return}if(o.isCollapsed()&&n===null)for(let e of o.getNodes()){let t=Kf(e,e=>!uj(e)&&sj(e));t!==null&&(t.getParentOrThrow().splice(t.getIndexWithinParent(),0,t.getChildren()),t.remove());return}let s=o.extract();if(n===null){let e=new Set;s.forEach(t=>{let n=Kf(t,e=>!uj(e)&&sj(e));if(n!==null){let t=n.getKey();if(e.has(t))return;(function(e,t){let n=new Set(t.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),r=e.getChildren(),i=r=>n.has(r.getKey())||z(r)&&t.some(t=>e.isParentOf(t)&&r.isParentOf(t)),a=r.filter(i);if(a.length===r.length)return r.forEach(t=>e.insertBefore(t)),void e.remove();let o=r.findIndex(i),s=r.findLastIndex(i),c=o===0,l=s===r.length-1;if(c)a.forEach(t=>e.insertBefore(t));else if(l)for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);else{for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);let t=r.slice(s+1);if(t.length>0){let n=Kd(e);a[a.length-1].insertAfter(n),t.forEach(e=>n.append(e))}}})(n,s),e.add(t)}});return}let c=new Set,l=e=>{c.has(e.getKey())||(c.add(e.getKey()),e.setURL(n),r!==void 0&&e.setTarget(r),a!==void 0&&e.setRel(a),i!==void 0&&e.setTitle(i))};if(s.length===1){let e=s[0],t=Kf(e,sj);if(t!==null)return l(t)}(function(e){let t=R();if(!I(t))return e();let n=Ea(t),r=n.isBackward(),i=fj(n.anchor,r?-1:0),a=fj(n.focus,r?0:-1);if(e(),i||a){let e=R();if(I(e)){let t=e.clone();if(i){let e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+ +!!r,`element`)}if(a){let e=a.getParent();e&&t.focus.set(e.getKey(),a.getIndexWithinParent()+ +!r,`element`)}fd(Ea(t))}}})(()=>{let e=null;for(let t of s){if(!t.isAttached())continue;let o=Kf(t,sj);if(o){l(o);continue}if(z(t)){if(!t.isInline())continue;if(sj(t)){if(!(uj(t)||e!==null&&e.getParentOrThrow().isParentOf(t))){l(t),e=t;continue}for(let e of t.getChildren())t.insertBefore(e);t.remove();continue}}let s=t.getPreviousSibling();sj(s)&&s.is(e)?s.append(t):(e=oj(n,{rel:a,target:r,title:i}),t.insertAfter(e),e.append(t))}})}var mj=/^\+?[0-9\s()-]{5,}$/;function hj(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:mj.test(e)?`tel:${e}`:`https://${e}`}qg.tag(`a`);function gj(e,t){return xm(e.registerNodeTransform(tj,ij),e.registerCommand(dj,e=>{let n=t.validateUrl.peek(),r=t.attributes.peek();if(e===null)return pj(null),!0;if(typeof e==`string`)return!(n!==void 0&&!n(e))&&(pj(e,r),!0);{let{url:t,target:n,rel:i,title:a}=e;return pj(t,{...r,rel:i,target:n,title:a}),!0}},0),gh(()=>{let n=t.validateUrl.value;if(!n)return;let r=t.attributes.value;return e.registerCommand(Io,t=>{let i=R();if(!I(i)||i.isCollapsed()||!Hm(t,ClipboardEvent)||t.clipboardData===null)return!1;let a=t.clipboardData.getData(`text`);return n(a)?!i.getNodes().some(e=>z(e)||F(e)&&!e.isSimpleText())&&(e.dispatchCommand(dj,{...r,url:a}),t.preventDefault(),!0):!1},1)}))}function _j(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function vj(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var yj=/[.,;\s]/;function bj(e,t){return t.test(e)}function xj(e,t){return bj(e[e.length-1],t)}function Sj(e,t){return bj(e[0],t)}function Cj(e,t){let n=e.getPreviousSibling();return z(n)&&(n=n.getLastDescendant()),n===null||Su(n)||F(n)&&xj(n.getTextContent(),t)}function wj(e,t){let n=e.getNextSibling();return z(n)&&(n=n.getFirstDescendant()),n===null||Su(n)||F(n)&&Sj(n.getTextContent(),t)}function Tj(e,t,n,r,i){return(e>0?bj(r[e-1],n):Cj(i[0],n))?t<r.length?bj(r[t],n):wj(i[i.length-1],n):!1}function Ej(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function Dj(e,t,n,r){let i=lj(r.url,r.attributes);if(e.length===1){let a,o=e[0];t===0?[a,o]=o.splitText(n):[,a,o]=o.splitText(t,n);let s=jc(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),o}if(e.length>1){let r=e[0],a,o=r.getTextContent().length;t===0?a=r:[,a]=r.splitText(t);let s=[],c;for(let t=1;t<e.length;t++){let r=e[t],i=r.getTextContent().length,a=o;if(a<n){if(o+i<=n)s.push(r);else{let[e,t]=r.splitText(n-a);s.push(e),c=t}}o+=i}let l=R(),u=l?l.getNodes().find(F):void 0,d=jc(a.getTextContent());return d.setFormat(a.getFormat()),d.setDetail(a.getDetail()),d.setStyle(a.getStyle()),i.append(d,...s),u&&u===a&&(I(l)?d.select(l.anchor.offset,l.focus.offset):L(l)&&d.select(0,d.getTextContent().length)),a.replace(i),c}}function Oj(e,t,n,r){let i=e.getChildren(),a=i.length;for(let t=0;t<a;t++){let r=i[t];if(!F(r)||!r.isSimpleText())return kj(e),void n(null,e.getURL())}let o=e.getTextContent(),s=vj(o,t);if(s===null||s.text!==o||!Cj(e,r)||!wj(e,r))return kj(e),void n(null,e.getURL());let c=e.getURL();if(c!==s.url&&(e.setURL(s.url),n(s.url,c)),s.attributes){let t=e.getRel();t!==s.attributes.rel&&(e.setRel(s.attributes.rel||null),n(s.attributes.rel||null,t));let r=e.getTarget();r!==s.attributes.target&&(e.setTarget(s.attributes.target||null),n(s.attributes.target||null,r))}}function kj(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}var Aj={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:yj};function jj(e,t=Aj){let{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:a=yj}=t,o=(e,t)=>{for(let n of r)n(e,t)};return xm(e.registerNodeTransform(Sc,e=>{let t=e.getParentOrThrow(),r=e.getPreviousSibling();uj(t)?Oj(t,n,o,a):!sj(t)&&!i.some(e=>e(t))&&(e.isSimpleText()&&(Sj(e.getTextContent(),a)||!uj(r))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(uj(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=vj(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(Tj(c+e,c+t,r,a,i)){let[r,,a,l]=Ej(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(uj(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=Dj(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let t=[e],n=e.getNextSibling();for(;n!==null&&F(n)&&n.isSimpleText()&&(t.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return t}(e),n,o,a),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!uj(i)||i.getIsUnlinked()){if(uj(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!Sj(s,r))return kj(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=vj(i,t);o!==null&&o.text===i&&(a.append(e),Oj(a,t,n,r),n(null,a.getURL()))}}var c;!uj(o)||o.getIsUnlinked()||xj(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(kj(o),n(null,o.getURL()))}})(e,n,o,a))}),e.registerCommand(dj,e=>{let t=R();return e!==null||!I(t)||t.extract().forEach(e=>{let t=e.getParent();uj(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1},1))}var Mj={testNode:`link`,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(oj(e.url,{title:e.title}))}},Nj={testLexicalNode:sj,visitLexicalNode:({lexicalNode:e,actions:t})=>{t.addAndStepInto(`link`,{url:e.getURL(),title:e.getTitle()})}};function Pj({validateUrl:e,attributes:t}){let[n]=gx();return(0,k.useEffect)(()=>{if(!n.hasNodes([tj]))throw Error(`LinkPlugin: LinkNode not registered on editor`)}),(0,k.useEffect)(()=>gj(n,_h({attributes:t,validateUrl:e})),[n,e,t]),null}function Fj(e,t,n,r){(0,k.useEffect)(()=>{e.hasNodes([cj])||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(77)}),(0,k.useEffect)(()=>jj(e,{changeHandlers:n?[n]:[],excludeParents:r??[],matchers:t}),[e,t,n,r])}function Ij({matchers:e,onChange:t,excludeParents:n}){let[r]=gx();return Fj(r,e,t,n),null}var Lj=[_j(/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,e=>e.startsWith(`http`)?e:`https://${e}`),_j(/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,e=>`mailto:${e}`)],Rj=()=>k.createElement(Ij,{matchers:Lj}),zj=j(!1),Bj=ii({init(e,t){let n=!!t?.disableAutoLink,r=t?.validateUrl?{validateUrl:t.validateUrl}:{},i=()=>k.createElement(k.Fragment,null,k.createElement(Pj,{...r}),n?null:k.createElement(Rj,null));e.pubIn({[lC]:`link`,[wS]:Mj,[CS]:[tj,cj],[DS]:Nj,[zj]:n,[ZS]:i,[$S]:i,[KS]:i})}});function Vj(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Hj=[`color`],Uj=(0,k.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=Vj(e,Hj);return(0,k.createElement)(`svg`,Object.assign({width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},i,{ref:t}),(0,k.createElement)(`path`,{d:`M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z`,fill:r,fillRule:`evenodd`,clipRule:`evenodd`}))}),Wj=()=>k.createElement(`div`,{className:J.imagePlaceholder},k.createElement(Uj,null));function Gj(e){let{nodeKey:t,imageSource:n,initialImagePath:r,title:i,alt:a,width:o,height:s}=e,[c,l,u]=Jr(RL,zS,qx),[d]=gx(),f=Yr(IL),p=Yr(Wx),m=pC();return k.createElement(`div`,{className:J.editImageToolbar},k.createElement(`button`,{className:J.iconButton,type:`button`,title:m(`imageEditor.deleteImage`,`Delete image`),disabled:u,onClick:e=>{e.preventDefault(),d.update(()=>{var e;(e=H(t))==null||e.remove()})}},l(`delete_small`)),!c&&k.createElement(`button`,{type:`button`,className:(0,OC.default)(J.iconButton,J.editImageButton),title:m(`imageEditor.editImage`,`Edit image`),disabled:u,onClick:()=>{p(d),f({nodeKey:t,initialValues:{src:r??n,title:i,altText:a,width:HL(o),height:HL(s)}})}},l(`settings`)))}var Kj=Object.defineProperty,qj=(e,t)=>Kj(e,`name`,{value:t,configurable:!0}),Jj=`Dialog`,[Yj,Xj]=Rw(Jj),[Zj,Qj]=Yj(Jj),$j=qj(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=k.useRef(null),c=k.useRef(null),{nodes:l,registry:u}=BT(),[d,f]=XE({prop:r,defaultProp:i??!1,onChange:a,caller:Jj}),[p,m]=k.useState(0),[h,g]=k.useState(0);return(0,A.jsx)(Zj,{scope:t,triggerRef:s,contentRef:c,contentId:rE(),titleId:rE(),descriptionId:rE(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:k.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),eM=`DialogPortal`,[tM,nM]=Yj(eM,{forceMount:void 0}),rM=qj(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Qj(eM,t);return(0,A.jsx)(tM,{scope:t,forceMount:n,children:k.Children.map(r,e=>(0,A.jsx)(IE,{present:n||a.open,children:(0,A.jsx)(ME,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),iM=`DialogOverlay`,aM=k.forwardRef(qj(function(e,t){let n=nM(iM,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Qj(iM,e.__scopeDialog);return a.modal?(0,A.jsx)(IE,{present:r||a.open,children:(0,A.jsx)(sM,{...i,ref:t})}):null},`DialogOverlay`)),oM=Hw(`DialogOverlay.RemoveScroll`),sM=k.forwardRef(qj(function(e,t){let{__scopeDialog:n,...r}=e,i=Qj(iM,n),a=Pw(t,yT());return(0,A.jsx)(_O,{as:oM,allowPinchZoom:!0,shards:k.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,A.jsx)(aT.div,{"data-state":vM(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),cM=`DialogContent`,lM=k.forwardRef(qj(function(e,t){let n=nM(cM,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Qj(cM,e.__scopeDialog);return(0,A.jsx)(IE,{present:r||a.open,children:a.modal?(0,A.jsx)(uM,{...i,ref:t}):(0,A.jsx)(dM,{...i,ref:t})})},`DialogContent`)),uM=k.forwardRef(qj(function(e,t){let n=Qj(cM,e.__scopeDialog),r=k.useRef(null),i=Pw(t,n.contentRef,r);return k.useEffect(()=>{let e=r.current;if(e)return lD(e)},[]),(0,A.jsx)(fM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Tw(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Tw(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Tw(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),dM=k.forwardRef(qj(function(e,t){let n=Qj(cM,e.__scopeDialog),r=k.useRef(!1),i=k.useRef(!1);return(0,A.jsx)(fM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),fM=k.forwardRef(qj(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Qj(cM,n);return AT(),(0,A.jsx)(zT,{registry:l.branchRegistry,children:(0,A.jsx)(LT,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,A.jsx)(vT,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?_M(o,l.descriptionId):o,"data-state":vM(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),pM=k.forwardRef(qj(function(e,t){let{__scopeDialog:n,...r}=e,i=Qj(`DialogTitle`,n),{setTitleCount:a}=i;return xw(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,A.jsx)(aT.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),mM=k.forwardRef(qj(function(e,t){let{__scopeDialog:n,...r}=e,i=Qj(`DialogDescription`,n),{setDescriptionCount:a}=i;return xw(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,A.jsx)(aT.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),hM=`DialogClose`,gM=k.forwardRef(qj(function(e,t){let{__scopeDialog:n,...r}=e,i=Qj(hM,n);return(0,A.jsx)(aT.button,{type:`button`,...r,ref:t,onClick:Tw(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function _M(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}qj(_M,`concatAriaDescribedby`);function vM(e){return e?`open`:`closed`}qj(vM,`getState`);var yM=e=>e.type===`checkbox`,bM=e=>e.type===`file`,xM=e=>e instanceof Date,SM=e=>e==null,CM=e=>typeof e==`object`,wM=e=>!SM(e)&&!Array.isArray(e)&&CM(e)&&!xM(e),TM=e=>wM(e)&&e.target?yM(e.target)?e.target.checked:bM(e.target)?e.target.files:e.target.value:e,EM=/[.[\]'"]/,DM=e=>e.split(EM).filter(Boolean);function OM(e,t){let n=DM(t),r=e._formValues,i=e._defaultValues;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r==null?r:r[t],i=i==null?i:i[t],r===null||i===null)return null}}var kM=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),AM=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function jM(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);let t=typeof Blob<`u`&&e instanceof Blob,n=typeof FileList<`u`&&e instanceof FileList;if(AM&&(t||n))return e;let r=Array.isArray(e),i=Object.getPrototypeOf(e);if(!r&&i&&i.constructor!==Object)return e;let a=r?Array(e.length):Object.create(i);for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=jM(e[t]));return a}var MM={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},NM={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},PM={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},FM=[PM.required,PM.min,PM.max,PM.minLength,PM.maxLength,PM.pattern,PM.validate],IM=`form`,LM=`root`,RM=[`__proto__`,`constructor`,`prototype`],zM=/^\w*$/,BM=e=>zM.test(e),Y=e=>e===void 0,X=(e,t,n)=>{if(!t||!wM(e))return n;let r=BM(t)?[t]:DM(t);if(r.some(e=>RM.includes(e)))return n;let i=r.reduce((e,t)=>SM(e)?void 0:e[t],e);return Y(i)||i===e?Y(e[t])?n:e[t]:i},VM=e=>typeof e==`boolean`,HM=e=>typeof e==`function`,UM=(e,t,n)=>{let r=-1,i=BM(t)?[t]:DM(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=wM(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(RM.includes(t))return;e[t]=a,e=e[t]}},WM=k.createContext(null);WM.displayName=`HookFormControlContext`;var GM=()=>k.useContext(WM),KM=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==NM.all&&(t._proxyFormState[i]=!r||NM.all),n&&(n[i]=!0),e[i]}});return i},qM=AM?k.useLayoutEffect:k.useEffect,JM=e=>{let t=e.constructor&&e.constructor.prototype;return wM(t)&&t.hasOwnProperty(`isPrototypeOf`)},YM=e=>SM(e)||!CM(e),XM=(e,t)=>t.length===0&&!Array.isArray(e)&&Object.getPrototypeOf(e)!==null&&!JM(e);function ZM(e,t,n=!1,r=new WeakMap){if(e===t)return!0;if(YM(e)||YM(t))return Object.is(e,t);if(xM(e)&&xM(t))return Object.is(e.getTime(),t.getTime());if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;if(XM(e,i)||XM(t,a))return Object.is(e,t);if(!i.length&&Array.isArray(e)!==Array.isArray(t))return!1;let o=r.get(e);if(o&&o.has(t))return!0;if(o)o.add(t);else{let n=new WeakSet;n.add(t),r.set(e,n)}for(let a of i){let i=e[a];if(!Object.prototype.hasOwnProperty.call(t,a))return!1;if(!n||a!==`ref`){let e=t[a];if(xM(i)&&xM(e)||(wM(i)||Array.isArray(i))&&(wM(e)||Array.isArray(e))?!ZM(i,e,n,r):!Object.is(i,e))return!1}}return!0}function QM(e){let t=k.useRef(!1),n=k.useRef(!1),r=k.useRef(void 0),i=k.useRef(0);return i.current++,!n.current&&e&&(n.current=!0,r.current=jM(e())),{resyncIfNeeded:k.useCallback((e,a,o)=>{if(e&&(t.current||n.current&&i.current>1)){let e=a();ZM(r.current,e)||o(e)}t.current=!0},[]),snapshot:k.useCallback((e,t)=>{e&&(r.current=jM(t()))},[])}}function $M(e){let t=GM(),{control:n=t,disabled:r,name:i,exact:a}=e||{},o=()=>({...n._formState,defaultValues:n._defaultValues}),[s,c]=k.useState(o),l=k.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:d}=QM(o);return qM(()=>{u(!r,o,c);let e=n._subscribe({name:i,formState:l.current,exact:a,callback:e=>{!r&&c({...n._formState,...e,defaultValues:n._defaultValues})}});return()=>{e(),d(!r,o)}},[n,i,r,a,u,d]),k.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),k.useMemo(()=>KM(s,n,l.current,!1),[s,n])}var eN=e=>typeof e==`string`,tN=(e,t,n,r,i)=>eN(e)?(r&&t.watch.add(e),X(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),X(n,e,X(i,e)))):(r&&(t.watchAll=!0),n);function nN(e){let t=GM(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=k.useRef(i),l=k.useRef(s),u=k.useRef(n),d=k.useRef(r);l.current=s;let f=()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e},[p,m]=k.useState(f),h=k.useRef(p),g=k.useCallback(e=>{let t=tN(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),_=k.useCallback(e=>{if(!a){let t=tN(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);ZM(e,h.current)||(m(e),h.current=e)}else m(t)}},[n._formValues,n._names,a,r]),{resyncIfNeeded:v,snapshot:y}=QM(f),b=k.useRef(_);b.current=_;let x=k.useRef(g);x.current=g,qM(()=>{u.current!==n||!ZM(d.current,r)?(u.current=n,d.current=r,b.current()):v(!a,()=>x.current(),e=>{let t=jM(e);m(t),h.current=t});let e=n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{b.current(e.values)}});return()=>{e(),y(!a,()=>x.current())}},[n,o,r,a,v,y]),k.useEffect(()=>n._removeUnmounted());let S=u.current!==n,C=d.current,w=k.useMemo(()=>!S&&!ZM(C,r),[S,r,C]);return(S||w)&&(c.current=i),!a&&(S||w)?g():p}function rN(e){let t=GM(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=kM(i._names.array,n),l=nN({control:i,name:n,defaultValue:k.useMemo(()=>{let e=X(i._formValues,n,X(i._defaultValues,n,o));return Y(e)?OM(i,n):e},[i,n,o]),exact:s}),u=$M({control:i,name:n,exact:s}),d=k.useRef(e),f=k.useRef(null),p=k.useRef(i.register(n,{...e.rules,value:l,...VM(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=k.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!X(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!X(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!X(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!X(u.validatingFields,n)},error:{enumerable:!0,get:()=>X(u.errors,n)}}),[u,n]),h=k.useCallback(e=>{let t=TM(e);return X(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:TM(e),name:n},type:MM.CHANGE})},[n,i]),g=k.useCallback(()=>{let e=X(i._formValues,n);return X(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:e})),p.current.onBlur({target:{value:e,name:n},type:MM.BLUR})},[n,i]),_=k.useCallback(e=>{e&&(f.current={focus:()=>HM(e.focus)&&e.focus(),select:()=>HM(e.select)&&e.select(),setCustomValidity:t=>HM(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>HM(e.reportValidity)&&e.reportValidity()});let t=X(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current,t._f._c=!0)},[i._fields,n]),v=k.useMemo(()=>({name:n,value:l,...VM(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return k.useEffect(()=>{let e=i._options.shouldUnregister||a;p.current=i.register(n,{...d.current.rules,...VM(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=X(i._fields,e);n&&n._f&&(n._f.mount=t,n._f._c=t)};if(t(n,!0),e){let e=jM(X(a?i._defaultValues:i._options.values||i._defaultValues,n,X(i._options.defaultValues,n,d.current.defaultValue)));UM(i._defaultValues,n,e),Y(X(i._formValues,n))&&UM(i._formValues,n,e)}if(!c&&i.register(n,{...d.current.rules,...VM(d.current.disabled)?{disabled:d.current.disabled}:{}}),f.current){let e=X(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),k.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),k.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var iN=e=>e.render(rN(e)),aN=e=>({isOnSubmit:!e||e===NM.onSubmit,isOnBlur:e===NM.onBlur,isOnChange:e===NM.onChange,isOnAll:e===NM.all,isOnTouch:e===NM.onTouched}),oN=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},sN=(e,t,n)=>{for(let r of n||Object.keys(e)){if(r===`_f`)continue;let i=n?X(e,r):e[r];if(i){let{_f:e}=i;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],e.name)||e.ref&&t(e.ref,e.name)||sN(i,t))return!0}else if((wM(i)||Array.isArray(i))&&sN(i,t))return!0}}},cN=(e,t,n)=>{let r=X(e,n),i=Array.isArray(r)?r:[];return UM(i,LM,t[n]),UM(e,n,i),e},lN=e=>wM(e)&&!Object.keys(e).length,uN=e=>{if(!AM)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},dN=e=>e.type===`radio`,fN=e=>e instanceof RegExp,pN=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},mN={value:!1,isValid:!1},hN={value:!0,isValid:!0},gN=e=>{if(!Array.isArray(e))return mN;if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}let t=e[0];return!t||!t.checked||t.disabled?mN:!t.attributes||!(`value`in t.attributes)||Y(t.value)||t.value===``?hN:{value:t.value,isValid:!0}},_N={isValid:!1,value:null},vN=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,_N):_N;function yN(e,t,n=`validate`){if(eN(e)||Array.isArray(e)&&e.length&&e.every(eN)||VM(e)&&!e)return{type:n,message:eN(e)?e:``,ref:t}}var bN=e=>wM(e)&&!fN(e)?e:{value:e,message:``},xN=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_,_c:v}=e._f,y=X(n,h);if(!_||t.has(h))return{};let b=s?s[0]:o,x=e=>{if(i&&b.reportValidity){let t=VM(e)?``:e||``;s?s.forEach(e=>HM(e.setCustomValidity)&&e.setCustomValidity(t)):b.setCustomValidity(t),b.reportValidity()}},S={},C=!v&&dN(o),w=!v&&yM(o),T=C||w,E=(g||bM(o))&&Y(o.value)&&Y(y)||uN(o)&&o.value===``&&!v||y===``||Array.isArray(y)&&!y.length,ee=pN.bind(null,h,r,S),D=(e,t,n,r=PM.maxLength,i=PM.minLength)=>{let a=e?t:n;S[h]={type:e?r:i,message:a,ref:o,...ee(e?r:i,a)}};if(a?!Array.isArray(y)||!y.length:c&&(!T&&(E||SM(y))||VM(y)&&!y||w&&!gN(s).isValid||C&&!vN(s).isValid)){let{value:e,message:t}=eN(c)?{value:!!c,message:c}:bN(c);if(e&&(S[h]={type:PM.required,message:t,ref:b,...ee(PM.required,t)},!r))return x(t),S}if(!E&&(!SM(d)||!SM(f))){let e,t,n=bN(f),i=bN(d);if(!SM(y)&&!xM(y)&&!isNaN(y)){let r=!v&&o.valueAsNumber||y&&+y;SM(n.value)||(e=r>n.value),SM(i.value)||(t=r<i.value)}else{let r=!v&&o.valueAsDate||new Date(y),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;eN(n.value)&&y&&(e=s?a(y)>a(n.value):c?y>n.value:r>new Date(n.value)),eN(i.value)&&y&&(t=s?a(y)<a(i.value):c?y<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,PM.max,PM.min),!r))return x(S[h].message),S}if((!SM(l)||!SM(u))&&!E&&(eN(y)||a&&Array.isArray(y))){let e=bN(l),t=bN(u),n=!SM(e.value)&&y.length>+e.value,i=!SM(t.value)&&y.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return x(S[h].message),S}if(p&&!E&&eN(y)){let{value:e,message:t}=bN(p);if(fN(e)&&!y.match(e)&&(S[h]={type:PM.pattern,message:t,ref:o,...ee(PM.pattern,t)},!r))return x(t),S}if(m){if(HM(m)){let e=yN(await m(y,n),b);if(e&&(S[h]={...e,...ee(PM.validate,e.message)},!r))return x(e.message),S}else if(wM(m)){let e={};for(let t in m){if(!lN(e)&&!r)break;let i=yN(await m[t](y,n),b,t);i&&(e={...i,...ee(t,i.message)},r||x(i.message),r&&(S[h]=e))}if(!lN(e)&&(S[h]={ref:b,...e},!r))return S}}let te=S[h];return x(!te||te.message),S},SN=e=>Array.isArray(e)?e:[e],CN=e=>Array.isArray(e)?e.filter(Boolean):[];function wN(e,t){let n=t.length-1,r=0;for(;r<n;){if(SM(e)){e=void 0;break}e=e[t[r]],r++}return e}function TN(e){for(let t in e)if(e.hasOwnProperty(t)&&!Y(e[t]))return!1;return!0}function EN(e,t){if(eN(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:BM(t)?[t]:DM(t);if(n.some(e=>RM.includes(String(e))))return e;let r=n.length===1?e:wN(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(wM(r)&&lN(r)||Array.isArray(r)&&TN(r))&&EN(e,n.slice(0,-1)),e}var DN=()=>{let e=new Set,t=0;return{get observers(){return Array.from(e)},next:n=>{let r=e;t++;for(let e of r)e.next&&e.next(n);r===e&&t--},subscribe:n=>(e.add(n),{unsubscribe:()=>{t&&=(e=new Set(e),0),e.delete(n)}}),unsubscribe:()=>{e=new Set,t=0}}};function ON(e,t){let n=Array.isArray(e)?[]:{};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r],a=t[r];i&&(wM(i)||Array.isArray(i))&&a?n[r]=ON(i,a):e[r]&&(n[r]=a)}return n}var kN=(e,t)=>e!==null&&CM(e)&&Object.prototype.hasOwnProperty.call(e,t),AN=(e,t)=>{if(!t)return!1;let n=e;for(let r of BM(t)?[t]:DM(t)){if(!kN(n,r))return kN(e,t);n=n[r]}return!0},jN=e=>e.type===`select-multiple`,MN=e=>{let t=[...e.options];return!e.multiple&&e.size<2&&!t.some(e=>e.defaultSelected)?e.selectedIndex!==t.findIndex(e=>!e.disabled):t.some(e=>e.selected!==e.defaultSelected)},NN=e=>yM(e)?e.checked!==e.defaultChecked:e.type===`select-one`||jN(e)?MN(e):!dN(e)&&`defaultValue`in e&&e.value!==e.defaultValue,PN=e=>dN(e)||yM(e),FN=e=>uN(e)&&e.isConnected;function IN(e){return Array.isArray(e)||wM(e)}function LN(e,t,n=``,r=[]){for(let i in e){let a=n?`${n}.${i}`:i,o=e[i];IN(o)&&IN(X(t,a))?LN(o,t,a,r):r.push(a)}return r}var RN=e=>{for(let t in e)if(HM(e[t]))return!0;return!1};function zN(e){return Array.isArray(e)||wM(e)&&!RN(e)}function BN(e){return!!(e&&`_f`in e)}function VN(e){return Array.isArray(e)?!e.some(e=>!Y(e)):!Object.keys(e).length}function HN(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function UN(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];zN(i)&&(!Array.isArray(i)||!BN(a))?(t[r]=Array.isArray(i)?[]:{},UN(i,t[r],a),VN(t[r])&&HN(t,r)):Y(i)||(t[r]=!0)}return t}function WN(e,t,n,r){n||=UN(t,Array.isArray(SM(t)?e:t)?[]:{},r);for(let i in e){let a=e[i],o=r&&r[i];zN(a)&&(!Array.isArray(a)||!BN(o))?(Y(t)||YM(n[i])?n[i]=UN(a,Array.isArray(a)?[]:{},o):WN(a,SM(t)?{}:t[i],n[i],o),VN(n[i])&&HN(n,i)):ZM(a,SM(t)?void 0:t[i])?HN(n,i):n[i]=!0}return n}var GN=(e,t)=>{let n=t.split(`.`),r=[],i=n[0];for(let t=1;t<n.length;i+=`.`+n[t++])!isNaN(+n[t])&&e.has(i)&&r.push(`${i}.${n[t]}`);return r},KN=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Y(e)?e:t?e===``?NaN:e&&+e:n&&eN(e)?new Date(e):r?r(e):e;function qN(e){let t=e.ref;return bM(t)?t.files:dN(t)?vN(e.refs).value:jN(t)?[...t.selectedOptions].map(({value:e})=>e):yM(t)?gN(e.refs).value:KN(t.value,e)}var JN=(e,t,n,r)=>{let i={};for(let n of e){let e=X(t,n);e&&UM(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},YN=e=>Y(e)?e:fN(e)?e.source:wM(e)?fN(e.value)?e.value.source:e.value:e,XN=`AsyncFunction`,ZN=e=>{if(!e||!e.validate)return!1;if(HM(e.validate))return e.validate.constructor.name===XN;if(wM(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===XN)return!0}return!1},QN=e=>e.mount&&(e.required||!Y(e.required)&&e.required!==!1||!Y(e.min)||!Y(e.max)||!Y(e.maxLength)||!Y(e.minLength)||e.pattern||e.validate);function $N(e,t,n){let r=X(e,n);if(r&&(r.type||r.message)||Array.isArray(r))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=X(t,r),o=X(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var eP=(e,t,n)=>{let r=Object.keys(e).filter(e=>e!==`name`);return!r.length||n&&r.length>=Object.keys(t).length||r.find(e=>t[e]===(!n||NM.all))},tP=(e,t,n)=>n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e),nP=(e,t,n)=>{if(!e||!t||e===t)return!0;if(!Array.isArray(e))return tP(e,t,n);for(let r of e)if(r&&tP(r,t,n))return!0;return!1},rP=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,iP=(e,t)=>{let n=X(e,t);!CN(n).length&&!(n&&n.root)&&EN(e,t)},aP={mode:NM.onSubmit,reValidateMode:NM.onChange,shouldFocusError:!0},oP=(e,t)=>{for(let t in e)delete e[t];Object.assign(e,t)},sP={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function cP(e={}){let t={...aP,...e},n={...jM(sP),isLoading:HM(t.defaultValues),errors:jM(t.errors)||{},disabled:t.disabled||!1},r={},i=(wM(t.defaultValues)||wM(t.values))&&jM(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:jM(i),o={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},s=!1,c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},l={},u={},d=new Set,f=aN(t.mode),p=aN(t.reValidateMode),m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...m},g={},_=(...e)=>e.some(e=>h[e]||g[e]),v=e=>{for(let t of d)if(nP(t.name,e,t.exact))return!0;return!1},y={array:DN(),state:DN()},b=0,x=0,S=0,C={},w=t.criteriaMode===NM.all,T=(e,t)=>n=>{clearTimeout(u[e]),u[e]=setTimeout(t,n)},E=e=>{clearTimeout(u[e]),delete u[e],delete l[e]},ee=e=>{E(e);let t=`${e}.`;for(let e of Object.keys(l))e.startsWith(t)&&E(e)},D=async e=>{if(!o.keepIsValid&&!t.disabled&&(_(`isValid`)||e)){let e=++b,i;t.resolver?(i=lN((await me()).errors),e===b&&ne()):i=await _e({fields:r,onlyCheckValid:!0,eventType:MM.VALID}),e===b&&i!==n.isValid&&y.state.next({isValid:i})}},te=(e,t)=>{let r=[...e];if(!r.some(e=>e&&(t?X(n.validatingFields,e)!==!0:AN(n.validatingFields,e))))return;let i=jM(n.validatingFields);for(let e of r)e&&(t?UM(i,e,!0):EN(i,e));ZM(n.validatingFields,i)||(n.validatingFields=i)},ne=(e,r)=>{!t.disabled&&_(`isValidating`,`validatingFields`)&&(te(e||c.mount,r),y.state.next({validatingFields:n.validatingFields,isValidating:!lN(n.validatingFields)}))},re=()=>{n.dirtyFields=WN(i,a,void 0,r)},ie=(e,i=[],c,l,u=!0,d=!0)=>{if(l&&c&&!t.disabled){o.action=!0,o.keepIsValid=!1;let t=X(r,e),a=t&&t._f,f=a?Object.assign([],t):t;if(o.actionArrayLengths.has(e)||o.actionArrayLengths.set(e,Array.isArray(f)?f.length:0),d&&Array.isArray(f)){let t=c(f,l.argA,l.argB)||f;a?UM(r,e,{...t,_f:a}):u&&UM(r,e,t)}let p=X(n.errors,e);if(d&&Array.isArray(p)){let t=p.root,r=c(p,l.argA,l.argB)||p;t&&(r.root=t),u&&UM(n.errors,e,r),iP(n.errors,e),n.errors={...n.errors}}let m=X(n.touchedFields,e),h=d&&Array.isArray(m);if(h){let t=c(m,l.argA,l.argB);u&&UM(n.touchedFields,e,t)}let g=X(n.dirtyFields,e);if(d&&Array.isArray(g)){let t=c(g,l.argA,l.argB)||g;u&&UM(n.dirtyFields,e,t)}_(`dirtyFields`)?re():s=!0,y.state.next({name:e,isDirty:ye(e,i),dirtyFields:n.dirtyFields,...h&&{touchedFields:n.touchedFields},errors:n.errors,isValid:n.isValid})}else UM(a,e,i)},ae=(e,t)=>{UM(n.errors,e,t),n.errors={...n.errors},y.state.next({errors:n.errors})},oe=e=>{Object.keys(l).forEach(E);let t=!lN(e);n.errors=jM(e),y.state.next({errors:n.errors,...t?{isValid:!1}:{}}),!t&&o.mount&&D()},se=e=>BM(e)?[e]:DM(e),ce=e=>{let t=se(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=SM(n)?n:n[i],r=SM(r)?r:r[i],n===null&&r!==null)return!0}return!1},le=e=>{if(!o.actionArrayLengths.size)return!1;let t=se(e),n=a,r=``,i=-1,s=0;for(let e=0;e<t.length;e++){if(SM(n))return!1;let a=t[e];if(r=r?`${r}.${a}`:a,Array.isArray(n)&&+a>=n.length)return i===-1?!1:e!==i||+a<s;if(o.actionArrayLengths.has(r)&&(i=e+1,s=o.actionArrayLengths.get(r)),n=n[a],Y(n)&&i!==-1&&e>i&&+t[i]<s)return!0}return!1},ue=e=>{let t=a;for(let n of se(e)){if(Array.isArray(t)&&+n>=t.length)return!0;t&&=t[n]}return!1},de=(e,l,u,d)=>{let f=X(r,e);if(f){if(ce(e)||le(e))return;let r=Y(X(a,e)),p=X(a,e,Y(u)?X(i,e):u),m=!!d&&!n.isReady&&NN(d);if(Y(p)||d&&d.defaultChecked||m||l){let t=l?p:qN(f._f);(!Y(t)||!ue(e))&&(_(`dirtyFields`)&&!ZM(X(a,e),t)&&(s=!0),UM(a,e,t),m&&fe(e,t))}else Se(e,p);o.mount&&!o.action&&(t.resolver&&_(`isValidating`,`validatingFields`)?Promise.resolve().then(()=>D()):D(),r&&n.isDirty&&_(`isDirty`)&&(ye()||(n.isDirty=!1,y.state.next({...n}))),t.shouldUnregister&&r&&!Y(X(a,e))&&oN(e,c)&&(o.watch=!0))}},fe=(e,o,c,l,u)=>{let d=!1,f=!1,p={name:e};if(!t.disabled||l===!0){if(!c||l){let t=ZM(X(i,e),o);if(_(`isDirty`)&&(f=n.isDirty,n.isDirty=p.isDirty=!t||ye(),d=f!==p.isDirty),f=!!X(n.dirtyFields,e),t)EN(n.dirtyFields,e);else{let t=X(i,e),a=X(r,e),s=!(a&&a._f)&&(wM(t)||Array.isArray(t))?WN(t,o,void 0,a):!0;UM(n.dirtyFields,e,s)}let c=!1;if(s||t&&(_(`isDirty`)?n.isDirty:ye())){s=!1;let e=WN(i,a,void 0,r);ZM(n.dirtyFields,e)||(c=!0,oP(n.dirtyFields,e))}p.dirtyFields=n.dirtyFields,d||=_(`dirtyFields`)&&(c||f!==!t)}if(c){let t=AN(n.touchedFields,e)?X(n.touchedFields,e):void 0;t||(UM(n.touchedFields,e,c),p.touchedFields=n.touchedFields,d||=_(`touchedFields`)&&t!==c)}d&&u&&y.state.next(p)}return d?p:{}},pe=(e,r,i,a)=>{let o=X(n.errors,e),s=_(`isValid`)&&VM(r)&&n.isValid!==r;if(t.delayError&&i?(l[e]=T(e,()=>ae(e,i)),l[e](t.delayError)):(E(e),i?UM(n.errors,e,i):EN(n.errors,e),n.errors={...n.errors}),(i?!ZM(o,i,!0):o)||!lN(a)||s){let t={...a,...s&&VM(r)?{isValid:r}:{},errors:n.errors,name:e};y.state.next(t)}},me=async e=>(ne(e,!0),await t.resolver(a,t.context,JN(e||c.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),he=async e=>{let t=x,i=S,a=e?e.filter(e=>X(r,e)):[],{errors:o}=await me(e);if(t!==x)return o;if(ne(e),e){for(let t of e){if(a.includes(t)&&(!X(r,t)||C[t]>i)){EN(o,t);continue}let e=X(o,t);ee(t);let s=c.array.has(t)&&wM(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e))),l=X(r,t),u=wM(l)&&Object.keys(l).some(e=>e!==`_f`);s?cN(n.errors,{[t]:e},t):e&&(e.type||e.message)||Array.isArray(e)||wM(e)&&u?UM(n.errors,t,e):EN(n.errors,t)}n.errors={...n.errors}}else Object.keys(l).forEach(E),n.errors=o;return o},ge=async({name:e,eventType:r})=>{if(t.validate){let i=x,o=await t.validate({formValues:a,formState:n,name:e,eventType:r});if(i!==x)return!0;if(wM(o)){let e=!0;Ne(IM);for(let t in o){let n=o[t];n&&(e=!1,Pe(`${IM}.${t}`,{message:eN(n.message)?n.message:``,type:n.type||PM.validate}))}return e}return eN(o)||!o?(Pe(IM,{message:o||``,type:PM.validate}),!1):(Ne(IM),!0)}return!0},_e=async({fields:e,onlyCheckValid:i,name:o,eventType:s,context:l={valid:!0,runRootValidation:!1}})=>{let u=x;if(t.validate&&!l.runRootValidation&&(l.runRootValidation=!0,!await ge({name:o,eventType:s})&&(l.valid=!1,i)))return l.valid;for(let o in e){let d=e[o];if(d){let{_f:e,...f}=d;if(e){let o=c.array.has(e.name),s=d._f&&ZN(d._f),f=_(`isValidating`,`validatingFields`);s&&f&&ne([e.name],!0);let p=S,m=await xN(d,c.disabled,a,w,t.shouldUseNativeValidation&&!i,o);if(u!==x)return l.valid;if(s&&f&&ne([e.name]),!X(r,e.name)||C[e.name]>p)continue;if(m[e.name]&&(l.valid=!1,i)||(i||(E(e.name),X(m,e.name)?o?cN(n.errors,m,e.name):UM(n.errors,e.name,m[e.name]):EN(n.errors,e.name)),t.shouldUseNativeValidation&&m[e.name]))break}!lN(f)&&await _e({context:l,onlyCheckValid:i,fields:f,name:o,eventType:s})}}return l.valid},ve=()=>{for(let e of c.unMount){let t=X(r,e);t&&(t._f.refs?t._f.refs.every(e=>!FN(e)):!FN(t._f.ref))&&Re(e)}c.unMount=new Set},ye=(e,t)=>(e&&!Y(t)&&UM(a,e,t),!ZM(o.mount?a:i,i)),be=(e,t,n)=>{let r=o.mount?a:Y(t)||!Y(e)?i:t;return tN(e,c,Y(e)?{...r}:r,n,t)},xe=e=>CN(X(o.mount?a:i,e,t.shouldUnregister?X(i,e,[]):[])),Se=(e,t,n={},i=!1,o=!1,s=!1)=>{let c=X(r,e),l=t;if(c){let n=c._f;n&&(!n.disabled&&UM(a,e,KN(t,n)),l=uN(n.ref)&&SM(t)?``:t,jN(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?yM(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(l)?!!l.find(t=>t===e.value):l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):bM(n.ref)?n.ref.value=``:(n.ref.value=l,!n.ref.type&&!o&&!s&&y.state.next({name:e,values:i?a:v(e)?jM(a):void 0})))}(n.shouldDirty||n.shouldTouch)&&fe(e,c&&c._f&&!c._f.disabled&&(c._f.valueAsNumber||c._f.valueAsDate||c._f.setValueAs)?KN(t,c._f):l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&ke(e,{delayError:n.delayError}),n.shouldValidate&&c&&c._f&&c._f.deps&&(!Array.isArray(c._f.deps)||c._f.deps.length>0)&&ke(c._f.deps)},Ce=(e,t,n,i=!1,o=!1,s=!1)=>{for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;let u=t[l],d=e+`.`+l,f=X(r,d);c.array.has(d)&&y.array.next({name:d,values:i?a:jM(a)}),(c.array.has(e)||wM(u)||f&&!f._f)&&!xM(u)?Ce(d,u,n,i,o,s):Se(d,u,n,i,o,s)}},we=(e,t,i,s,l=!1)=>{let u=X(r,e),d=c.array.has(e),f=s?t:jM(t),p=ZM(X(a,e),f);if(p||UM(a,e,f),d)y.array.next({name:e,values:s?a:jM(a)}),_(`isDirty`,`dirtyFields`)&&i.shouldDirty&&(re(),n.isDirty=ye(e,f),l||y.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:n.isDirty})),i.shouldValidate&&ke(e,{delayError:i.delayError});else{let t=Array.isArray(f)&&!f.length||lN(f),n=!p&&!l;!u||u._f||SM(f)||t?Se(e,f,i,s,l,n):Ce(e,f,i,s,l,n)}if(!p&&!l){let t=oN(e,c),r=o.mount||t?e:void 0,i=d?[]:GN(c.array,e),l=s?a:v(r)||i.some(v)?jM(a):void 0;y.state.next({...t&&n,name:r,values:l});for(let e of i)y.state.next({name:e,values:l})}},Te=(e,t,n={})=>we(e,t,n,!1),Ee=(e,t={})=>{let r=HM(e)?e(a):e;if(!ZM(a,r)){a={...a,...r};for(let e of new Set([...c.mount,...c.array]))AN(r,e)&&we(e,X(r,e),t,!0,!0);y.state.next({...n,name:void 0,type:void 0,...d.size?{values:a}:{}}),t.shouldValidate&&D()}},De=async e=>{o.mount=!0;let i=e.target,s=i.name,u=!0,d=X(r,s),m=S,h=e=>{u=!!X(r,s)&&!(C[s]>m)&&ZM(e,X(a,s,e))};if(d){o.keepIsValid=!1;let m,g,S=!1,C=i.type?qN(d._f):TM(e),T=e.type===MM.BLUR||e.type===MM.FOCUS_OUT,E=!QN(d._f)&&!t.validate&&!t.resolver&&!X(n.errors,s)&&!d._f.deps,ee=E||rP(T,X(n.touchedFields,s),n.isSubmitted,p,f),te=oN(s,c,T);UM(a,s,jM(C)),T?(!i||!i.readOnly)&&(d._f.onBlur&&d._f.onBlur(e),Object.prototype.hasOwnProperty.call(l,s)&&(S=!0,l[s](0))):d._f.onChange&&d._f.onChange(e);let re=fe(s,C,T),ie=!lN(re)||te;if(!T&&y.state.next({name:s,type:e.type,...v(s)?{values:jM(a)}:{}}),ee)return(!E||!n.isValid)&&_(`isValid`)&&(t.mode===`onBlur`?T&&D():T||D()),ie&&y.state.next({name:s,...te?{}:re});if(!t.resolver&&t.validate&&await ge({name:s,eventType:e.type}),!T&&te&&y.state.next({...n}),t.resolver){let e=x,{errors:t}=await me([s]);if(e!==x)return;if(ne([s]),h(C),!u){!lN(re)&&y.state.next(re);return}let i=$N(n.errors,r,s),a=$N(t,r,i.name||s);m=a.error,s=a.name,g=lN(t)}else{let n=x,i=++b;if(ne([s],!0),m=(await xN(d,c.disabled,a,w,t.shouldUseNativeValidation))[s],n!==x)return;if(ne([s]),h(C),u){if(m)g=!1;else if(_(`isValid`)){if(g=await _e({fields:r,onlyCheckValid:!0,name:s,eventType:e.type}),n!==x)return;h(C),i!==b&&(g=void 0)}}}u&&(d._f.deps&&(!Array.isArray(d._f.deps)||d._f.deps.length>0)&&ke(d._f.deps),pe(s,g,m,re),S&&Object.prototype.hasOwnProperty.call(l,s)&&l[s](0))}},Oe=(e,t)=>{if(X(n.errors,t)&&e.focus)return e.focus(),1},ke=async(e,i={})=>{o.keepIsValid=!1;let a,s,u=SN(e),d=x;if(t.resolver){let t=await he(Y(e)?e:u);a=lN(t),s=e?!u.some(e=>X(t,e)):a}else e?(s=(await Promise.all(u.map(async e=>{let t=X(r,e);return await _e({fields:t&&t._f?{[e]:t}:t,eventType:MM.TRIGGER})}))).every(Boolean),(s||n.isValid)&&D()):s=a=await _e({fields:r,name:e,eventType:MM.TRIGGER});if(d!==x)return s;if(i.delayError&&t.delayError&&eN(e)){let r=X(n.errors,e);r?(EN(n.errors,e),l[e]=T(e,()=>ae(e,r)),l[e](t.delayError)):E(e)}if(i.shouldTouch)for(let t of e?u:c.mount)!c.array.has(t)&&UM(n.touchedFields,t,!0);return n.errors={...n.errors},y.state.next({...!eN(e)||_(`isValid`)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},...i.shouldTouch&&_(`touchedFields`)?{touchedFields:n.touchedFields}:{},errors:n.errors}),i.shouldFocus&&!s&&sN(r,Oe,e?u:c.mount),s},Ae=((e,t)=>{let r=Y(e)&&!t?{...o.mount?a:i}:o.mount?a:i;return t&&(r=ON(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Y(e)?r:eN(e)?X(r,e):e.map(e=>X(r,e))}),je=(e=>Y(e)?{...n.errors}:eN(e)?X(n.errors,e):e.map(e=>X(n.errors,e))),Me=(e,t)=>{let r=t||n,i=X(r.errors,e);return{invalid:!!i,isDirty:!!X(r.dirtyFields,e),error:i,isValidating:!!X(r.validatingFields,e),isTouched:!!X(r.touchedFields,e)}},Ne=e=>{let t=e?SN(e):void 0;t?t.forEach(e=>{ee(e),EN(n.errors,e),n.errors={...n.errors},y.state.next({name:e,errors:n.errors})}):(Object.keys(l).forEach(E),n.errors={},y.state.next({errors:n.errors}))},Pe=(e,t,i)=>{ee(e);let a=X(r,e,{_f:{}}),o=a._f&&a._f.ref,{ref:s,message:c,type:l,types:u,...d}=X(n.errors,e)||{};UM(n.errors,e,{...d,...t,ref:o}),n.errors={...n.errors},y.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&o&&o.focus&&o.focus()},Fe=(e,t)=>{if(HM(e)){let n={};d.add(n);let{unsubscribe:r}=y.state.subscribe({next:n=>`values`in n&&e(n.values||be(void 0,t),n)});return{unsubscribe:()=>{d.delete(n),r()}}}return be(e,t,!0)},Ie=e=>{let t={name:e.name,exact:e.exact};e.formState&&e.formState.values&&d.add(t);let{unsubscribe:r}=y.state.subscribe({next:t=>{if(nP(e.name,t.name,e.exact)&&eP(t,e.formState||h,e.reRenderRoot)){let r=t.values||{...a};e.callback({...n,...t,validatingFields:n.validatingFields,isValidating:n.isValidating,values:r,defaultValues:i})}}});return()=>{d.delete(t),r()}},Le=e=>{o.mount=!0;let t=Object.keys(e.formState||{}).filter(t=>e.formState&&e.formState[t]);for(let e of t)g[e]=(g[e]||0)+1;let n=Ie({...e,formState:{...m,...e.formState}});return()=>{for(let e of t.splice(0))g[e]--;n()}},Re=(e,o={})=>{let s=e?SN(e):c.mount;o.keepIsValidating||te(s);for(let e of s)c.mount.delete(e),c.array.delete(e),c.disabled.delete(e),EN(r,e),!o.keepValue&&EN(a,e),o.keepError||(ee(e),EN(n.errors,e)),!o.keepDirty&&EN(n.dirtyFields,e),!o.keepTouched&&EN(n.touchedFields,e),!t.shouldUnregister&&!o.keepDefaultValue&&EN(i,e);o.keepError||(n.errors={...n.errors}),d.size&&y.state.next({values:jM(a)}),y.state.next({...n,...o.keepDirty?{}:{isDirty:ye()},...o.keepIsValidating?{}:{isValidating:!lN(n.validatingFields)}}),!o.keepIsValid&&D()},ze=({disabled:e,name:t})=>{if(VM(e)&&o.mount||e||c.disabled.has(t)){let n=c.disabled.has(t)!==!!e;e?c.disabled.add(t):c.disabled.delete(t),n&&o.mount&&!o.action&&D()}},Be=(e,n={})=>{let a=X(r,e),s=VM(n.disabled)||VM(t.disabled),l=!c.registerName.has(e)&&a&&a._f&&!a._f.mount;if((!a||!a._f)&&(C[e]=++S),UM(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),c.mount.add(e),a&&a._f){let t=X(r,e);for(let e of FM)e in n||delete t._f[e]}return a&&!l?ze({disabled:VM(n.disabled)?n.disabled:t.disabled,name:e}):de(e,!0,n.value),{...s?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!YN(n.required),min:YN(n.min),max:YN(n.max),minLength:YN(n.minLength),maxLength:YN(n.maxLength),pattern:YN(n.pattern)}:{},name:e,onChange:De,onBlur:De,ref:s=>{if(s){c.registerName.add(e),Be(e,n),c.registerName.delete(e),a=X(r,e);let t=Y(s.value)&&s.querySelectorAll&&s.querySelectorAll(`input,select,textarea`)[0]||s,o=PN(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;let u={...a._f};o?(u.refs=[...l.filter(FN),t,...Array.isArray(X(i,e))?[{}]:[]],u.ref={type:t.type,name:e}):(u.ref=t,delete u.refs),UM(r,e,{_f:u}),de(e,!1,void 0,t)}else a=X(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(kM(c.array,e)&&o.action)&&c.unMount.add(e)}}},Ve=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&sN(r,Oe,c.mount),He=e=>{VM(e)&&(y.state.next({disabled:e}),sN(r,(t,n)=>{let i=X(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0))},Ue=(e,i)=>async o=>{let s,u;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let d=jM(a);y.state.next({isSubmitting:!0});let f=x,p=e=>{throw f===x&&y.state.next({isSubmitting:!1}),e};if(t.resolver){let e;try{e=await me()}catch(e){p(e)}let{errors:t,values:r}=e;if(f!==x)return;ne(),Object.keys(l).forEach(E),n.errors=t,d=jM(r)}else{try{await _e({fields:r,eventType:MM.SUBMIT})}catch(e){p(e)}if(f!==x)return;EN(n.errors,LM),n.errors={...n.errors}}if(c.disabled.size)for(let e of c.disabled)EN(d,e);if(lN(n.errors)){y.state.next({errors:{}});try{s=await e(d,o)}catch(e){u=e}}else{if(i)try{await i({...n.errors},o)}catch(e){p(e)}Ve(),setTimeout(Ve)}if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lN(n.errors)&&!u,submitCount:n.submitCount+1,errors:n.errors}),u)throw u;return s},We=(e,t={})=>{X(r,e)&&(te([e]),Y(t.defaultValue)?Te(e,jM(X(i,e))):(Te(e,t.defaultValue),UM(i,e,jM(t.defaultValue))),t.keepTouched||EN(n.touchedFields,e),t.keepDirty||(EN(n.dirtyFields,e),n.isDirty=Y(t.defaultValue)?ye():ye(e,jM(X(i,e)))),t.keepError||(ee(e),EN(n.errors,e),n.errors={...n.errors},D()),y.state.next({...n,isValidating:!lN(n.validatingFields)}))},Ge=(e,u={})=>{x++,b++;let d=e?jM(e):i,f=jM(d),p=lN(e),m=f,g=r;if(Object.keys(l).forEach(E),u.keepDefaultValues||(i=d),!u.keepValues){if(u.keepDirtyValues){let e=new Set([...c.mount,...LN(WN(i,a,void 0,g),n.dirtyFields)]);for(let t of e){let e=X(n.dirtyFields,t),r=X(a,t),i=X(m,t);e&&!Y(r)?UM(m,t,r):!e&&!Y(i)&&Te(t,i)}}else{if(AM&&Y(e))for(let e of c.mount){let t=X(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(uN(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(u.keepFieldsRef)for(let e of c.mount)Te(e,X(m,e));else r={}}if(t.shouldUnregister){if(a=u.keepDefaultValues?jM(i):{},u.keepFieldsRef)for(let e of c.mount)UM(a,e,X(m,e))}else a=jM(m);y.array.next({values:{...m}}),y.state.next({name:void 0,type:void 0,values:{...m}})}c={mount:u.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:u.keepValues||u.keepDirtyValues||u.keepFieldsRef?new Set([...c.disabled].filter(e=>X(r,e))):new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!h.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!t.shouldUnregister&&!lN(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!u.keepIsValid,o.action=!1,o.actionArrayLengths.clear(),s=!1,u.keepErrors||(n.errors={}),y.state.next({submitCount:u.keepSubmitCount?n.submitCount:0,isDirty:p?!1:u.keepDirty?n.isDirty:u.keepValues?ye():!!(u.keepDefaultValues&&e&&!ZM(e,i)),isSubmitted:u.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:p?{}:u.keepDirtyValues?u.keepDefaultValues&&a?WN(i,a,void 0,g):n.dirtyFields:u.keepDefaultValues&&e?WN(i,e,void 0,g):u.keepDirty?n.dirtyFields:u.keepValues?WN(i,a,void 0,g):{},touchedFields:u.keepTouched?n.touchedFields:{},...!u.keepIsValidating&&(n.isValidating||!lN(n.validatingFields))?{validatingFields:{},isValidating:!1}:null,errors:u.keepErrors?n.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ke=(e,n)=>Ge(HM(e)?e(a):e,{...t.resetOptions,...n}),qe=(e,t={})=>{let n=X(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&HM(e.select)&&e.select()})}};y.state.subscribe({next:e=>{let{name:t,type:r,values:i,...a}=e;Object.keys(a).length&&(n={...n,...a})}});let Je={control:{register:Be,unregister:Re,getFieldState:Me,handleSubmit:Ue,setError:Pe,_subscribe:Ie,_runSchema:me,_updateIsValidating:ne,_focusError:Ve,_getWatch:be,_getDirty:ye,_setValid:D,_setFieldArray:ie,_setDisabledField:ze,_setErrors:oe,_getFieldArray:xe,_reset:Ge,_resetDefaultValues:()=>HM(t.defaultValues)&&t.defaultValues().then(e=>{Ke(e,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:ve,_disableForm:He,_subjects:y,_proxyFormState:h,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},f=aN(t.mode),p=aN(t.reValidateMode),w=t.criteriaMode===NM.all}},subscribe:Le,trigger:ke,register:Be,handleSubmit:Ue,watch:Fe,setValue:Te,setValues:Ee,getValues:Ae,getErrors:je,reset:Ke,resetField:We,resetDefaultValues:(e,t={})=>{if(i=jM(e),!t.keepDirty){let e=WN(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!lN(e)}t.keepIsValid||D(),y.state.next({...n,defaultValues:i})},clearErrors:Ne,unregister:Re,setError:Pe,setFocus:qe,getFieldState:Me};return{...Je,formControl:Je}}var lP={mode:aP.mode,reValidateMode:aP.reValidateMode,shouldFocusError:aP.shouldFocusError,resolver:void 0,criteriaMode:void 0,delayError:void 0,shouldUnregister:void 0,shouldUseNativeValidation:void 0,context:void 0,progressive:void 0,resetOptions:void 0};function uP(e={}){let t=k.useRef(void 0),n=k.useRef(void 0),r=k.useRef(e.formControl),i=k.useRef(!1),a=k.useRef(!!e.validate),o=k.useRef(!!e.errors),s=k.useRef(!1),[c,l]=k.useState(()=>({...jM(sP),isLoading:HM(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:HM(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl){if(r.current=e.formControl,i.current=!1,e.formControl)t.current={...e.formControl,formState:c},e.defaultValues&&!HM(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=cP(e);t.current={...r,formState:c}}}let u=t.current.control,d=u._options,f={};for(let t in lP)t in d&&!(t in e)&&(f[t]=lP[t]);i.current&&!e.disabled&&(f.disabled=!1),u._options={...f,...e,validate:e.validate};let p=()=>({...u._formState,defaultValues:u._defaultValues}),{resyncIfNeeded:m,snapshot:h}=QM(p);return qM(()=>{m(!0,p,l);let e=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(e=>({...e,isReady:!0})),u._formState.isReady=!0,u._subjects.state.next({isReady:!0}),()=>{e(),h(!0,p)}},[u,m,h]),k.useEffect(()=>{u._disableForm(i.current&&!e.disabled?!1:e.disabled),i.current=!!e.disabled},[u,e.disabled]),k.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),k.useEffect(()=>{e.errors?(u._setErrors(e.errors),u._focusError()):o.current&&u._setErrors({}),o.current=!!e.errors},[u,e.errors]),k.useEffect(()=>{a.current&&!e.validate&&t.current&&t.current.clearErrors(IM),a.current=!!e.validate},[e.validate]),k.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),k.useEffect(()=>{if(u._proxyFormState.isDirty){let e=u._getDirty();e!==c.isDirty&&u._subjects.state.next({isDirty:e})}},[u,c.isDirty]),k.useEffect(()=>{e.values&&!ZM(e.values,n.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),u._options.resetOptions&&u._options.resetOptions.keepIsValid||u._setValid(),n.current=e.values,l(e=>({...e}))):u._resetDefaultValues()},[u,e.values]),k.useEffect(()=>{(!u._state.mount||!s.current&&!e.values)&&(u._setValid(),u._state.mount=!0),s.current=!0,u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),t.current.formState=k.useMemo(()=>KM(c,u),[u,c]),t.current}var dP=k.createContext(null);dP.displayName=`HookFormContext`;function fP(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z.apply(null,arguments)}var pP=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),mP=t(((e,t)=>{var n=pP();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),hP=t(((e,t)=>{t.exports=mP()()})),gP=t((e=>{if(typeof Symbol==`function`&&Symbol.for){var t=Symbol.for;t(`react.element`),t(`react.portal`),t(`react.fragment`),t(`react.strict_mode`),t(`react.profiler`),t(`react.provider`),t(`react.context`),t(`react.forward_ref`),t(`react.suspense`),t(`react.suspense_list`),t(`react.memo`),t(`react.lazy`),t(`react.block`),t(`react.server.block`),t(`react.fundamental`),t(`react.debug_trace_mode`),t(`react.legacy_hidden`)}})),_P=t(((e,t)=>{t.exports=gP()})),vP=e=>typeof e==`object`&&!!e&&e.nodeType===1,yP=(e,t)=>(!t||e!==`hidden`)&&e!==`visible`&&e!==`clip`,bP=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return yP(n.overflowY,t)||yP(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch{return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},xP=(e,t,n,r,i,a,o,s)=>a<e&&o>t||a>e&&o<t?0:a<=e&&s<=n||o>=t&&s>=n?a-e-r:o>t&&s<n||a<e&&s>n?o-t+i:0,SP=e=>e.parentElement??(e.getRootNode().host||null),CP=(e,t)=>{if(typeof document>`u`)return[];let{scrollMode:n,block:r,inline:i,boundary:a,skipOverflowHiddenElements:o}=t,s=typeof a==`function`?a:e=>e!==a;if(!vP(e))throw TypeError(`Invalid target`);let c=document.scrollingElement||document.documentElement,l=[],u=e;for(;vP(u)&&s(u);){if(u=SP(u),u===c){l.push(u);break}u!=null&&u===document.body&&bP(u)&&!bP(document.documentElement)||u!=null&&bP(u,o)&&l.push(u)}let d=window.visualViewport?.width??innerWidth,f=window.visualViewport?.height??innerHeight,p=window.scrollX??pageXOffset,m=window.scrollY??pageYOffset,{height:h,width:g,top:_,right:v,bottom:y,left:b}=e.getBoundingClientRect(),x=r===`start`||r===`nearest`?_:r===`end`?y:_+h/2,S=i===`center`?b+g/2:i===`end`?v:b,C=[];for(let e=0;e<l.length;e++){let t=l[e],{height:a,width:o,top:s,right:u,bottom:w,left:T}=t.getBoundingClientRect();if(n===`if-needed`&&_>=0&&b>=0&&y<=f&&v<=d&&_>=s&&y<=w&&b>=T&&v<=u)return C;let E=getComputedStyle(t),ee=parseInt(E.borderLeftWidth,10),D=parseInt(E.borderTopWidth,10),te=parseInt(E.borderRightWidth,10),ne=parseInt(E.borderBottomWidth,10),re=0,ie=0,ae=`offsetWidth`in t?t.offsetWidth-t.clientWidth-ee-te:0,oe=`offsetHeight`in t?t.offsetHeight-t.clientHeight-D-ne:0,se=`offsetWidth`in t?t.offsetWidth===0?0:o/t.offsetWidth:0,ce=`offsetHeight`in t?t.offsetHeight===0?0:a/t.offsetHeight:0;if(c===t)re=r===`start`?x:r===`end`?x-f:r===`nearest`?xP(m,m+f,f,D,ne,m+x,m+x+h,h):x-f/2,ie=i===`start`?S:i===`center`?S-d/2:i===`end`?S-d:xP(p,p+d,d,ee,te,p+S,p+S+g,g),re=Math.max(0,re+m),ie=Math.max(0,ie+p);else{re=r===`start`?x-s-D:r===`end`?x-w+ne+oe:r===`nearest`?xP(s,w,a,D,ne+oe,x,x+h,h):x-(s+a/2)+oe/2,ie=i===`start`?S-T-ee:i===`center`?S-(T+o/2)+ae/2:i===`end`?S-u+te+ae:xP(T,u,o,ee,te+ae,S,S+g,g);let{scrollLeft:e,scrollTop:n}=t;re=Math.max(0,Math.min(n+re/ce,t.scrollHeight-a/ce+oe)),ie=Math.max(0,Math.min(e+ie/se,t.scrollWidth-o/se+ae)),x+=n-re,S+=e-ie}C.push({el:t,top:re,left:ie})}return C},Q=e(hP());_P();var wP=0;function TP(){}function EP(e,t){e&&CP(e,{boundary:t,block:`nearest`,scrollMode:`if-needed`}).forEach(function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r})}function DP(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function OP(e,t){var n;function r(){n&&clearTimeout(n)}function i(){var i=[...arguments];r(),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}return i.cancel=r,i}function kP(){var e=[...arguments];return function(t){var n=[...arguments].slice(1);return e.some(function(e){return e&&e.apply(void 0,[t].concat(n)),t.preventDownshiftDefault||t.hasOwnProperty(`nativeEvent`)&&t.nativeEvent.preventDownshiftDefault})}}function AP(){var e=[...arguments];return function(t){e.forEach(function(e){typeof e==`function`?e(t):e&&(e.current=t)})}}function jP(){return String(wP++)}function MP(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n===r?``:n+` result`+(n===1?` is`:`s are`)+` available, use up and down arrow keys to navigate. Press Enter key to select.`:`No results are available.`:``}function NP(e,t){return Object.keys(e).reduce(function(n,r){return n[r]=PP(t,r)?t[r]:e[r],n},{})}function PP(e,t){return e[t]!==void 0}function FP(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf(`Arrow`)!==0?`Arrow`+t:t}function IP(e,t,n,r,i){if(i===void 0&&(i=!0),n===0)return-1;var a=n-1;(typeof t!=`number`||t<0||t>=n)&&(t=e>0?-1:a+1);var o=t+e;o<0?o=i?a:0:o>a&&(o=i?0:a);var s=LP(e,o,n,r,i);return s===-1?t>=n?-1:t:s}function LP(e,t,n,r,i){var a=r(t);if(!a||!a.hasAttribute(`disabled`))return t;if(e>0){for(var o=t+1;o<n;o++)if(!r(o).hasAttribute(`disabled`))return o}else for(var s=t-1;s>=0;s--)if(!r(s).hasAttribute(`disabled`))return s;return i?e>0?LP(1,0,n,r,!1):LP(-1,n-1,n,r,!1):-1}function RP(e,t,n,r){return r===void 0&&(r=!0),t.some(function(t){return t&&(DP(t,e,n)||r&&DP(t,n.document.activeElement,n))})}var zP=OP(function(e){VP(e).textContent=``},500);function BP(e,t){var n=VP(t);e&&(n.textContent=e,zP(t))}function VP(e){e===void 0&&(e=document);var t=e.getElementById(`a11y-status-message`);return t||(t=e.createElement(`div`),t.setAttribute(`id`,`a11y-status-message`),t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-relevant`,`additions text`),Object.assign(t.style,{border:`0`,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:`0`,position:`absolute`,width:`1px`}),e.body.appendChild(t),t)}var HP=[`isInitialMount`,`highlightedIndex`,`items`,`environment`],UP={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:``};function WP(e,t,n){var r=e.props,i=e.type,a={};Object.keys(t).forEach(function(r){GP(r,e,t,n),n[r]!==t[r]&&(a[r]=n[r])}),r.onStateChange&&Object.keys(a).length&&r.onStateChange(Z({type:i},a))}function GP(e,t,n,r){var i=t.props,a=t.type,o=`on`+eF(e)+`Change`;i[o]&&r[e]!==void 0&&r[e]!==n[e]&&i[o](Z({type:a},r))}function KP(e,t){return t.changes}function qP(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+` has been selected.`:``}var JP=OP(function(e,t){BP(e(),t)},200),YP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?k.useLayoutEffect:k.useEffect;function XP(e){var t=e.id,n=t===void 0?`downshift-`+jP():t,r=e.labelId,i=e.menuId,a=e.getItemId,o=e.toggleButtonId,s=e.inputId;return(0,k.useRef)({labelId:r||n+`-label`,menuId:i||n+`-menu`,getItemId:a||function(e){return n+`-item-`+e},toggleButtonId:o||n+`-toggle-button`,inputId:s||n+`-input`}).current}function ZP(e,t,n,r){var i,a;if(e===void 0){if(t===void 0)throw Error(r);i=n[t],a=t}else a=t===void 0?n.indexOf(e):t,i=e;return[i,a]}function QP(e){return e?String(e):``}function $P(e){return/^\S{1}$/.test(e)}function eF(e){return``+e.slice(0,1).toUpperCase()+e.slice(1)}function tF(e){var t=(0,k.useRef)(e);return t.current=e,t}function nF(e,t,n){var r=(0,k.useRef)(),i=(0,k.useRef)(),a=(0,k.useCallback)(function(t,n){i.current=n,t=NP(t,n.props);var r=e(t,n);return n.props.stateReducer(t,Z({},n,{changes:r}))},[e]),o=(0,k.useReducer)(a,t),s=o[0],c=o[1],l=tF(n),u=(0,k.useCallback)(function(e){return c(Z({props:l.current},e))},[l]),d=i.current;return(0,k.useEffect)(function(){d&&r.current&&r.current!==s&&WP(d,NP(r.current,d.props),s),r.current=s},[s,n,d]),[s,u]}function rF(e,t,n){var r=nF(e,t,n),i=r[0],a=r[1];return[NP(i,n),a]}var iF={itemToString:QP,stateReducer:KP,getA11ySelectionMessage:qP,scrollIntoView:EP,environment:typeof window>`u`?{}:window};function aF(e,t,n){n===void 0&&(n=UP);var r=e[`default`+eF(t)];return r===void 0?n[t]:r}function oF(e,t,n){n===void 0&&(n=UP);var r=e[t];if(r!==void 0)return r;var i=e[`initial`+eF(t)];return i===void 0?aF(e,t,n):i}function sF(e){var t=oF(e,`selectedItem`),n=oF(e,`isOpen`),r=oF(e,`highlightedIndex`),i=oF(e,`inputValue`);return{highlightedIndex:r<0&&t&&n?e.items.indexOf(t):r,isOpen:n,selectedItem:t,inputValue:i}}function cF(e,t,n){var r=e.items,i=e.initialHighlightedIndex,a=e.defaultHighlightedIndex,o=t.selectedItem,s=t.highlightedIndex;return r.length===0?-1:i!==void 0&&s===i?i:a===void 0?o?r.indexOf(o):n===0?-1:n<0?r.length-1:0:a}function lF(e,t,n,r){var i=(0,k.useRef)({isMouseDown:!1,isTouchMove:!1});return(0,k.useEffect)(function(){if(n?.addEventListener!=null){var a=function(){i.current.isMouseDown=!0},o=function(a){i.current.isMouseDown=!1,e&&!RP(a.target,t.map(function(e){return e.current}),n)&&r()},s=function(){i.current.isTouchMove=!1},c=function(){i.current.isTouchMove=!0},l=function(a){e&&!i.current.isTouchMove&&!RP(a.target,t.map(function(e){return e.current}),n,!1)&&r()};return n.addEventListener(`mousedown`,a),n.addEventListener(`mouseup`,o),n.addEventListener(`touchstart`,s),n.addEventListener(`touchmove`,c),n.addEventListener(`touchend`,l),function(){n.removeEventListener(`mousedown`,a),n.removeEventListener(`mouseup`,o),n.removeEventListener(`touchstart`,s),n.removeEventListener(`touchmove`,c),n.removeEventListener(`touchend`,l)}}},[e,n]),i}var uF=function(){return TP};function dF(e,t,n){var r=n.isInitialMount,i=n.highlightedIndex,a=n.items,o=n.environment,s=fP(n,HP);(0,k.useEffect)(function(){r||JP(function(){return e(Z({highlightedIndex:i,highlightedItem:a[i],resultCount:a.length},s))},o.document)},t)}function fF(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,a=e.menuElement,o=e.scrollIntoView,s=(0,k.useRef)(!0);return YP(function(){t<0||!n||!Object.keys(r.current).length||(s.current===!1?s.current=!0:o(i(t),a))},[t]),s}var pF=TP;function mF(e,t,n){n===void 0&&(n=!0);var r=e.items?.length&&t>=0;return Z({isOpen:!1,highlightedIndex:-1},r&&Z({selectedItem:e.items[t],isOpen:aF(e,`isOpen`),highlightedIndex:aF(e,`highlightedIndex`)},n&&{inputValue:e.itemToString(e.items[t])}))}function hF(e,t,n){var r=t.type,i=t.props,a;switch(r){case n.ItemMouseMove:a={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:a={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:a={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:cF(i,e,0)};break;case n.FunctionOpenMenu:a={isOpen:!0,highlightedIndex:cF(i,e,0)};break;case n.FunctionCloseMenu:a={isOpen:!1};break;case n.FunctionSetHighlightedIndex:a={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:a={inputValue:t.inputValue};break;case n.FunctionReset:a={highlightedIndex:aF(i,`highlightedIndex`),isOpen:aF(i,`isOpen`),selectedItem:aF(i,`selectedItem`),inputValue:aF(i,`inputValue`)};break;default:throw Error(`Reducer called without proper action type.`)}return Z({},e,a)}function gF(e){for(var t=e.keysSoFar,n=e.highlightedIndex,r=e.items,i=e.itemToString,a=e.getItemNodeFromIndex,o=t.toLowerCase(),s=0;s<r.length;s++){var c=(s+n+ +(t.length<2))%r.length,l=r[c];if(l!==void 0&&i(l).toLowerCase().startsWith(o)&&!a(c)?.hasAttribute(`disabled`))return c}return n}Q.default.array.isRequired,Q.default.func,Q.default.func,Q.default.func,Q.default.number,Q.default.number,Q.default.number,Q.default.bool,Q.default.bool,Q.default.bool,Q.default.any,Q.default.any,Q.default.any,Q.default.string,Q.default.string,Q.default.string,Q.default.func,Q.default.string,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.shape({addEventListener:Q.default.func,removeEventListener:Q.default.func,document:Q.default.shape({getElementById:Q.default.func,activeElement:Q.default.any,body:Q.default.any})});function _F(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n===r?``:`${n} result${n===1?` is`:`s are`} available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.`:`No results are available.`:``}var vF=uD(uD({},iF),{getA11yStatusMessage:_F}),yF=TP,bF=0,xF=1,SF=2,CF=3,wF=4,TF=5,EF=6,DF=7,OF=8,kF=9,AF=10,jF=11,MF=12,NF=13,PF=14,FF=15,IF=16,LF=17,RF=18,zF=19,BF=20,VF=21,HF=Object.freeze({__proto__:null,ToggleButtonClick:bF,ToggleButtonKeyDownArrowDown:xF,ToggleButtonKeyDownArrowUp:SF,ToggleButtonKeyDownCharacter:CF,ToggleButtonKeyDownEscape:wF,ToggleButtonKeyDownHome:TF,ToggleButtonKeyDownEnd:EF,ToggleButtonKeyDownEnter:DF,ToggleButtonKeyDownSpaceButton:OF,ToggleButtonKeyDownPageUp:kF,ToggleButtonKeyDownPageDown:AF,ToggleButtonBlur:jF,MenuMouseLeave:MF,ItemMouseMove:NF,ItemClick:PF,FunctionToggleMenu:FF,FunctionOpenMenu:IF,FunctionCloseMenu:LF,FunctionSetHighlightedIndex:RF,FunctionSelectItem:zF,FunctionSetInputValue:BF,FunctionReset:VF});function UF(e,t){var n=t.type,r=t.props,i=t.altKey,a;switch(n){case PF:a={isOpen:aF(r,`isOpen`),highlightedIndex:aF(r,`highlightedIndex`),selectedItem:r.items[t.index]};break;case CF:var o=t.key,s=``+e.inputValue+o;a={inputValue:s,highlightedIndex:gF({keysSoFar:s,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex}),isOpen:!0};break;case xF:a={highlightedIndex:e.isOpen?IP(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):i&&e.selectedItem==null?-1:cF(r,e,1),isOpen:!0};break;case SF:a=e.isOpen&&i?mF(r,e.highlightedIndex,!1):{highlightedIndex:e.isOpen?IP(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):cF(r,e,-1),isOpen:!0};break;case DF:case OF:a=mF(r,e.highlightedIndex,!1);break;case TF:a={highlightedIndex:LP(1,0,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case EF:a={highlightedIndex:LP(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case kF:a={highlightedIndex:IP(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case AF:a={highlightedIndex:IP(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case wF:a={isOpen:!1,highlightedIndex:-1};break;case jF:a=Z({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&r.items?.length&&{selectedItem:r.items[e.highlightedIndex]});break;case zF:a={selectedItem:t.selectedItem};break;default:return hF(e,t,HF)}return Z({},e,a)}var WF=[`onMouseLeave`,`refKey`,`onKeyDown`,`onBlur`,`ref`],GF=[`onBlur`,`onClick`,`onPress`,`onKeyDown`,`refKey`,`ref`],KF=[`item`,`index`,`onMouseMove`,`onClick`,`onPress`,`refKey`,`ref`,`disabled`];qF.stateChangeTypes=HF;function qF(e){e===void 0&&(e={}),yF(e,qF);var t=Z({},vF,e),n=t.items,r=t.scrollIntoView,i=t.environment,a=t.itemToString,o=t.getA11ySelectionMessage,s=t.getA11yStatusMessage,c=rF(UF,sF(t),t),l=c[0],u=c[1],d=l.isOpen,f=l.highlightedIndex,p=l.selectedItem,m=l.inputValue,h=(0,k.useRef)(null),g=(0,k.useRef)(null),_=(0,k.useRef)({}),v=(0,k.useRef)(null),y=XP(t),b=(0,k.useRef)(),x=(0,k.useRef)(!0),S=tF({state:l,props:t}),C=(0,k.useCallback)(function(e){return _.current[y.getItemId(e)]},[y]);dF(s,[d,f,m,n],Z({isInitialMount:x.current,previousResultCount:b.current,items:n,environment:i,itemToString:a},l)),dF(o,[p],Z({isInitialMount:x.current,previousResultCount:b.current,items:n,environment:i,itemToString:a},l));var w=fF({menuElement:g.current,highlightedIndex:f,isOpen:d,itemRefs:_,scrollIntoView:r,getItemNodeFromIndex:C});(0,k.useEffect)(function(){return v.current=OP(function(e){e({type:BF,inputValue:``})},500),function(){v.current.cancel()}},[]),(0,k.useEffect)(function(){m&&v.current(u)},[u,m]),pF({isInitialMount:x.current,props:t,state:l}),(0,k.useEffect)(function(){x.current||(b.current=n.length)});var T=lF(d,[g,h],i,function(){u({type:jF})}),E=uF(`getMenuProps`,`getToggleButtonProps`);(0,k.useEffect)(function(){return x.current=!1,function(){x.current=!0}},[]),(0,k.useEffect)(function(){d||(_.current={})},[d]);var ee=(0,k.useMemo)(function(){return{ArrowDown:function(e){e.preventDefault(),u({type:xF,getItemNodeFromIndex:C,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),u({type:SF,getItemNodeFromIndex:C,altKey:e.altKey})},Home:function(e){e.preventDefault(),u({type:TF,getItemNodeFromIndex:C})},End:function(e){e.preventDefault(),u({type:EF,getItemNodeFromIndex:C})},Escape:function(){S.current.state.isOpen&&u({type:wF})},Enter:function(e){e.preventDefault(),u({type:S.current.state.isOpen?DF:bF})},PageUp:function(e){S.current.state.isOpen&&(e.preventDefault(),u({type:kF,getItemNodeFromIndex:C}))},PageDown:function(e){S.current.state.isOpen&&(e.preventDefault(),u({type:AF,getItemNodeFromIndex:C}))}," ":function(e){e.preventDefault();var t=S.current.state;t.isOpen?t.inputValue?u({type:CF,key:` `,getItemNodeFromIndex:C}):u({type:OF}):u({type:bF})}}},[u,C,S]),D=(0,k.useCallback)(function(){u({type:FF})},[u]),te=(0,k.useCallback)(function(){u({type:LF})},[u]),ne=(0,k.useCallback)(function(){u({type:IF})},[u]),re=(0,k.useCallback)(function(e){u({type:RF,highlightedIndex:e})},[u]),ie=(0,k.useCallback)(function(e){u({type:zF,selectedItem:e})},[u]),ae=(0,k.useCallback)(function(){u({type:VF})},[u]),oe=(0,k.useCallback)(function(e){u({type:BF,inputValue:e})},[u]),se=(0,k.useCallback)(function(e){return Z({id:y.labelId,htmlFor:y.toggleButtonId},e)},[y]),ce=(0,k.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onMouseLeave,a=r.refKey,o=a===void 0?`ref`:a;r.onKeyDown,r.onBlur;var s=r.ref,c=fP(r,WF),l=(t===void 0?{}:t).suppressRefError;return E(`getMenuProps`,l!==void 0&&l,o,g),Z((n={},n[o]=AP(s,function(e){g.current=e}),n.id=y.menuId,n.role=`listbox`,n[`aria-labelledby`]=c&&c[`aria-label`]?void 0:``+y.labelId,n.onMouseLeave=kP(i,function(){u({type:MF})}),n),c)},[u,E,y]);return{getToggleButtonProps:(0,k.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onBlur,a=r.onClick;r.onPress;var o=r.onKeyDown,s=r.refKey,c=s===void 0?`ref`:s,l=r.ref,d=fP(r,GF),f=(t===void 0?{}:t).suppressRefError,p=f!==void 0&&f,m=S.current.state,g=function(){u({type:bF})},_=function(){m.isOpen&&!T.current.isMouseDown&&u({type:jF})},v=function(e){var t=FP(e);t&&ee[t]?ee[t](e):$P(t)&&u({type:CF,key:t,getItemNodeFromIndex:C})},b=Z((n={},n[c]=AP(l,function(e){h.current=e}),n[`aria-activedescendant`]=m.isOpen&&m.highlightedIndex>-1?y.getItemId(m.highlightedIndex):``,n[`aria-controls`]=y.menuId,n[`aria-expanded`]=S.current.state.isOpen,n[`aria-haspopup`]=`listbox`,n[`aria-labelledby`]=d&&d[`aria-label`]?void 0:``+y.labelId,n.id=y.toggleButtonId,n.role=`combobox`,n.tabIndex=0,n.onBlur=kP(i,_),n),d);return d.disabled||(b.onClick=kP(a,g),b.onKeyDown=kP(o,v)),E(`getToggleButtonProps`,p,c,h),b},[S,y,E,u,T,ee,C]),getLabelProps:se,getMenuProps:ce,getItemProps:(0,k.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.item,i=n.index,a=n.onMouseMove,o=n.onClick;n.onPress;var s=n.refKey,c=s===void 0?`ref`:s,l=n.ref,d=n.disabled,f=fP(n,KF),m=S.current,h=m.state,g=m.props,v=ZP(r,i,g.items,`Pass either item or index to getItemProps!`),b=v[0],x=v[1],C=function(){x!==h.highlightedIndex&&(w.current=!1,u({type:NF,index:x,disabled:d}))},T=function(){u({type:PF,index:x})},E=Z((t={disabled:d,role:`option`,"aria-selected":``+(b===p),id:y.getItemId(x)},t[c]=AP(l,function(e){e&&(_.current[y.getItemId(x)]=e)}),t),f);return d||(E.onClick=kP(o,T)),E.onMouseMove=kP(a,C),E},[S,p,y,w,u]),toggleMenu:D,openMenu:ne,closeMenu:te,setHighlightedIndex:re,selectItem:ie,reset:ae,setInputValue:oe,highlightedIndex:f,isOpen:d,selectedItem:p,inputValue:m}}var JF=0,YF=1,XF=2,ZF=3,QF=4,$F=5,eI=6,tI=7,nI=8,rI=9,iI=10,aI=11,oI=12,sI=13,cI=14,lI=15,uI=16,dI=17,fI=18,pI=19,mI=20,hI=21,gI=22,_I=Object.freeze({__proto__:null,InputKeyDownArrowDown:JF,InputKeyDownArrowUp:YF,InputKeyDownEscape:XF,InputKeyDownHome:ZF,InputKeyDownEnd:QF,InputKeyDownPageUp:$F,InputKeyDownPageDown:eI,InputKeyDownEnter:tI,InputChange:nI,InputBlur:rI,InputFocus:iI,MenuMouseLeave:aI,ItemMouseMove:oI,ItemClick:sI,ToggleButtonClick:cI,FunctionToggleMenu:lI,FunctionOpenMenu:uI,FunctionCloseMenu:dI,FunctionSetHighlightedIndex:fI,FunctionSelectItem:pI,FunctionSetInputValue:mI,FunctionReset:hI,ControlledPropUpdatedSelectedItem:gI});function vI(e){var t=sF(e),n=t.selectedItem,r=t.inputValue;return r===``&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),Z({},t,{inputValue:r})}Q.default.array.isRequired,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.number,Q.default.number,Q.default.number,Q.default.bool,Q.default.bool,Q.default.bool,Q.default.any,Q.default.any,Q.default.any,Q.default.string,Q.default.string,Q.default.string,Q.default.string,Q.default.string,Q.default.string,Q.default.func,Q.default.string,Q.default.string,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.func,Q.default.shape({addEventListener:Q.default.func,removeEventListener:Q.default.func,document:Q.default.shape({getElementById:Q.default.func,activeElement:Q.default.any,body:Q.default.any})});function yI(e,t,n){var r=(0,k.useRef)(),i=nF(e,t,n),a=i[0],o=i[1];return(0,k.useEffect)(function(){PP(n,`selectedItem`)&&(n.selectedItemChanged(r.current,n.selectedItem)&&o({type:gI,inputValue:n.itemToString(n.selectedItem)}),r.current=a.selectedItem===r.current?n.selectedItem:a.selectedItem)},[a.selectedItem,n.selectedItem]),[NP(a,n),o]}var bI=TP,xI=Z({},iF,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:MP});function SI(e,t){var n=t.type,r=t.props,i=t.altKey,a;switch(n){case sI:a={isOpen:aF(r,`isOpen`),highlightedIndex:aF(r,`highlightedIndex`),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case JF:a=e.isOpen?{highlightedIndex:IP(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:i&&e.selectedItem==null?-1:cF(r,e,1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case YF:a=e.isOpen?i?mF(r,e.highlightedIndex):{highlightedIndex:IP(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:cF(r,e,-1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case tI:a=mF(r,e.highlightedIndex);break;case XF:a=Z({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:``});break;case $F:a={highlightedIndex:IP(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case eI:a={highlightedIndex:IP(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case ZF:a={highlightedIndex:LP(1,0,r.items.length,t.getItemNodeFromIndex,!1)};break;case QF:a={highlightedIndex:LP(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1)};break;case rI:a=Z({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&r.items?.length&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case nI:a={isOpen:!0,highlightedIndex:aF(r,`highlightedIndex`),inputValue:t.inputValue};break;case iI:a={isOpen:!0,highlightedIndex:cF(r,e,0)};break;case pI:a={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case gI:a={inputValue:t.inputValue};break;default:return hF(e,t,_I)}return Z({},e,a)}var CI=[`onMouseLeave`,`refKey`,`ref`],wI=[`item`,`index`,`refKey`,`ref`,`onMouseMove`,`onMouseDown`,`onClick`,`onPress`,`disabled`],TI=[`onClick`,`onPress`,`refKey`,`ref`],EI=[`onKeyDown`,`onChange`,`onInput`,`onFocus`,`onBlur`,`onChangeText`,`refKey`,`ref`];DI.stateChangeTypes=_I;function DI(e){e===void 0&&(e={}),bI(e,DI);var t=Z({},xI,e),n=t.initialIsOpen,r=t.defaultIsOpen,i=t.items,a=t.scrollIntoView,o=t.environment,s=t.getA11yStatusMessage,c=t.getA11ySelectionMessage,l=t.itemToString,u=yI(SI,vI(t),t),d=u[0],f=u[1],p=d.isOpen,m=d.highlightedIndex,h=d.selectedItem,g=d.inputValue,_=(0,k.useRef)(null),v=(0,k.useRef)({}),y=(0,k.useRef)(null),b=(0,k.useRef)(null),x=(0,k.useRef)(!0),S=XP(t),C=(0,k.useRef)(),w=tF({state:d,props:t}),T=(0,k.useCallback)(function(e){return v.current[S.getItemId(e)]},[S]);dF(s,[p,m,g,i],Z({isInitialMount:x.current,previousResultCount:C.current,items:i,environment:o,itemToString:l},d)),dF(c,[h],Z({isInitialMount:x.current,previousResultCount:C.current,items:i,environment:o,itemToString:l},d));var E=fF({menuElement:_.current,highlightedIndex:m,isOpen:p,itemRefs:v,scrollIntoView:a,getItemNodeFromIndex:T});pF({isInitialMount:x.current,props:t,state:d}),(0,k.useEffect)(function(){(n||r||p)&&y.current&&y.current.focus()},[]),(0,k.useEffect)(function(){x.current||(C.current=i.length)});var ee=lF(p,[y,_,b],o,function(){f({type:rI,selectItem:!1})}),D=uF(`getInputProps`,`getMenuProps`);(0,k.useEffect)(function(){return x.current=!1,function(){x.current=!0}},[]),(0,k.useEffect)(function(){if(!p)v.current={};else if(o.document?.activeElement!==y.current){var e;y==null||(e=y.current)==null||e.focus()}},[p,o]);var te=(0,k.useMemo)(function(){return{ArrowDown:function(e){e.preventDefault(),f({type:JF,altKey:e.altKey,getItemNodeFromIndex:T})},ArrowUp:function(e){e.preventDefault(),f({type:YF,altKey:e.altKey,getItemNodeFromIndex:T})},Home:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:ZF,getItemNodeFromIndex:T}))},End:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:QF,getItemNodeFromIndex:T}))},Escape:function(e){var t=w.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),f({type:XF}))},Enter:function(e){w.current.state.isOpen&&e.which!==229&&(e.preventDefault(),f({type:tI,getItemNodeFromIndex:T}))},PageUp:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:$F,getItemNodeFromIndex:T}))},PageDown:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:eI,getItemNodeFromIndex:T}))}}},[f,w,T]),ne=(0,k.useCallback)(function(e){return Z({id:S.labelId,htmlFor:S.inputId},e)},[S]),re=(0,k.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onMouseLeave,a=r.refKey,o=a===void 0?`ref`:a,s=r.ref,c=fP(r,CI),l=(t===void 0?{}:t).suppressRefError;return D(`getMenuProps`,l!==void 0&&l,o,_),Z((n={},n[o]=AP(s,function(e){_.current=e}),n.id=S.menuId,n.role=`listbox`,n[`aria-labelledby`]=c&&c[`aria-label`]?void 0:``+S.labelId,n.onMouseLeave=kP(i,function(){f({type:aI})}),n),c)},[f,D,S]),ie=(0,k.useCallback)(function(e){var t,n,r=e===void 0?{}:e,i=r.item,a=r.index,o=r.refKey,s=o===void 0?`ref`:o,c=r.ref,l=r.onMouseMove,u=r.onMouseDown,d=r.onClick;r.onPress;var p=r.disabled,m=fP(r,wI),h=w.current,g=h.props,_=h.state,y=ZP(i,a,g.items,`Pass either item or index to getItemProps!`)[1],b=`onClick`,x=d;return Z((t={},t[s]=AP(c,function(e){e&&(v.current[S.getItemId(y)]=e)}),t.disabled=p,t.role=`option`,t[`aria-selected`]=``+(y===_.highlightedIndex),t.id=S.getItemId(y),t),!p&&(n={},n[b]=kP(x,function(){f({type:sI,index:y})}),n),{onMouseMove:kP(l,function(){y!==_.highlightedIndex&&(E.current=!1,f({type:oI,index:y,disabled:p}))}),onMouseDown:kP(u,function(e){return e.preventDefault()})},m)},[f,w,E,S]),ae=(0,k.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.onClick;n.onPress;var i=n.refKey,a=i===void 0?`ref`:i,o=n.ref,s=fP(n,TI),c=w.current.state;return Z((t={},t[a]=AP(o,function(e){b.current=e}),t[`aria-controls`]=S.menuId,t[`aria-expanded`]=c.isOpen,t.id=S.toggleButtonId,t.tabIndex=-1,t),!s.disabled&&Z({},{onClick:kP(r,function(){f({type:cI})})}),s)},[f,w,S]),oe=(0,k.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onKeyDown,a=r.onChange,s=r.onInput,c=r.onFocus,l=r.onBlur;r.onChangeText;var u=r.refKey,d=u===void 0?`ref`:u,p=r.ref,m=fP(r,EI),h=(t===void 0?{}:t).suppressRefError;D(`getInputProps`,h!==void 0&&h,d,y);var g=w.current.state,_=function(e){var t=FP(e);t&&te[t]&&te[t](e)},v=function(e){f({type:nI,inputValue:e.target.value})},b=function(e){g.isOpen&&!ee.current.isMouseDown&&f({type:rI,selectItem:e.relatedTarget!==null||o.document.activeElement===o.document.body})},x=function(){g.isOpen||f({type:iI})},C=`onChange`,T={};if(!m.disabled){var E;T=(E={},E[C]=kP(a,s,v),E.onKeyDown=kP(i,_),E.onBlur=kP(l,b),E.onFocus=kP(c,x),E)}return Z((n={},n[d]=AP(p,function(e){y.current=e}),n[`aria-activedescendant`]=g.isOpen&&g.highlightedIndex>-1?S.getItemId(g.highlightedIndex):``,n[`aria-autocomplete`]=`list`,n[`aria-controls`]=S.menuId,n[`aria-expanded`]=g.isOpen,n[`aria-labelledby`]=m&&m[`aria-label`]?void 0:``+S.labelId,n.autoComplete=`off`,n.id=S.inputId,n.role=`combobox`,n.value=g.inputValue,n),T,m)},[D,w,S,te,f,ee,o]),se=(0,k.useCallback)(function(){f({type:lI})},[f]),ce=(0,k.useCallback)(function(){f({type:dI})},[f]),le=(0,k.useCallback)(function(){f({type:uI})},[f]),ue=(0,k.useCallback)(function(e){f({type:fI,highlightedIndex:e})},[f]),de=(0,k.useCallback)(function(e){f({type:pI,selectedItem:e})},[f]);return{getItemProps:ie,getLabelProps:ne,getMenuProps:re,getInputProps:oe,getToggleButtonProps:ae,toggleMenu:se,openMenu:le,closeMenu:ce,setHighlightedIndex:ue,setInputValue:(0,k.useCallback)(function(e){f({type:mI,inputValue:e})},[f]),selectItem:de,reset:(0,k.useCallback)(function(){f({type:hI})},[f]),highlightedIndex:m,isOpen:p,selectedItem:h,inputValue:g}}var OI={activeIndex:-1,selectedItems:[]};function kI(e,t){return oF(e,t,OI)}function AI(e,t){return aF(e,t,OI)}function jI(e){return{activeIndex:kI(e,`activeIndex`),selectedItems:kI(e,`selectedItems`)}}function MI(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&t.value!==``&&(t.selectionStart!==0||t.selectionEnd!==0))}function NI(e){var t=e.removedSelectedItem,n=e.itemToString;return n(t)+` has been removed.`}Q.default.array,Q.default.array,Q.default.array,Q.default.func,Q.default.func,Q.default.func,Q.default.number,Q.default.number,Q.default.number,Q.default.func,Q.default.func,Q.default.string,Q.default.string,Q.default.shape({addEventListener:Q.default.func,removeEventListener:Q.default.func,document:Q.default.shape({getElementById:Q.default.func,activeElement:Q.default.any,body:Q.default.any})});var PI={itemToString:iF.itemToString,stateReducer:iF.stateReducer,environment:iF.environment,getA11yRemovalMessage:NI,keyNavigationNext:`ArrowRight`,keyNavigationPrevious:`ArrowLeft`},FI=TP,II=0,LI=1,RI=2,zI=3,BI=4,VI=5,HI=6,UI=7,WI=8,GI=9,KI=10,qI=11,JI=12,YI=Object.freeze({__proto__:null,SelectedItemClick:II,SelectedItemKeyDownDelete:LI,SelectedItemKeyDownBackspace:RI,SelectedItemKeyDownNavigationNext:zI,SelectedItemKeyDownNavigationPrevious:BI,DropdownKeyDownNavigationPrevious:VI,DropdownKeyDownBackspace:HI,DropdownClick:UI,FunctionAddSelectedItem:WI,FunctionRemoveSelectedItem:GI,FunctionSetSelectedItems:KI,FunctionSetActiveIndex:qI,FunctionReset:JI});function XI(e,t){var n=t.type,r=t.index,i=t.props,a=t.selectedItem,o=e.activeIndex,s=e.selectedItems,c;switch(n){case II:c={activeIndex:r};break;case BI:c={activeIndex:o-1<0?0:o-1};break;case zI:c={activeIndex:o+1>=s.length?-1:o+1};break;case RI:case LI:if(o<0)break;var l=o;s.length===1?l=-1:o===s.length-1&&(l=s.length-2),c=Z({selectedItems:[].concat(s.slice(0,o),s.slice(o+1))},{activeIndex:l});break;case VI:c={activeIndex:s.length-1};break;case HI:c={selectedItems:s.slice(0,s.length-1)};break;case WI:c={selectedItems:[].concat(s,[a])};break;case UI:c={activeIndex:-1};break;case GI:var u=o,d=s.indexOf(a);if(d<0)break;s.length===1?u=-1:d===s.length-1&&(u=s.length-2),c={selectedItems:[].concat(s.slice(0,d),s.slice(d+1)),activeIndex:u};break;case KI:c={selectedItems:t.selectedItems};break;case qI:c={activeIndex:t.activeIndex};break;case JI:c={activeIndex:AI(i,`activeIndex`),selectedItems:AI(i,`selectedItems`)};break;default:throw Error(`Reducer called without proper action type.`)}return Z({},e,c)}var ZI=[`refKey`,`ref`,`onClick`,`onKeyDown`,`selectedItem`,`index`],QI=[`refKey`,`ref`,`onKeyDown`,`onClick`,`preventKeyAction`];$I.stateChangeTypes=YI;function $I(e){e===void 0&&(e={}),FI(e,$I);var t=Z({},PI,e),n=t.getA11yRemovalMessage,r=t.itemToString,i=t.environment,a=t.keyNavigationNext,o=t.keyNavigationPrevious,s=rF(XI,jI(t),t),c=s[0],l=s[1],u=c.activeIndex,d=c.selectedItems,f=(0,k.useRef)(!0),p=(0,k.useRef)(null),m=(0,k.useRef)(d),h=(0,k.useRef)();h.current=[];var g=tF({state:c,props:t});(0,k.useEffect)(function(){if(!f.current){if(d.length<m.current.length){var e=m.current.find(function(e){return d.indexOf(e)<0});BP(n({itemToString:r,resultCount:d.length,removedSelectedItem:e,activeIndex:u,activeSelectedItem:d[u]}),i.document)}m.current=d}},[d.length]),(0,k.useEffect)(function(){f.current||(u===-1&&p.current?p.current.focus():h.current[u]&&h.current[u].focus())},[u]),pF({isInitialMount:f.current,props:t,state:c});var _=uF(`getDropdownProps`);(0,k.useEffect)(function(){return f.current=!1,function(){f.current=!0}},[]);var v=(0,k.useMemo)(function(){var e={};return e[o]=function(){l({type:BI})},e[a]=function(){l({type:zI})},e.Delete=function(){l({type:LI})},e.Backspace=function(){l({type:RI})},e},[l,a,o]),y=(0,k.useMemo)(function(){var e={};return e[o]=function(e){MI(e)&&l({type:VI})},e.Backspace=function(e){MI(e)&&l({type:HI})},e},[l,o]);return{getSelectedItemProps:(0,k.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.refKey,i=r===void 0?`ref`:r,a=n.ref,o=n.onClick,s=n.onKeyDown,c=n.selectedItem,u=n.index,d=fP(n,ZI),f=g.current.state,p=ZP(c,u,f.selectedItems,`Pass either item or index to getSelectedItemProps!`)[1],m=p>-1&&p===f.activeIndex;return Z((t={},t[i]=AP(a,function(e){e&&h.current.push(e)}),t.tabIndex=m?0:-1,t.onClick=kP(o,function(){l({type:II,index:p})}),t.onKeyDown=kP(s,function(e){var t=FP(e);t&&v[t]&&v[t](e)}),t),d)},[l,g,v]),getDropdownProps:(0,k.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.refKey,a=i===void 0?`ref`:i,o=r.ref,s=r.onKeyDown,c=r.onClick,u=r.preventKeyAction,d=u!==void 0&&u,f=fP(r,QI),m=(t===void 0?{}:t).suppressRefError;return _(`getDropdownProps`,m!==void 0&&m,a,p),Z((n={},n[a]=AP(o,function(e){e&&(p.current=e)}),n),!d&&{onKeyDown:kP(s,function(e){var t=FP(e);t&&y[t]&&y[t](e)}),onClick:kP(c,function(){l({type:UI})})},f)},[l,y,_]),addSelectedItem:(0,k.useCallback)(function(e){l({type:WI,selectedItem:e})},[l]),removeSelectedItem:(0,k.useCallback)(function(e){l({type:GI,selectedItem:e})},[l]),setSelectedItems:(0,k.useCallback)(function(e){l({type:KI,selectedItems:e})},[l]),setActiveIndex:(0,k.useCallback)(function(e){l({type:qI,activeIndex:e})},[l]),reset:(0,k.useCallback)(function(){l({type:JI})},[l]),selectedItems:d,activeIndex:u}}var eL=20,tL=e=>e.suggestions.length>0?k.createElement(nL,{...e}):k.createElement(`input`,{id:e.inputId,className:J.textInput,size:40,autoFocus:!0,...e.register(e.inputName)}),nL=({autofocus:e,inputId:t,suggestions:n,control:r,inputName:i,placeholder:a,initialInputValue:o,setValue:s})=>{let[c,l]=k.useState(n.slice(0,eL)),u=qr(zS),d=n.length>0,{isOpen:f,getToggleButtonProps:p,getMenuProps:m,getInputProps:h,highlightedIndex:g,getItemProps:_,selectedItem:v}=DI({inputId:t,initialInputValue:o,onInputValueChange({inputValue:e=``}){s(i,e),e=e.toLowerCase()||``;let t=[];for(let r of n)if(r.toLowerCase().includes(e)&&(t.push(r),t.length>=eL))break;l(t)},items:c,itemToString(e){return e??``}}),y=f&&c.length>0;return k.createElement(`div`,{className:J.downshiftAutocompleteContainer},k.createElement(`div`,{"data-visible-dropdown":y,className:J.downshiftInputWrapper},k.createElement(iN,{name:i,control:r,render:({field:t})=>{let n=h();return k.createElement(`input`,{...n,name:t.name,placeholder:a,className:J.downshiftInput,size:30,"data-editor-dialog":!0,autoFocus:e})}}),d&&k.createElement(`button`,{"aria-label":`toggle menu`,type:`button`,...p()},u(`arrow_drop_down`))),k.createElement(`div`,{className:J.downshiftAutocompleteContainer},k.createElement(`ul`,{...m(),"data-visible":y},c.map((e,t)=>k.createElement(`li`,{"data-selected":v===e,"data-highlighted":g===t,key:`${e}${t}`,..._({item:e,index:t})},e)))))},rL=()=>{let[e,t,n,r,i,a,o]=Jr(OL,PL,bS,AL,zL,NL,qx),s=Yr(BL),c=Yr(LL),l=pC(),u=k.useId(),{register:d,handleSubmit:f,control:p,setValue:m,reset:h}=uP();k.useEffect(()=>{h({src:``,title:``,altText:``,width:void 0,height:void 0,file:void 0,...t.type===`editing`?t.initialValues:{}})},[t,h]),k.useEffect(()=>()=>{c()},[c]);let g=a===`uploading`;return t.type===`inactive`?null:k.createElement($j,{open:!0,onOpenChange:e=>{e||c()}},k.createElement(rM,{container:n?.current},k.createElement(aM,{className:J.dialogOverlay}),k.createElement(lM,{className:J.dialogContent,onOpenAutoFocus:e=>{e.preventDefault()}},k.createElement(pM,null,l(`uploadImage.dialogTitle`,`Upload an image`)),k.createElement(mM,{className:J.visuallyHidden},r===null?l(`uploadImage.dialogDescriptionNoUpload`,`Insert an image from a URL.`):l(`uploadImage.dialogDescription`,`Insert an image from a URL or upload one from your device.`)),k.createElement(`form`,{onSubmit:async e=>{e.preventDefault(),e.stopPropagation(),await f(s)(e)},"aria-busy":g,className:J.multiFieldForm},k.createElement(`fieldset`,{disabled:g||o,style:{border:0,padding:0,margin:0},className:J.multiFieldForm},r===null?k.createElement(`input`,{type:`hidden`,accept:`image/*`,id:`${u}-file`,...d(`file`)}):k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-file`},l(`uploadImage.uploadInstructions`,`Upload an image from your device:`)),k.createElement(`input`,{type:`file`,accept:`image/*`,id:`${u}-file`,...d(`file`)})),k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-src`},r===null?l(`uploadImage.addViaUrlInstructionsNoUpload`,`Add an image from an URL:`):l(`uploadImage.addViaUrlInstructions`,`Or add an image from an URL:`)),k.createElement(tL,{inputId:`${u}-src`,register:d,initialInputValue:t.type===`editing`?t.initialValues.src??``:``,inputName:`src`,suggestions:e,setValue:m,control:p,placeholder:l(`uploadImage.autoCompletePlaceholder`,`Select or paste an image src`)})),k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-alt`},l(`uploadImage.alt`,`Alt:`)),k.createElement(`input`,{type:`text`,id:`${u}-alt`,...d(`altText`),className:J.textInput})),k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-title`},l(`uploadImage.title`,`Title:`)),k.createElement(`input`,{type:`text`,id:`${u}-title`,...d(`title`),className:J.textInput})),i&&k.createElement(`div`,{className:J.imageDimensionsContainer},k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-width`},l(`uploadImage.width`,`Width:`)),k.createElement(`input`,{type:`number`,min:0,id:`${u}-width`,...d(`width`),className:J.textInput})),k.createElement(`div`,{className:J.formField},k.createElement(`label`,{htmlFor:`${u}-height`},l(`uploadImage.height`,`Height:`)),k.createElement(`input`,{type:`number`,min:0,id:`${u}-height`,...d(`height`),className:J.textInput})))),g&&k.createElement(`p`,{role:`status`},k.createElement(`progress`,{"aria-label":l(`uploadImage.uploading`,`Uploading image…`)}),` `,l(`uploadImage.uploading`,`Uploading image…`)),a===`error`&&k.createElement(`p`,{role:`alert`},l(`uploadImage.uploadError`,`Image upload failed. Please try again.`)),k.createElement(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`var(--spacing-2)`}},k.createElement(`button`,{type:`submit`,disabled:g||o,title:l(`dialogControls.save`,`Save`),"aria-label":l(`dialogControls.save`,`Save`),className:(0,OC.default)(J.primaryButton)},l(`dialogControls.save`,`Save`)),k.createElement(gM,{asChild:!0},k.createElement(`button`,{type:`reset`,title:l(`dialogControls.cancel`,`Cancel`),"aria-label":l(`dialogControls.cancel`,`Cancel`),className:(0,OC.default)(J.secondaryButton)},l(`dialogControls.cancel`,`Cancel`))))))))};function iL(e,t,n){return Math.min(Math.max(e,t),n)}var aL={east:1,north:8,south:2,west:4};function oL({onResizeStart:e,onResizeEnd:t,imageRef:n,maxWidth:r,editor:i}){let a=(0,k.useRef)(null),o=(0,k.useRef)({priority:``,value:`default`}),s=(0,k.useRef)({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),c=i.getRootElement(),l=r??(c===null?100:c.getBoundingClientRect().width-20),u=c===null?100:c.getBoundingClientRect().height-20,d=e=>{let t=e===aL.east||e===aL.west,n=e===aL.north||e===aL.south,r=e&aL.north&&e&aL.west||e&aL.south&&e&aL.east,i=t?`ew`:n?`ns`:r?`nwse`:`nesw`;c!==null&&c.style.setProperty(`cursor`,`${i}-resize`,`important`),document.body!==null&&(document.body.style.setProperty(`cursor`,`${i}-resize`,`important`),o.current.value=document.body.style.getPropertyValue(`-webkit-user-select`),o.current.priority=document.body.style.getPropertyPriority(`-webkit-user-select`),document.body.style.setProperty(`-webkit-user-select`,`none`,`important`))},f=()=>{c!==null&&c.style.setProperty(`cursor`,`text`),document.body!==null&&(document.body.style.setProperty(`cursor`,`default`),document.body.style.setProperty(`-webkit-user-select`,o.current.value,o.current.priority))},p=(t,r)=>{if(!i.isEditable())return;let o=n.current,c=a.current;if(o!==null&&c!==null){t.preventDefault();let{width:n,height:i}=o.getBoundingClientRect(),a=s.current;a.startWidth=n,a.startHeight=i,a.ratio=n/i,a.currentWidth=n,a.currentHeight=i,a.startX=t.clientX,a.startY=t.clientY,a.isResizing=!0,a.direction=r,d(r),e(),c.classList.add(J.imageControlWrapperResizing),o.style.height=`${i}px`,o.style.width=`${n}px`,document.addEventListener(`pointermove`,m),document.addEventListener(`pointerup`,h)}},m=e=>{let t=n.current,r=s.current,i=r.direction&(aL.east|aL.west),a=r.direction&(aL.south|aL.north);if(t!==null&&r.isResizing){if(i&&a){let n=Math.floor(r.startX-e.clientX);n=r.direction&aL.east?-n:n;let i=iL(r.startWidth+n,100,l),a=i/r.ratio;t.style.width=`${i}px`,t.style.height=`${a}px`,r.currentHeight=a,r.currentWidth=i}else if(a){let n=Math.floor(r.startY-e.clientY);n=r.direction&aL.south?-n:n;let i=iL(r.startHeight+n,100,u);t.style.height=`${i}px`,r.currentHeight=i}else{let n=Math.floor(r.startX-e.clientX);n=r.direction&aL.east?-n:n;let i=iL(r.startWidth+n,100,l);t.style.width=`${i}px`,r.currentWidth=i}}},h=()=>{let e=n.current,r=s.current,i=a.current;if(e!==null&&i!==null&&r.isResizing){let e=r.currentWidth,n=r.currentHeight;r.startWidth=0,r.startHeight=0,r.ratio=0,r.startX=0,r.startY=0,r.currentWidth=0,r.currentHeight=0,r.isResizing=!1,i.classList.remove(J.imageControlWrapperResizing),f(),t(e,n),document.removeEventListener(`pointermove`,m),document.removeEventListener(`pointerup`,h)}};return k.createElement(`div`,{ref:a},k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerN),onPointerDown:e=>{p(e,aL.north)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerNe),onPointerDown:e=>{p(e,aL.north|aL.east)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerE),onPointerDown:e=>{p(e,aL.east)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerSe),onPointerDown:e=>{p(e,aL.south|aL.east)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerS),onPointerDown:e=>{p(e,aL.south)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerSw),onPointerDown:e=>{p(e,aL.south|aL.west)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerW),onPointerDown:e=>{p(e,aL.west)}}),k.createElement(`div`,{className:(0,OC.default)(J.imageResizer,J.imageResizerNw),onPointerDown:e=>{p(e,aL.north|aL.west)}}))}var sL=`data:image/svg+xml;charset=utf-8,%0A%20%20%20%20%3Csvg%20id%3D%22imgLoadError%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%3E%0A%20%20%20%20%20%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%22100%22%20height%3D%22100%22%20fill%3D%22none%22%20stroke%3D%22red%22%20stroke-width%3D%224%22%20stroke-dasharray%3D%224%22%20%2F%3E%0A%20%20%20%20%20%20%3Ctext%20x%3D%2250%22%20y%3D%2255%22%20text-anchor%3D%22middle%22%20font-size%3D%2220%22%20fill%3D%22red%22%3E%E2%9A%A0%EF%B8%8F%3C%2Ftext%3E%0A%20%20%20%20%3C%2Fsvg%3E%0A`,cL={__cache:{},read(e){if(this.__cache[e]||(this.__cache[e]=new Promise(t=>{let n=new Image;n.onerror=()=>{this.__cache[e]=sL,t()},n.onload=()=>{this.__cache[e]=e,t()},n.src=e})),this.__cache[e]instanceof Promise)throw this.__cache[e];return this.__cache[e]}};function lL({title:e,alt:t,className:n,imageRef:r,src:i,width:a,height:o}){return k.createElement(`img`,{className:n??void 0,alt:t,src:cL.read(i),title:e,ref:r,draggable:`false`,width:a,height:o})}function uL({src:e,title:t,alt:n,nodeKey:r,width:i,height:a,rest:o}){let[s,c,l,u,d,f]=Jr(ML,kL,zL,jL,qx,VL),p=k.useRef(null),m=k.useRef(null),[h,g,_]=XC(r),[v]=gx(),[y,b]=k.useState(null),x=k.useRef(null),[S,C]=k.useState(!1),[w,T]=k.useState(null),[E,ee]=k.useState(null),D=k.useCallback(e=>{if(h&&L(R())){e.preventDefault();let t=H(r);vL(t)&&t.remove()}return!1},[h,r]),te=k.useCallback(e=>{let t=R(),n=m.current;return h&&L(t)&&t.getNodes().length===1&&n!==null&&n!==document.activeElement?(e.preventDefault(),n.focus(),!0):!1},[h]),ne=k.useCallback(e=>m.current===e.target&&(fd(null),v.update(()=>{g(!0);let e=v.getRootElement();e!==null&&e.focus()}),!0),[v,g]);k.useEffect(()=>{u?(async()=>{E||ee(e);let t=await u(e);T(t)})().catch(e=>{console.error(e)}):T(e)},[e,u,E]),k.useEffect(()=>{if(l&&p.current){let{current:e}=p;dL(e,`width`,i),dL(e,`height`,a)}},[l,i,a]),k.useEffect(()=>{let e=!0,t=xm(v.registerUpdateListener(({editorState:t})=>{e&&b(t.read(()=>R()))}),v.registerCommand(To,(e,t)=>(x.current=t,!1),1),v.registerCommand(Do,e=>{let t=e;return S?!0:t.target===p.current&&(t.shiftKey?g(!h):(_(),g(!0)),!0)},1),v.registerCommand(cs,e=>e.target===p.current&&(e.preventDefault(),!0),1),v.registerCommand(ts,D,1),v.registerCommand($o,D,1),v.registerCommand(Zo,te,1),v.registerCommand(es,ne,1));return()=>{e=!1,t()}},[_,v,S,h,r,D,te,ne,g]);let re=(e,t)=>{setTimeout(()=>{C(!1)},200),v.update(()=>{let n=H(r);vL(n)&&n.setWidthAndHeight(e,t)})},ie=()=>{C(!0)},ae=L(y),oe=h,se=k.useMemo(()=>{if(o.length===0)return null;let e=o.find(e=>e.type===`mdxJsxAttribute`&&(e.name===`class`||e.name===`className`));return e?e.value:null},[o]);return w===null?null:k.createElement(k.Suspense,{fallback:s?k.createElement(s,null):null},k.createElement(`div`,{className:J.imageWrapper,"data-editor-block-type":`image`},k.createElement(`div`,{draggable:ae},k.createElement(lL,{width:i,height:a,className:(0,OC.default)({[J.focusedImage]:oe},se),src:w,title:t??``,alt:n??``,imageRef:p})),ae&&oe&&!c&&k.createElement(oL,{editor:v,imageRef:p,onResizeStart:ie,onResizeEnd:re}),d||k.createElement(f,{nodeKey:r,imageSource:w,initialImagePath:E,title:t??``,alt:n??``,width:i,height:a})))}var dL=(e,t,n)=>{typeof n==`number`?e.style[t]=`${n}px`:e.style.removeProperty(t)},fL=Object.defineProperty,pL=(e,t,n)=>t in e?fL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mL=(e,t,n)=>pL(e,typeof t==`symbol`?t:t+``,n);function hL(e){if(e instanceof HTMLImageElement){let{alt:t,src:n,title:r,width:i,height:a}=e;return{node:_L({altText:t,src:n,title:r,width:i||void 0,height:a||void 0})}}return null}var gL=class e extends uu{constructor(e,t,n,r,i,a,o){super(o),mL(this,`__src`),mL(this,`__altText`),mL(this,`__title`),mL(this,`__width`),mL(this,`__height`),mL(this,`__rest`),this.__src=e,this.__title=n,this.__altText=t,this.__width=r??`inherit`,this.__height=i??`inherit`,this.__rest=a??[]}static getType(){return`image`}static clone(t){return new e(t.__src,t.__altText,t.__title,t.__width,t.__height,t.__rest,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__src=e.__src,this.__altText=e.__altText,this.__title=e.__title,this.__width=e.__width,this.__height=e.__height,this.__rest=e.__rest}static importJSON(e){let{altText:t,title:n,src:r,width:i,rest:a,height:o}=e;return _L({altText:t,title:n,src:r,height:o,width:i,rest:a})}exportDOM(){let e=document.createElement(`img`);return e.setAttribute(`src`,this.__src),e.setAttribute(`alt`,this.__altText),this.__title&&e.setAttribute(`title`,this.__title),this.__width!==`inherit`&&this.__width&&e.setAttribute(`width`,this.__width.toString()),this.__height!==`inherit`&&this.__height&&e.setAttribute(`height`,this.__height.toString()),{element:e}}static importDOM(){return{img:()=>({conversion:hL,priority:0})}}exportJSON(){return{altText:this.getAltText(),title:this.getTitle(),height:this.__height===`inherit`?void 0:this.__height,width:this.__width===`inherit`?void 0:this.__width,src:this.getSrc(),rest:this.__rest,type:`image`,version:1}}setWidthAndHeight(e,t){let n=this.getWritable();n.__width=e,n.__height=t}createDOM(e,t){let n=document.createElement(`span`),r=e.theme.image;return r!==void 0&&(n.className=r),n}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}getTitle(){return this.__title}getHeight(){return this.__height}getWidth(){return this.__width}getRest(){return this.__rest}setTitle(e){this.getWritable().__title=e}setSrc(e){this.getWritable().__src=e}setAltText(e){this.getWritable().__altText=e??``}shouldBeSerializedAsElement(){return this.__width!==`inherit`||this.__height!==`inherit`||this.__rest.length>0}decorate(e){return k.createElement(uL,{src:this.getSrc(),title:this.getTitle(),nodeKey:this.getKey(),width:this.__width,height:this.__height,alt:this.__altText,rest:this.__rest})}};function _L(e){let{altText:t,title:n,src:r,key:i,width:a,height:o,rest:s}=e;return new gL(r,t,n,a,o,s,i)}function vL(e){return e instanceof gL}var yL={testLexicalNode:vL,visitLexicalNode({mdastParent:e,lexicalNode:t,actions:n}){if(t.shouldBeSerializedAsElement()){let r=new Image;t.getHeight()!==`inherit`&&(r.height=t.getHeight()),t.getWidth()!==`inherit`&&(r.width=t.getWidth()),t.getAltText()&&(r.alt=t.getAltText()),t.getTitle()&&(r.title=t.getTitle());for(let e of t.getRest())e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&r.setAttribute(e.name,e.value);n.appendToParent(e,{type:`html`,value:r.outerHTML.replace(/>$/,` src="${t.getSrc()}" />`)})}else n.appendToParent(e,{type:`image`,url:t.getSrc(),alt:t.getAltText(),title:t.getTitle()})}},bL={testNode:`image`,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(_L({src:e.url,altText:e.alt??``,title:e.title??``}))}},xL={testNode:e=>e.type===`html`&&e.value.trim().startsWith(`<img`),visitNode({mdastNode:e,lexicalParent:t}){let n=document.createElement(`div`);n.innerHTML=e.value;let r=n.querySelector(`img`);if(!r)throw Error(`Invalid HTML image`);let i=r.src,a=r.alt,o=r.title,s=r.width,c=r.height,l=_L({src:i||``,altText:a,title:o,width:s||void 0,height:c||void 0});if(t.getType()===`root`){let e=V();e.append(l),t.append(e)}else t.append(l)}};function SL(e,t){let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);if(n)return n.value}var CL={testNode:e=>(e.type===`mdxJsxTextElement`||e.type===`mdxJsxFlowElement`)&&e.name===`img`,visitNode({mdastNode:e,lexicalParent:t}){let n=SL(e,`src`);if(!n)return;let r=SL(e,`alt`)??``,i=SL(e,`title`),a=SL(e,`height`),o=SL(e,`width`),s=e.attributes.filter(e=>e.type===`mdxJsxAttribute`&&![`src`,`alt`,`title`,`height`,`width`].includes(e.name)),c=_L({src:n,altText:r,title:i,width:o?parseInt(o,10):void 0,height:a?parseInt(a,10):void 0,rest:s});if(t.getType()===`root`){let e=V();e.append(c),t.append(e)}else t.append(c)}};function wL(e){return{onUpdate:()=>e.dispatchCommand(Hx,void 0),tag:document.activeElement&&Ku(document.activeElement)===e?void 0:cc}}function TL(e){let t=_L(e);Sl([t]),Gd(t.getParentOrThrow())&&Vm(t,V).selectEnd()}function EL(e,t){let n=document.activeElement&&Ku(document.activeElement)===e?void 0:{...wL(e),tag:cc};e.update(()=>{t.forEach(t=>{let n={src:t,altText:``};e.dispatchCommand(GL,n)||TL(n)})},n)}var DL=Ur(),OL=j([]),kL=j(!1),AL=j(null),jL=j(null),ML=j(null),NL=j(`idle`),PL=j({type:`inactive`},e=>{let t=new Set,n=null,r=null,i=!1;ni(e,()=>{i=!0,t.clear(),n=null}),e.sub(PL,i=>{for(let e of t)e.dialog&&t.delete(e);n=null,r=i.type===`inactive`?null:e.getValue(Wx)}),e.link(e.pipe(PL,Qr(`idle`)),NL),e.sub(e.pipe(AS,Zr(rS,oC,sC),$r(([e,t,n,r])=>n===`rich-text`?e.trim()!==t.trim():e!==r)),()=>{let r=[...t].some(e=>e.dialog!==null);t.clear(),n=null,r&&e.pub(LL)}),e.link(e.pipe(qx,$r(e=>e),Qr({type:`inactive`})),PL),e.sub(qx,e=>{e&&t.clear()});let a=(r,a)=>{let o=r?.getRootElement();if(i||!r||!o?.isConnected||!r.isEditable()||e.getValue(qx))return;let s={dialog:a};return t.add(s),{token:s,isCurrent:()=>t.has(s)&&(!a||e.getValue(PL)===a)&&r.getRootElement()===o&&o.isConnected&&r.isEditable()&&!e.getValue(qx),finish:()=>{t.delete(s),n===s&&(n=null)}}},o=(e,t)=>{e.update(()=>{TL({...t,altText:t.altText??``,width:HL(t.width),height:HL(t.height)})},wL(e))};e.sub(e.pipe(DL,Zr(Wx,AL)),([e,t,n])=>{if(!t)return;if(!(`file`in e)){o(t,e);return}let r=a(t,null);if(!r)return;let i=n=>{r.isCurrent()&&o(t,{...e,src:n}),r.finish()},s=e=>{console.error(e),r.finish()};n?Promise.resolve().then(()=>n(e.file)).then(i,s):s(Error(`No image upload handler is configured`))}),e.sub(e.pipe(BL,Zr(AL,PL,zL)),([t,i,s,c])=>{let l=s.type===`inactive`?e.getValue(Wx):r;if(n)return;let u=()=>{s.type!==`inactive`&&e.getValue(PL)===s&&e.pub(LL)},d=()=>s.type!==`inactive`||e.getValue(PL).type===`inactive`;if(!l||s.type!==`inactive`&&!l.getRootElement()?.isConnected){u();return}let f=!!(t.file&&t.file.length>0),p=f?a(l,s.type===`inactive`?null:s):void 0;if(f&&!p){u();return}p&&(n=p.token);let m=n=>{p&&!p.isCurrent()?(p.finish(),u()):(s.type===`editing`?l.update(()=>{let e=H(s.nodeKey);vL(e)&&(e.setTitle(t.title),e.setAltText(t.altText),e.setSrc(n),c&&e.setWidthAndHeight(HL(t.width)??`inherit`,HL(t.height)??`inherit`))},wL(l)):o(l,{...t,src:n}),p?.finish(),d()&&e.pub(LL))},h=t=>{console.error(t),p&&!p.isCurrent()?(p.finish(),u()):(p?.finish(),d()&&e.pub(NL,`error`))};if(t.file&&t.file.length>0){if(!i){h(Error(`No image upload handler is configured`));return}e.pub(NL,`uploading`),Promise.resolve().then(()=>i(t.file.item(0))).then(m,h)}else t.src?m(t.src):p?.finish()}),e.pub(US,t=>{let n=e.getValue(AL);return xm(t.registerCommand(GL,e=>(TL(e),!0),0),t.registerCommand(cs,e=>qL(e),3),t.registerCommand(ls,e=>JL(e,!!n),1),t.registerCommand(os,n=>YL(n,t,e.getValue(AL)),3),t.registerCommand(Io,r=>{if(!n){let e=Array.from(r.clipboardData?.items??[]);return e=e.filter(e=>e.type.includes(`text`)),!e.length||e.length===0}let i=Array.from(r.clipboardData?.items??[]);if(i.some(e=>!e.type.includes(`image`))||!i.length||i.length===0)return!1;let a=e.getValue(AL);return Promise.all(i.map(e=>a(e.getAsFile()))).then(e=>{EL(t,e)}).catch(e=>{throw e}),!0},4))})}),FL=Wr(e=>{e.link(e.pipe(FL,Xr(()=>({type:`new`}))),PL)}),IL=Ur(e=>{e.link(e.pipe(IL,Xr(e=>({type:`editing`,...e}))),PL)}),LL=Wr(e=>{e.link(e.pipe(LL,Qr({type:`inactive`})),PL)}),RL=j(!1),zL=j(!1),BL=Ur(),VL=j(Gj),HL=e=>{if(e===void 0)return;let t=parseInt(String(e),10);return Number.isNaN(t)?void 0:t},UL=ii({init(e,t){e.getValue(PL),e.pubIn({[wS]:[bL,xL,CL],[CS]:gL,[DS]:yL,[KS]:t?.ImageDialog??rL,[AL]:t?.imageUploadHandler??null,[OL]:t?.imageAutocompleteSuggestions??[],[kL]:!!t?.disableImageResize,[RL]:!!t?.disableImageSettingsButton,[zL]:!!t?.allowSetImageDimensions,[jL]:t?.imagePreviewHandler??null,[VL]:t?.EditImageToolbar??Gj,[ML]:t?.imagePlaceholder??Wj})},update(e,t){e.pubIn({[AL]:t?.imageUploadHandler??null,[OL]:t?.imageAutocompleteSuggestions??[],[kL]:!!t?.disableImageResize,[jL]:t?.imagePreviewHandler??null,[zL]:!!t?.allowSetImageDimensions,[VL]:t?.EditImageToolbar??Gj,[ML]:t?.imagePlaceholder??Wj})}}),WL=e=>zC?(e??window).getSelection():null,GL=P(`INSERT_IMAGE_COMMAND`),KL=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`;function qL(e){let t=XL();if(!t)return!1;let n=e.dataTransfer;if(!n)return!1;n.setData(`text/plain`,`_`);let r=document.createElement(`img`);return r.src=KL,n.setDragImage(r,0,0),n.setData(`application/x-lexical-drag`,JSON.stringify({data:{altText:t.__altText,title:t.__title,key:t.getKey(),src:t.__src},type:`image`})),!0}function JL(e,t){if(t){let t=Array.from(e.dataTransfer?.items??[]);if(t=t.filter(e=>e.type.includes(`image`)),t.length>0)return e.preventDefault(),!0}return XL()?(QL(e)||e.preventDefault(),!0):!1}function YL(e,t,n){let r=Array.from(e.dataTransfer?.items??[]);if(r=r.filter(e=>e.type.includes(`image`)),r.length>0&&n!==null)return e.preventDefault(),Promise.all(r.map(e=>e.kind===`string`?new Promise(t=>{e.getAsString(t)}):n(e.getAsFile()))).then(e=>{EL(t,e)}).catch(e=>{throw e}),!0;let i=XL();if(!i)return!1;let a=ZL(e);if(!a)return!1;if(e.preventDefault(),QL(e)){let n=$L(e);i.remove();let r=ul();n!=null&&r.applyDOMRange(n),fd(r),t.dispatchCommand(GL,a)}return!0}function XL(){let e=R();if(!L(e))return null;let t=e.getNodes()[0];return vL(t)?t:null}function ZL(e){let t=e.dataTransfer?.getData(`application/x-lexical-drag`);if(!t)return null;let{type:n,data:r}=JSON.parse(t);return n===`image`?r:null}function QL(e){let t=e.target;return!!(t&&t instanceof HTMLElement&&t.parentElement)}function $L(e){let t,n=e.target,r=WL(n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&r!==null)r.collapse(e.rangeParent,e.rangeOffset??0),t=r.getRangeAt(0);else throw Error(`Cannot get the selection when dragging`);return t}var eR={testNode:`blockquote`,visitNode({actions:e}){e.addAndStepInto(H_())}},tR={testLexicalNode:U_,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`blockquote`)}},nR=ii({init(e){e.pubIn({[lC]:`quote`,[wS]:eR,[CS]:V_,[DS]:tR})}}),rR=k.createContext(void 0);function iR(){let e=k.useContext(rR);if(!e)throw Error(`useNestedEditor must be used within a NestedEditorsProvider`);return e}function aR(){let{parentEditor:e,mdastNode:t,lexicalNode:n}=iR();return function(r){e.update(()=>{Ld(`history-push`);let e=H(n.getKey());e&&e.setMdastNode({...t,...r})},{discrete:!0}),e.dispatchCommand(Hx,void 0)}}function oR(){let{parentEditor:e,lexicalNode:t}=iR();return()=>{e.update(()=>{let e=H(t.getKey());e.selectNext(),e.remove()})}}var sR=function(e){let{getContent:t,getUpdatedMdastNode:n,contentEditableProps:r,block:i=!1}=e,{parentEditor:a,mdastNode:o,lexicalNode:s,focusEmitter:c}=iR(),l=aR(),u=oR(),d=t(o),f=Kr(),[p,m,h,g,_,v,y,b,x,S,C]=Jr(Ux,sS,dS,cS,hS,_S,vS,yS,mS,XS,dC),w=Yr(LS),[T,E]=k.useState(null);return k.useEffect(()=>{if(!p)return;let e=Bx({name:`@mdxeditor/nested`,nodes:g,theme:C,namespace:`NestedEditor`,parentEditor:a,historyMode:Vx(p)?`nested-shared`:`nested-external`,historyState:f.getValue(tC),initialEditorState:()=>{let e=d;i?e.length===0&&(e=[{type:`paragraph`,children:[]}]):e=[{type:`paragraph`,children:d}],jb({root:U(),mdastRoot:{type:`root`,children:e},visitors:m,directiveDescriptors:v,codeBlockEditorDescriptors:y,defaultCodeBlockLanguage:b,jsxComponentDescriptors:_})}});return E(e),()=>{e.dispose()}},[]),k.useEffect(()=>{if(T)return c.subscribe(()=>{T.focus()}),()=>{c.subscribe(()=>void 0)}},[T,c]),k.useEffect(()=>{if(!T)return;function e(){T.getEditorState().read(()=>{let e=ab({root:U(),visitors:h,jsxComponentDescriptors:_,jsxIsAvailable:x,addImportStatements:!1}),t=i?e.children:e.children[0].children,r=n(structuredClone(o),t);bw(a.getEditorState().read(()=>H(s.getKey())?.getMdastNode()),r)||l(r)})}return xm(T.registerCommand(vs,()=>(w({editorType:`lexical`,rootNode:s,editorRef:T}),!1),1),T.registerCommand(ys,t=>{let n=t.relatedTarget;return!kA(n,p.getRootElement())&&(e(),w(null),!0)},0),T.registerCommand(Hx,()=>(e(),!0),0),T.registerCommand(To,()=>(w({editorType:`lexical`,rootNode:s,editorRef:T}),!1),3),T.registerCommand($o,(e,t)=>t.getRootElement()?.innerText===`
77
+ `&&(u(),!0),4))},[i,T,h,n,_,x,s,o,a,u,w,l,p]),T?k.createElement(mC,{initialEditor:T},k.createElement(CC,{contentEditable:k.createElement(Tx,{...r,className:(0,OC.default)(J.nestedEditor,r?.className)}),placeholder:null,ErrorBoundary:kx}),S.map((e,t)=>k.createElement(e,{key:t}))):null};function cR(){let e=Mb;return{publish:()=>{e()},subscribe:t=>{e=t}}}var lR=Object.defineProperty,uR=(e,t,n)=>t in e?lR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dR=(e,t,n)=>uR(e,typeof t==`symbol`?t:t+``,n),fR=class e extends uu{constructor(e,t,n){super(n),dR(this,`__mdastNode`),dR(this,`__focusEmitter`,cR()),dR(this,`__importStatement`),dR(this,`select`,()=>{this.__focusEmitter.publish()}),this.__mdastNode=e,this.__importStatement=t}static getType(){return`jsx`}static clone(t){return new e(structuredClone(t.__mdastNode),structuredClone(t.__importStatement),t.__key)}static importJSON(e){return mR(e.mdastNode,e.importStatement)}getMdastNode(){return this.__mdastNode}getImportStatement(){return this.__importStatement}exportJSON(){return{mdastNode:this.getMdastNode(),importStatement:this.getImportStatement(),type:`jsx`,version:1}}createDOM(){return document.createElement(this.__mdastNode.type===`mdxJsxTextElement`?`span`:`div`)}updateDOM(){return!1}setMdastNode(e){this.getWritable().__mdastNode=e}decorate(e,t){return k.createElement(pR,{lexicalJsxNode:this,config:t,mdastNode:this.getMdastNode(),parentEditor:e,focusEmitter:this.__focusEmitter})}isInline(){return this.__mdastNode.type===`mdxJsxTextElement`}isKeyboardSelectable(){return!0}};function pR(e){let{mdastNode:t}=e,n=qr(hS),r=n.find(e=>e.name===t.name)??n.find(e=>e.name===`*`);if(!r)throw Error(`No JSX descriptor found for ${t.name}`);let i=r.Editor;return k.createElement(rR.Provider,{value:{config:e.config,focusEmitter:e.focusEmitter,mdastNode:t,parentEditor:e.parentEditor,lexicalNode:e.lexicalJsxNode}},k.createElement(i,{descriptor:r,mdastNode:t}))}function mR(e,t){return new fR(e,t)}function hR(e){return e instanceof fR}var gR={testLexicalNode:hR,visitLexicalNode({actions:e,mdastParent:t,lexicalNode:n}){function r(t){`children`in t&&t.children instanceof Array&&t.children.forEach(t=>{PR(t)&&e.registerReferredComponent(t.name,Zy(t)),r(t)})}let i=n.getMdastNode(),a=n.getImportStatement();e.registerReferredComponent(i.name,a),r(i),e.appendToParent(t,a?$y(i,a):i)},priority:-200},_R={testNode:`mdxjsEsm`,visitNode(){}},vR={testNode:(e,{jsxComponentDescriptors:t})=>e.type===`mdxJsxTextElement`||e.type===`mdxJsxFlowElement`?(t.find(t=>t.name===e.name)??t.find(e=>e.name===`*`))!==void 0:!1,visitNode({lexicalParent:e,mdastNode:t,metaData:n}){e.append(mR(t,Zy(t)??(t.name?n.importDeclarations[t.name.split(`.`)[0]]:void 0)))},priority:-200,jsxKindReconciliationOwner:!0},yR=Object.defineProperty,bR=(e,t,n)=>t in e?yR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xR=(e,t,n)=>bR(e,typeof t==`symbol`?t:t+``,n),SR=class e extends uu{constructor(e,t,n){super(n),xR(this,`__value`),xR(this,`__mdastType`),this.__value=e,this.__mdastType=t}static getType(){return`mdx-expression`}static clone(t){return new e(t.__value,t.__mdastType,t.__key)}getValue(){return this.__value}getMdastType(){return this.__mdastType}createDOM(){let e=document.createElement(`span`);return e.classList.add(px.mdxExpression),e}updateDOM(){return!1}static importDOM(){return{}}exportDOM(e){let{element:t}=super.exportDOM(e);return{element:t}}static importJSON(e){return CR(e.value,e.mdastType)}exportJSON(){return{...super.exportJSON(),value:this.getValue(),mdastType:this.getMdastType(),type:`mdx-expression`,version:1}}extractWithChild(){return!0}isInline(){return this.__mdastType===`mdxTextExpression`}decorate(e){return k.createElement(k.Fragment,null,`{`,k.createElement(`span`,{className:J.inputSizer,"data-value":this.getValue()},k.createElement(`input`,{size:1,onKeyDown:t=>{(t.target.value===``&&t.key===`Backspace`||t.key===`Delete`)&&(t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),t.preventDefault(),e.update(()=>{this.selectPrevious(),this.remove()}))},onChange:t=>{t.target.parentElement.dataset.value=t.target.value,e.update(()=>{this.getWritable().__value=t.target.value})},type:`text`,value:this.getValue()})),`}`)}};function CR(e,t){return qd(new SR(e,t))}function wR(e){return e instanceof SR}var TR={testNode:e=>e.type===`mdxTextExpression`||e.type===`mdxFlowExpression`,visitNode({lexicalParent:e,mdastNode:t}){e.append(CR(t.value,t.type))},priority:-200},ER={testLexicalNode:wR,visitLexicalNode({actions:e,mdastParent:t,lexicalNode:n}){let r={type:n.getMdastType(),value:n.getValue()};e.appendToParent(t,r)}},DR=e=>{let t=qr(bS);return k.createElement(MO,{...e,container:t?.current})},OR=k.forwardRef((e,t)=>k.createElement(PO,{...e,className:J.popoverContent,sideOffset:5,side:`top`,ref:t},k.createElement(`span`,{className:J.popoverArrow},k.createElement(zO,null)),e.children)),kR=({title:e,properties:t,onChange:n})=>{let[r,i]=k.useState(!1),a=qr(zS),{register:o,handleSubmit:s,reset:c}=uP({defaultValues:t});return k.createElement(EO,{open:r,onOpenChange:e=>{i(e)}},k.createElement(OO,{className:J.iconButton},k.createElement(`div`,null,a(`settings`))),k.createElement(DR,null,k.createElement(OR,null,k.createElement(`form`,{onSubmit:e=>{s(n)(e),i(!1),e.preventDefault(),e.stopPropagation()}},k.createElement(`h3`,{className:J.propertyPanelTitle},e,` Attributes`),k.createElement(`table`,{className:J.propertyEditorTable},k.createElement(`thead`,null,k.createElement(`tr`,null,k.createElement(`th`,{className:J.readOnlyColumnCell},`Attribute`),k.createElement(`th`,null,`Value`))),k.createElement(`tbody`,null,Object.keys(t).map(e=>k.createElement(`tr`,{key:e},k.createElement(`th`,{className:J.readOnlyColumnCell},` `,e,` `),k.createElement(`td`,null,k.createElement(`input`,{...o(e),className:J.propertyEditorInput}))))),k.createElement(`tfoot`,null,k.createElement(`tr`,null,k.createElement(`td`,{colSpan:2},k.createElement(`div`,{className:J.buttonsFooter},k.createElement(`button`,{type:`submit`,className:J.primaryButton},`Save`),k.createElement(`button`,{type:`reset`,className:J.secondaryButton,onClick:e=>{e.preventDefault(),c(t),i(!1)}},`Cancel`))))))))))},AR=e=>!!(typeof e==`object`&&e&&`type`in e&&`value`in e&&typeof e.value==`string`),jR=e=>typeof e==`string`,MR=e=>e.type===`mdxJsxAttribute`&&typeof e.name==`string`,NR=({mdastNode:e,descriptor:t,PropertyEditor:n})=>{let r=aR(),i=k.useMemo(()=>t.props.reduce((t,{name:n})=>{let r=e.attributes.find(e=>MR(e)?e.name===n:!1);if(r){if(AR(r.value))return t[n]=r.value.value,t;if(jR(r.value))return t[n]=r.value,t}return t[n]=``,t},{}),[e,t]),a=k.useCallback(e=>{let n=Object.entries(e).reduce((e,[n,r])=>r===``?e:t.props.find(e=>e.name===n)?.type===`expression`?(e.push({type:`mdxJsxAttribute`,name:n,value:{type:`mdxJsxAttributeValueExpression`,value:r}}),e):(e.push({type:`mdxJsxAttribute`,name:n,value:r}),e),[]);r({attributes:n})},[e,r,t]),o=n??kR,s=t.props.length==0&&t.hasChildren&&t.kind===`flow`;return k.createElement(`div`,{className:t.kind===`text`?J.inlineEditor:J.blockEditor},s?k.createElement(`span`,{className:J.genericComponentName},e.name??`Fragment`):null,t.props.length>0?k.createElement(o,{properties:i,title:e.name??``,onChange:a}):null,t.hasChildren?k.createElement(sR,{block:e.type===`mdxJsxFlowElement`,getContent:e=>e.children,getUpdatedMdastNode:(e,t)=>({...e,children:t})}):k.createElement(`span`,{className:J.genericComponentName},e.name))};function PR(e){return e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`}var FR=e=>!!(typeof e==`object`&&e&&`type`in e&&`value`in e&&typeof e.value==`string`),IR=e=>Object.entries(e).map(([e,t])=>({type:`mdxJsxAttribute`,name:e,value:FR(t)?{type:`mdxJsxAttributeValueExpression`,value:t.value}:t})),LR=Ur(e=>{e.link(e.pipe(LR,Xr(({kind:e,name:t,children:n,props:r})=>()=>{let i=IR(r);return mR(e===`flow`?{type:`mdxJsxFlowElement`,name:t,children:n??[],attributes:i}:{type:`mdxJsxTextElement`,name:t,children:n??[],attributes:i})})),aC)}),RR={name:null,kind:`flow`,props:[],hasChildren:!0,Editor:NR},zR=e=>e?e.allowFragment??!0?[RR,...e.jsxComponentDescriptors]:e.jsxComponentDescriptors:[RR],BR=ii({init:(e,t)=>{e.pubIn({[mS]:!0,[ES]:zt(),[TS]:Ht(),[wS]:[vR,_R,TR],[CS]:[fR,SR],[DS]:[gR,ER],[OS]:Yt(),[hS]:zR(t),[gS]:t?.kindMismatchPolicy??`source`})},update(e,t){e.pubIn({[hS]:zR(t),[gS]:t?.kindMismatchPolicy??`source`})}});function VR(e,t,n,r){let i=[...e].sort((e,t)=>t.priority-e.priority),a=n??``;return i.find(e=>e.match(t??``,a))??i.find(e=>e.match(r??``,a))}var HR=Object.defineProperty,UR=(e,t,n)=>t in e?HR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WR=(e,t,n)=>UR(e,typeof t==`symbol`?t:t+``,n),GR=class e extends uu{constructor(e,t,n,r){super(r),WR(this,`__code`),WR(this,`__meta`),WR(this,`__language`),WR(this,`__focusEmitter`,cR()),WR(this,`setCode`,e=>{e!==this.__code&&(this.getWritable().__code=e)}),WR(this,`setMeta`,e=>{e!==this.__meta&&(this.getWritable().__meta=e)}),WR(this,`setLanguage`,e=>{e!==this.__language&&(this.getWritable().__language=e)}),WR(this,`select`,()=>{this.__focusEmitter.publish()}),this.__code=e,this.__meta=n,this.__language=t}static getType(){return`codeblock`}static clone(t){return new e(t.__code,t.__language,t.__meta,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__code=e.__code,this.__meta=e.__meta,this.__language=e.__language,this.__focusEmitter=cR()}static importJSON(e){return XR({code:typeof e.code==`string`?e.code:``,language:typeof e.language==`string`?e.language:``,meta:typeof e.meta==`string`?e.meta:``})}static importDOM(){return{pre:()=>({conversion:QR,priority:3})}}exportJSON(){return{code:this.getCode(),language:this.getLanguage(),meta:this.getMeta(),type:`codeblock`,version:1}}createDOM(e,t){return document.createElement(`div`)}updateDOM(){return!1}getCode(){return this.__code}getMeta(){return this.__meta}getLanguage(){return this.__language}decorate(e){return k.createElement(YR,{parentEditor:e,code:this.getCode(),meta:this.getMeta(),language:this.getLanguage(),codeBlockNode:this,nodeKey:this.getKey(),focusEmitter:this.__focusEmitter})}isInline(){return!1}},KR=k.createContext(null),qR=({parentEditor:e,lexicalNode:t,children:n})=>{let r=k.useMemo(()=>({lexicalNode:t,parentEditor:e,setCode:n=>{e.update(()=>{t.setCode(n),setTimeout(()=>{e.dispatchCommand(Hx,void 0)},0)})},setLanguage:n=>{e.update(()=>{t.setLanguage(n)})},setMeta:n=>{e.update(()=>{t.setMeta(n)})}}),[t,e]);return k.createElement(KR.Provider,{value:r},n)};function JR(){let e=k.useContext(KR);if(!e)throw Error(`useCodeBlockEditor must be used within a CodeBlockEditor`);return e}var YR=e=>{let t=qr(vS),n=qr(yS),r=VR(t,e.language,e.meta,n);if(!r)throw Error(`No CodeBlockEditor registered for language=${e.language} meta=${e.meta}`);let i=r.Editor,{codeBlockNode:a,parentEditor:o,...s}=e;return k.createElement(qR,{parentEditor:e.parentEditor,lexicalNode:e.codeBlockNode},k.createElement(i,{...s}))};function XR(e){let{code:t=``,language:n=``,meta:r=``}=e;return new GR(t,n,r)}function ZR(e){return e instanceof GR}function QR(e){let t=e,n=t.textContent,r=e.getAttribute(`class`)??``,i=e.getAttribute(`data-language`)??``,a=/language-(\w+)/.exec(r);return{node:XR({code:n,language:a?a[1]:i,meta:t.getAttribute(`data-meta`)??``})}}var $R={testLexicalNode:ZR,visitLexicalNode:({lexicalNode:e,actions:t})=>{t.addAndStepInto(`code`,{value:e.getCode(),lang:e.getLanguage(),meta:e.getMeta()})}},ez={testNode:(e,{codeBlockEditorDescriptors:t,defaultCodeBlockLanguage:n})=>e.type===`code`&&VR(t,e.lang,e.meta,n)!==void 0,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(XR({code:e.value,language:e.lang??``,meta:e.meta??``}))}},tz=Ur(e=>{e.link(e.pipe(tz,Zr(yS),Xr(([e,t])=>()=>XR({language:t,...e}))),aC)});BS(vS);var nz=ii({update(e,t){e.pub(yS,t?.defaultCodeBlockLanguage??``)},init(e,t){e.pubIn({[lC]:`codeblock`,[yS]:t?.defaultCodeBlockLanguage??``,[vS]:t?.codeBlockEditorDescriptors??[],[wS]:ez,[CS]:GR,[DS]:$R})}});function rz(e,t){let n=e;for(let r=jp(e,t);r&&(Sz(r.origin)||Fc(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function iz(e){return rz(e,`previous`)}function az(e,t){for(let n of e.childNodes)if(G(n)&&n.tagName===t||az(n,t))return!0;return!1}var oz=`data-language`,sz=`data-highlight-language`,cz=`data-theme`,lz=class e extends cu{__language;__theme;__isSyntaxHighlightSupported;static getType(){return`code`}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){let t=of().createElement(`code`);ym(t,e.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(oz,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sz,n));let r=this.getTheme();r&&t.setAttribute(cz,r);let i=this.getStyle();return i&&mc(t.style,i),t}updateDOM(e,t,n){let r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(oz,r):i&&t.removeAttribute(oz);let a=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?a&&r?r!==i&&t.setAttribute(sz,r):t.removeAttribute(sz):a&&r&&t.setAttribute(sz,r);let o=this.__theme,s=e.__theme;o?o!==s&&t.setAttribute(cz,o):s&&t.removeAttribute(cz);let c=this.__style,l=e.__style;return c!==l&&mc(t.style,c,l),!1}exportDOM(e){let t=of().createElement(`pre`);ym(t,e._config.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(oz,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sz,n));let r=this.getTheme();r&&t.setAttribute(cz,r);let i=this.getStyle();return i&&mc(t.style,i),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||az(e,`BR`))?{conversion:fz,priority:1}:null,div:()=>({conversion:pz,priority:1}),pre:()=>({conversion:fz,priority:0}),table:e=>_z(e)?{conversion:mz,priority:3}:null,td:e=>{let t=e,n=t.closest(`table`);return t.classList.contains(`js-file-line`)||n&&_z(n)?{conversion:hz,priority:3}:null},tr:e=>{let t=e.closest(`table`);return t&&_z(t)?{conversion:hz,priority:3}:null}}}static importJSON(e){return uz().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!Yh(wf(),`@lexical/code`)){let t=vz(e);if(t)return t}let{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(F(i)){let e=iz(i),t=[];for(;;)if(Fc(e))t.push(Pc()),e=e.getNextSibling();else{if(!Sz(e))break;{let n=0,r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&r[n]===` `;)n++;if(n!==0&&t.push(xz(` `.repeat(n))),n!==i)break;e=e.getNextSibling()}}let r=i.splitText(n.offset)[0],a=n.offset===0?0:1,o=r.getIndexWithinParent()+a,s=i.getParentOrThrow(),c=[xu(),...t];s.splice(o,0,c);let l=t[t.length-1];l?l.select():n.offset===0?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(dz(i)){let{offset:t}=e.anchor;i.splice(t,0,[xu()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){let e=V();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){let t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){let t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){let t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function uz(e,t){return Gf(lz).setLanguage(e).setTheme(t)}function dz(e){return e instanceof lz}function fz(e){return{node:uz(e.getAttribute(oz))}}function pz(e){let t=e,n=gz(t);return n||function(e){let t=e.parentElement;for(;t!==null;){if(gz(t))return!0;t=t.parentElement}return!1}(t)?{node:n?uz():null}:{node:null}}function mz(){return{node:uz()}}function hz(){return{node:null}}function gz(e){return e.style.fontFamily.match(`monospace`)!==null}function _z(e){return e.classList.contains(`js-file-line-container`)}function vz(e){let{anchor:t}=e;if(e.isCollapsed()&&t.type===`element`){let e=t.getNode();if(dz(e)){let n=e.getChildrenSize();if(n>=2&&t.offset===n){let t=e.getLastChild();if(Su(t)&&Su(t.getPreviousSibling())){let t=V();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}var yz=class e extends Sc{__highlightType;constructor(e=``,t,n){super(e,n),this.__highlightType=t}static getType(){return`code-highlight`}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){let t=super.createDOM(e);return ym(t,bz(e.theme,this.__highlightType)),t}updateDOM(e,t,n){let r=super.updateDOM(e,t,n),i=bz(n.theme,e.__highlightType),a=bz(n.theme,this.__highlightType);return i!==a&&(i&&bm(t,i),a&&ym(t,a)),r}static importJSON(e){return xz().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return uz()}};function bz(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function xz(e=``,t){return qd(new yz(e,t))}function Sz(e){return e instanceof yz}qg.tag(`tr`,`td`),qg.tag(`pre`),qg.tag(`code`),qg.tag(`div`),qg.tag(`div`,`br`),qg.tag(`div`),qg.tag(`table`).classAll(`js-file-line-container`),qg.tag(`td`).classAll(`js-file-line`);function Cz(e,t){let n={};for(let r of e){let e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}function wz(e){let t=Cz(e,e=>e.type);return{element:t.element||[],multilineElement:t[`multiline-element`]||[],textFormat:t[`text-format`]||[],textMatch:t[`text-match`]||[]}}var Tz=/[!-/:-@[-`{-~\s]/;function Ez(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`).replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t)))}var Dz=/^(\s*)(\d{1,})\.\s/,Oz=/^(\s*)[-*+]\s/,kz=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,Az=/^(#{1,6})\s/,jz=/^>\s/,Mz=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,Nz=/^[ \t]*`{3,}$/,Pz=ua(`mdListMarker`,{parse:e=>typeof e==`string`&&/^[-*+]$/.test(e)?e:`-`,resetOnCopyNode:!0}),Fz=ua(`mdCodeFence`,{parse:e=>typeof e==`string`&&/^`{3,}$/.test(e)?e:"```",resetOnCopyNode:!0}),Iz=ua(`mdHardLineBreak`,{parse:e=>typeof e==`string`&&/^(\\| {2,})$/.test(e)?e:``,resetOnCopyNode:!0});function Lz(e){if(e.endsWith(`\\`))return[e.slice(0,-1),`\\`];let t=e.match(/^(.*?\S)( {2,})$/);return t?[t[1],t[2]]:null}function Rz(e){let t=e.getChildren(),n=t.length-1,r=t[n];if(!F(r))return null;let i=r.getTextContent(),a=Lz(i);if(a!==null){let[e,t]=a;return r.setTextContent(e),t}return/^ {2,}$/.test(i)&&function(e,t){for(let n=t-1;n>=0;n--){if(Su(e[n]))return!1;if(/\S/.test(e[n].getTextContent()))return!0}return!1}(t,n)?(r.setTextContent(``),i):null}function zz(e){let t=xu(),n=Rz(e);return n!==null&&fa(t,Iz,n),t}var Bz=e=>(t,n,r,i)=>{let a=e(r);a.append(...n),t.replace(a),i||a.select(0,0)},Vz=e=>(t,n,r,i)=>{let a=t.getPreviousSibling(),o=t.getNextSibling(),s=Dv(e===`check`?r[3]===`x`:void 0),c=r[0].trim()[0],l=e!==`bullet`&&e!==`check`||c!==Pz.parse(c)?void 0:c;if(q(o)&&o.getListType()===e){l&&fa(o,Pz,l);let n=o.getFirstChild();n===null?o.append(s):n.insertBefore(s),e===`number`&&o.setStart(Number(r[2])),t.remove()}else if(q(a)&&a.getListType()===e)l&&fa(a,Pz,l),a.append(s),t.remove();else{let n=Mv(e,e===`number`?Number(r[2]):void 0);l&&fa(n,Pz,l),n.append(s),t.replace(n)}s.append(...n),i||s.select(0,0);let u=function(e){let t=e.match(/\t/g),n=e.match(/ /g),r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&s.setIndent(u)},Hz=(e,t,n,r)=>{let i=[],a=e.getChildren(),o=0;for(let s of a)if(K(s)){if(s.getChildrenSize()===1){let e=s.getFirstChild();if(q(e)){let a=Hz(e,t,n+1,r);a&&i.push(a);continue}}if(r&&!s.getChildren().some(e=>e.isSelected(r)))continue;let a=` `.repeat(4*n),c=e.getListType(),l=da(e,Pz),u=c===`number`?`${e.getStart()+o}. `:c===`check`?`${l} [${s.getChecked()?`x`:` `}] `:l+` `,d=t(s);c!==`number`&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,`$1\\$2`)),i.push(a+u+d),o++}return i.join(`
78
+ `)},Uz={dependencies:[W_],export:(e,t)=>{if(!Y_(e))return null;let n=Number(e.getTag().slice(1));return`#`.repeat(n)+` `+t(e)},regExp:Az,replace:Bz(e=>J_(`h`+e[1].length)),triggerOnEnter:!0,type:`element`},Wz={dependencies:[V_],export:(e,t)=>{if(!U_(e))return null;let n=t(e).split(`
79
+ `),r=[];for(let e of n)r.push(`> `+e);return r.join(`
80
+ `)},regExp:jz,replace:(e,t,n,r)=>{if(r){let n=e.getPreviousSibling();if(U_(n))return n.splice(n.getChildrenSize(),0,[zz(n),...t]),void e.remove()}let i=H_();i.append(...t),e.replace(i),r||i.select(0,0)},triggerOnEnter:!0,type:`element`},Gz={dependencies:[lz],export:e=>{if(!dz(e))return null;let t=e.getTextContent(),n=da(e,Fz);if(t.indexOf(n)>-1){let e=t.match(/`{3,}/g);if(e){let t=Math.max(...e.map(e=>e.length));n="`".repeat(t+1)}}return n+(e.getLanguage()||``)+(t?`
81
+ `+t:``)+`
82
+ `+n},handleImportAfterStartMatch:({lines:e,rootNode:t,startLineIndex:n,startMatch:r})=>{let i=r[1],a=i.trim().length,o=e[n],s=r.index+i.length,c=o.slice(s),l=RegExp(`\`{${a},}$`);if(l.test(c)){let e=c.match(l),i=c.slice(0,c.lastIndexOf(e[0])),a=[...r];return a[2]=``,Gz.replace(t,null,a,e,[i],!0),[!0,n]}let u=RegExp(`^[ \\t]*\`{${a},}$`);for(let i=n+1;i<e.length;i++){let a=e[i];if(u.test(a)){let s=a.match(u),c=e.slice(n+1,i),l=o.slice(r[0].length);return l.length>0&&c.unshift(l),Gz.replace(t,null,r,s,c,!0),[!0,i]}}let d=e.slice(n+1),f=o.slice(r[0].length);return f.length>0&&d.unshift(f),Gz.replace(t,null,r,null,d,!0),[!0,e.length-1]},regExpEnd:{optional:!0,regExp:Nz},regExpStart:Mz,replace:(e,t,n,r,i,a)=>{let o,s,c=n[1]?n[1].trim():"```",l=n[2]||void 0;if(!t&&i){if(i.length===1)r?(o=uz(l),s=i[0]):(o=uz(l),s=i[0].startsWith(` `)?i[0].slice(1):i[0]);else{for(o=uz(l),i.length>0&&(i[0].trim().length===0?i.shift():i[0].startsWith(` `)&&(i[0]=i[0].slice(1)));i.length>0&&!i[i.length-1].length;)i.pop();s=i.join(`
83
+ `)}fa(o,Fz,c);let t=jc(s);o.append(t),e.append(o)}else t&&Bz(e=>uz(e?e[2]:void 0))(e,t,n,a)},type:`multiline-element`},Kz={dependencies:[Ov,Cv],export:(e,t,n)=>q(e)?Hz(e,t,0,n):null,regExp:Oz,replace:Vz(`bullet`),triggerOnEnter:!0,type:`element`},qz={dependencies:[Ov,Cv],export:(e,t,n)=>q(e)?Hz(e,t,0,n):null,regExp:kz,replace:Vz(`check`),triggerOnEnter:!0,type:`element`},Jz={dependencies:[Ov,Cv],export:(e,t,n)=>q(e)?Hz(e,t,0,n):null,regExp:Dz,replace:Vz(`number`),triggerOnEnter:!0,type:`element`},Yz={format:[`code`],tag:"`",type:`text-format`},Xz={format:[`highlight`],tag:`==`,type:`text-format`},Zz={format:[`bold`,`italic`],tag:`***`,type:`text-format`},Qz={format:[`bold`,`italic`],intraword:!1,tag:`___`,type:`text-format`},$z={format:[`bold`],tag:`**`,type:`text-format`},eB={format:[`bold`],intraword:!1,tag:`__`,type:`text-format`},tB={format:[`strikethrough`],tag:`~~`,type:`text-format`},nB={format:[`italic`],tag:`*`,type:`text-format`},rB={format:[`italic`],intraword:!1,tag:`_`,type:`text-format`},iB={dependencies:[tj],export:(e,t,n)=>{if(!sj(e)||uj(e))return null;let r=t(e),i=e.getTitle();return i!=null&&(i=i.replace(/([\\"])/g,`\\$1`)),i?`[${r}](${e.getURL()} "${i}")`:`[${r}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(Kf(e,sj))return;let[,n,r,i]=t,a=oj(r==null?void 0:Ez(r),{title:i==null?void 0:Ez(i)}),o=n.split(`[`).length-1,s=n.split(`]`).length-1,c=n,l=``;if(o<s)return;if(o>s){let e=n.split(`[`);l=`[`+e[0],c=e.slice(1).join(`[`)}let u=jc(c);return u.setFormat(e.getFormat()),a.append(u),e.replace(a),l&&a.insertBefore(jc(l)),u},trigger:`)`,type:`text-match`},aB=[Uz,Wz,Kz,Jz],oB=[Gz],sB=[Yz,Zz,Qz,$z,eB,Xz,nB,rB,tB],cB=[iB],lB=[...aB,...oB,...sB,...cB];function uB(e){return F(e)&&!e.hasFormat(`code`)}function dB(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function fB(e,t,n,r,i){if(!Gd(e.getParent())||e.getFirstChild()!==t)return!1;let a=t.getTextContent();if(!i&&a[n-1]!==` `)return!1;for(let{regExp:o,replace:s}of r){let r=a.match(o),c=i||r&&r[0].endsWith(` `)?n:n-1;if(r&&r[0].length===c){let i=t.getNextSiblings(),[a,o]=t.splitText(n);if(!1!==s(e,o?[o,...i]:i,r,!1))return a.remove(),!0}}return!1}function pB(e,t,n,r,i){if(!Gd(e.getParent())||e.getFirstChild()!==t)return!1;let a=t.getTextContent();if(!i&&a[n-1]!==` `)return!1;for(let{regExpStart:o,replace:s,regExpEnd:c}of r){if(c&&!(`optional`in c)||c&&`optional`in c&&!c.optional)continue;let r=a.match(o);if(r){let a=i||r[0].endsWith(` `)?n:n-1;if(r[0].length!==a)continue;let o=t.getNextSiblings(),[c,l]=t.splitText(n);if(!1!==s(e,l?[l,...o]:o,r,null,null,!1))return c.remove(),!0}}return!1}function mB(e,t){let n=0,r=e.getTextContent();for(let e=0;e<t;e++)r[e]==="`"&&n++;return n%2!=0}function hB(e,t,n){let r=n.length;for(let i=t;i>=r;i--){let t=i-r;if(gB(e,t,n,0,r)&&e[t+r]!==` `)return t}return-1}function gB(e,t,n,r,i){for(let a=0;a<i;a++)if(e[t+a]!==n[r+a])return!1;return!0}function _B(e,t=lB){let n=wz(t),r=n.element.filter(e=>e.triggerOnEnter),i=Cz(n.textFormat,({tag:e})=>e[e.length-1]),a=Cz(n.textMatch,({trigger:e})=>e),o=new Set([` `]);for(let e of n.textFormat)o.add(e.tag.slice(-1));for(let e of n.textMatch)e.trigger!==void 0&&o.add(e.trigger);for(let n of t){let t=n.type;if(t===`element`||t===`text-match`||t===`multiline-element`){let t=n.dependencies;for(let n of t)e.hasNode(n)||dB(173,n.getType())}}let s=(e,t,r)=>!!fB(e,t,r,n.element)||!!pB(e,t,r,n.multilineElement)||!!function(e,t,n){let r=e.getTextContent(),i=n[r[t-1]];if(i==null)return!1;t<r.length&&(r=r.slice(0,t));for(let t of i){if(!t.replace||!t.regExp)continue;let n=r.match(t.regExp);if(n===null)continue;let i=n.index||0,a=i+n[0].length,o;return i===0?[o]=e.splitText(a):[,o]=e.splitText(i,a),o.selectNext(0,0),t.replace(o,n),!0}return!1}(t,r,a)||!!function(e,t,n){let r=e.getTextContent(),i=t-1,a=r[i],o=n[a];if(!o)return!1;for(let t of o){let{tag:n}=t,o=n.length,s=i-o+1;if(o>1&&!gB(r,s,n,0,o)||r[s-1]===` `)continue;let c=r[i+1];if(!1===t.intraword&&c&&!Tz.test(c))continue;let l=e,u=l,d=hB(r,s,n),f=u;for(;d<0&&(f=f.getPreviousSibling())&&!Su(f);)if(F(f)){if(f.hasFormat(`code`))continue;let e=f.getTextContent();u=f,d=hB(e,e.length,n)}if(d<0||u===l&&d+o===s)continue;let p=u.getTextContent();if(d>0&&p[d-1]===a)continue;let m=p[d-1];if(!1===t.intraword&&m&&!Tz.test(m)||!t.format.includes(`code`)&&mB(u,d))continue;let h=l.getTextContent(),g=h.slice(0,s)+h.slice(i+1);l.setTextContent(g);let _=u===l?g:p;u.setTextContent(_.slice(0,d)+_.slice(d+o));let v=R(),y=ul();fd(y);let b=i-o*(u===l?2:1)+1;y.anchor.set(u.__key,d,`text`),y.focus.set(l.__key,b,`text`);for(let e of t.format)y.formatText(e,Mi[e]);y.anchor.set(y.focus.key,y.focus.offset,y.focus.type);for(let e of t.format)y.hasFormat(e)&&y.toggleFormat(e);return I(v)&&(y.format=v.format),!0}return!1}(t,r,i);return xm(e.registerUpdateListener(({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(`collaboration`)||t.has(`historic`)||e.isComposing())return;let a=t.has(uc),c=r.read(R),l=i.read(R);if(!I(l)||!I(c)||!c.isCollapsed()||c.is(l)&&!a)return;let u=c.anchor.key,d=c.anchor.offset,f=r._nodeMap.get(u);if(F(f)&&n.has(u)&&(a||d===1||!(d>l.anchor.offset+1))){if(a){let e=r.read(()=>f.getTextContent())[d-1];if(!o.has(e))return}e.update(()=>{if(!uB(f))return;let e=f.getParent();e===null||dz(e)||s(e,f,c.anchor.offset)&&Ld(`history-push`)})}}),e.registerCommand(Zo,e=>{if(e!==null&&e.shiftKey)return!1;let t=R();if(!I(t)||!t.isCollapsed())return!1;let i=t.anchor.offset,a=t.anchor.getNode();if(!F(a)||!uB(a))return!1;let o=a.getParent();return o===null||dz(o)?!1:i===a.getTextContent().length&&!(!pB(o,a,i,n.multilineElement,!0)&&!fB(o,a,i,r,!0))&&(e!==null&&e.preventDefault(),!0)},1))}var vB=[{dependencies:[Qh],export:e=>tg(e)?`***`:null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{let i=eg();r||e.getNextSibling()!=null?e.replace(i):e.insertBefore(i),i.selectNext()},triggerOnEnter:!0,type:`element`},...lB];function yB({transformers:e=vB}){let[t]=gx();return(0,k.useEffect)(()=>_B(t,e),[t,e]),null}var bB=ii({init(e){e.pubIn({[KS]:()=>k.createElement(xB,null),[ZS]:()=>k.createElement(xB,null),[$S]:()=>k.createElement(xB,{excludeLists:!0})})}}),xB=({excludeLists:e=!1})=>{let t=qr(cC),n=qr(qC),r=n.join(),i=k.useMemo(()=>{let r=TB(t,t.includes(`headings`)?n:[]);return e?r.filter(e=>!wB.has(e)):r},[t,r,e]);return k.createElement(yB,{transformers:i})},SB=e=>(t,n,r)=>{let i=e(r);i.append(...n),t.replace(i),i.select(0,0)},CB={dependencies:[QC],export:e=>tg(e)?`***`:null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{let i=ew();r||e.getNextSibling()!=null?e.replace(i):e.insertBefore(i),i.selectNext()},type:`element`},wB=new Set([Jz,Kz,qz]);function TB(e,t){let n=[Zz,Qz,$z,eB,Yz,nB,rB];if(e.includes(`headings`)&&t.length>0){let e=RegExp(`^(${t.map(e=>`#`.repeat(e)).join(`|`)})\\s`),r={dependencies:[W_],export:(e,t)=>{if(!Y_(e))return null;let n=Number(e.getTag().slice(1));return`#`.repeat(n)+` `+t(e)},regExp:e,replace:SB(e=>J_(`h${e[1].length}`)),type:`element`};n.push(r)}if(e.includes(`thematicBreak`)&&n.push(CB),e.includes(`quote`)&&n.push(Wz),e.includes(`link`)&&n.push(iB),e.includes(`lists`)&&n.push(Jz,Kz,qz),e.includes(`codeblock`)){let e={...Gz,dependencies:[GR],replace:(e,t,n)=>{let r=XR({code:``,language:n[1]??``,meta:``});e.selectPrevious(),e.replace(r),setTimeout(()=>{r.select()},80)}};n.push(e)}return n}function EB(e,t){return $t(Fe(e,t))}function DB(e,t){let n=nn(Zt(e).body),r=en(t.edited),i;if(t.kind===`replace`){let n=Fe(e,t.range);i=me(e,t.range,r.trim()?Xt(n,r):``)}else i=r.trim()?je(e,t.after,Xt(``,r)):e;let a=Zt(i),o=Qt(a.body,n);return o===a.body?i:`${a.frontmatter}${o}`}function OB(e,t){return e.trimEnd()===t.trimEnd()}function kB(e,t){let n=He(e);return e.slice(n+t.start,n+t.end)}function AB(e){return en(e).replace(/\\\n|\s*\n\s*/g,` `).replace(/&#x20;/g,` `).replace(/\\.|\|/g,e=>e===`|`?`\\|`:e).trim()}function jB(e,t,n){let r=He(e),i=AB(n),a=r+t.start,o=r+t.end,s=e.slice(0,a),c=e.slice(o);return`${s}${i}${t.start===t.end&&i&&!c.startsWith(` `)?` `:``}${c}`}var MB=new Set([`form`,`questions`].flatMap(e=>[e,tn[e]??e]));function NB(e){return!!(e&&MB.has(e))}function PB(e){let t=e?.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===`locked`);if(!t)return;let n=t.value;if(n==null||n===``||n===`true`)return!0;if(n===`false`)return!1;if(typeof n==`object`&&n&&`value`in n){let e=String(n.value).trim();if(e===`true`)return!0;if(e===`false`)return!1}}function FB(e){return PB(e)??NB(e?.name)}function IB(e){if(!e||typeof e!=`object`||!(`getMdastNode`in e))return!1;let t=e.getMdastNode;return typeof t==`function`&&FB(t.call(e))}var LB=(0,k.createContext)(!1);function RB(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`mdxJsxFlowElement`||t===`mdxJsxTextElement`}function zB(e){let t=e&&typeof e==`object`?e.children:void 0;return t?t.some(e=>RB(e)&&FB(e)||zB(e)):!1}function BB(e){if(IB(e))return!0;if(!e||typeof e!=`object`||!(`getMdastNode`in e))return!1;let t=e.getMdastNode;return typeof t==`function`&&zB(t.call(e))}var VB=24,HB=120;function UB(e){if(!(e instanceof HTMLElement))return;let t=Ku(e);if(!t)return;let n=e.isContentEditable&&t.getRootElement()===e?t._parentEditor:t;for(;n;){let e=n;e.getEditorState().read(()=>R()!==null)&&e.update(()=>fd(null),{tag:[cc,sc]}),n=e._parentEditor}}function WB(){let e=document.activeElement;if(!e)return;let t=Ku(e);t&&t._parentEditor&&t.dispatchCommand(Hx,void 0)}function GB(e){return e.getEditorState().read(()=>U().getChildrenKeys())}function KB(e){return Ou(e)&&e.getTextContent()===``}function qB(e){return GB(e).flatMap(t=>{let n=e.getElementByKey(t);return n?[{key:t,element:n}]:[]})}function JB(e,t){let n=e.getRootElement();if(!n||!(t instanceof Node)||!n.contains(t))return null;let r=t instanceof Element?t:t.parentElement;for(;r&&r.parentElement!==n;)r=r.parentElement;return r?qB(e).find(e=>e.element===r)?.key??null:null}function YB(e,t){let n=qB(e),r=null,i=1/0;for(let[e,{key:a,element:o}]of n.entries()){let s=o.getBoundingClientRect(),c=n[e+1]?.element.getBoundingClientRect().top??s.bottom+VB;if(t>=s.top-(e===0?8:0)&&t<c)return a;let l=Math.min(Math.abs(t-s.top),Math.abs(t-c));l<i&&(i=l,r=a)}return i<40?r:null}function XB(e,t,n){let r=qB(e).filter(e=>e.key!==n);if(r.length===0)return null;for(let{key:e,element:n}of r){let r=n.getBoundingClientRect();if(t<r.top+r.height/2)return{drop:{beforeKey:e},lineY:r.top-6}}let i=r[r.length-1];return{drop:{afterKey:i.key},lineY:i.element.getBoundingClientRect().bottom+6}}function ZB(e,t){let[n,r]=(0,k.useState)(e?`open`:null);return(0,k.useEffect)(()=>{if(e){r(`open`);return}r(e=>e?`closing`:null);let n=setTimeout(()=>r(null),t);return()=>clearTimeout(n)},[e,t]),e?`open`:n}function QB({level:e}){let[t]=gx(),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(0),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(null),[f,p]=(0,k.useState)(null),[m,h]=(0,k.useState)(()=>t.isEditable());(0,k.useEffect)(()=>(h(t.isEditable()),t.registerEditableListener(h)),[t]);let g=ZB(c,HB),_=(0,k.useRef)(void 0),v=(0,k.useRef)(null),y=(0,k.useRef)(null),b=(0,k.useRef)(null),x=(0,k.useCallback)(e=>e instanceof Node&&!!(v.current?.contains(e)||y.current?.contains(e)),[]);(0,k.useEffect)(()=>t.registerRootListener(e=>{let t=e?.parentElement??null;t&&getComputedStyle(t).position===`static`&&(t.style.position=`relative`),r(t)}),[t]),(0,k.useEffect)(()=>t.registerNodeTransform(du,e=>{let t=e.getLastChild();(t===null||B(t))&&e.append(V())}),[t]);let S=(0,k.useCallback)(()=>{_.current&&clearTimeout(_.current),_.current=void 0},[]),C=(0,k.useCallback)(()=>{S(),_.current=setTimeout(()=>{b.current||c||x(document.activeElement)||a(null)},600)},[S,x,c]);(0,k.useEffect)(()=>{if(!n)return;let e=e=>{if(b.current||c||e.pointerType===`touch`||x(e.target))return;let n=YB(t,e.clientY);n&&(S(),a(n))},r=e=>{if(x(e.target))return;let n=JB(t,e.target);n&&(S(),a(n))};return n.addEventListener(`pointermove`,e),n.addEventListener(`pointerleave`,C),n.addEventListener(`focusin`,r),()=>{n.removeEventListener(`pointermove`,e),n.removeEventListener(`pointerleave`,C),n.removeEventListener(`focusin`,r)}},[S,n,t,x,c,C]),(0,k.useEffect)(()=>t.registerUpdateListener(({editorState:e})=>{if(b.current||c)return;let n=e.read(()=>{let e=R();return I(e)?e.anchor.getNode().getTopLevelElement()?.getKey()??null:null});n&&t.getRootElement()?.contains(document.activeElement)&&a(n)}),[t,c]);let w=(0,k.useCallback)(()=>{if(!n||!i)return;let r=t.getElementByKey(i);if(!r){a(null);return}let o=r.getBoundingClientRect(),c=n.getBoundingClientRect();if(s(o.top-c.top),e!==`root`)return;let l=r.nextElementSibling?.getBoundingClientRect().top??o.bottom+VB;p({top:o.bottom+Pe(l-o.bottom).offset-c.top,left:o.left-c.left,width:o.width})},[n,t,i,e]);(0,k.useLayoutEffect)(w,[w]),(0,k.useEffect)(()=>{window.addEventListener(`resize`,w);let e=t.registerUpdateListener(()=>{requestAnimationFrame(w)});return()=>{window.removeEventListener(`resize`,w),e()}},[t,w]),(0,k.useEffect)(()=>{let e=i?t.getElementByKey(i):null;if(!e||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>w());return n.observe(e),()=>n.disconnect()},[t,i,w]),(0,k.useEffect)(()=>{if(!c)return;let e=e=>{v.current?.contains(e.target)||l(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[c]);let T=(0,k.useCallback)(n=>{WB(),t.update(n,{discrete:!0}),e===`nested`&&t.dispatchCommand(Hx,void 0),requestAnimationFrame(w)},[t,e,w]),E=(0,k.useCallback)((e,t)=>T(()=>{let n=H(e),r=H(`beforeKey`in t?t.beforeKey:t.afterKey);n&&r&&!n.is(r)&&(`beforeKey`in t?r.insertBefore(n):r.insertAfter(n))}),[T]),ee=(0,k.useCallback)(e=>{if(!i)return;let n=GB(t),r=n.indexOf(i),a=n[r+e];r<0||!a||E(i,e<0?{beforeKey:a}:{afterKey:a})},[t,i,E]),D=(0,k.useCallback)(()=>{if(!i)return;l(!1);let e=null;T(()=>{let t=H(i);if(!t)return;let n=t.getNextSibling(),r=KB(t)?t:KB(n)?n:null;r||(r=V(),t.insertAfter(r)),r.clear(),r.append(jc(`/`)),r.selectEnd(),e=r.getKey()});let n=document.activeElement;n instanceof HTMLElement&&n!==t.getRootElement()&&n.blur(),t.focus(),e&&a(e)},[T,t,i]),te=(0,k.useCallback)(()=>{i&&(t.getEditorState().read(()=>BB(H(i)))||(l(!1),T(()=>H(i)?.remove()),a(null)))},[T,t,i]);function ne(e){i&&e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b.current={key:i,pointerId:e.pointerId,startY:e.clientY,moved:!1,drop:null})}function re(e){let r=b.current;if(!r||r.pointerId!==e.pointerId||!n||!r.moved&&Math.abs(e.clientY-r.startY)<5)return;r.moved||(r.moved=!0,l(!1),t.getElementByKey(r.key)?.setAttribute(`data-block-dragging`,`true`)),e.clientY<80?window.scrollBy(0,-14):e.clientY>window.innerHeight-80&&window.scrollBy(0,14);let i=XB(t,e.clientY,r.key);r.drop=i?.drop??null,d(i?i.lineY-n.getBoundingClientRect().top:null)}function ie(e,n){let r=b.current;r&&r.pointerId===e.pointerId&&(b.current=null,d(null),t.getElementByKey(r.key)?.removeAttribute(`data-block-dragging`),r.moved?!n&&r.drop&&E(r.key,r.drop):n||l(e=>!e))}function ae(e){e.altKey&&(e.key===`ArrowUp`||e.key===`ArrowDown`)?(e.preventDefault(),ee(e.key===`ArrowUp`?-1:1)):e.key===`Enter`||e.key===` `?(e.preventDefault(),l(e=>!e)):e.key===`Escape`&&l(!1)}if(!n||!m)return null;let oe=i?GB(t):[],se=i?oe.indexOf(i):-1,ce=i?t.getEditorState().read(()=>BB(H(i))):!1;return(0,jx.createPortal)((0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{ref:v,className:`plan-block-handles`,"data-level":e,"data-plan-grab-ignore":``,hidden:!i,style:{top:o},onPointerEnter:S,onPointerLeave:C,children:[(0,A.jsx)(`button`,{type:`button`,className:`plan-block-button plan-block-grip`,"aria-label":`Drag to move this block, or open its actions`,title:`Drag to move · click for actions`,"aria-haspopup":`menu`,"aria-expanded":c,"data-block-grip":``,onPointerDown:ne,onPointerMove:re,onPointerUp:e=>ie(e,!1),onPointerCancel:e=>ie(e,!0),onKeyDown:ae,children:(0,A.jsx)(Sn,{size:16,"aria-hidden":`true`})}),g?(0,A.jsxs)(`div`,{className:`plan-block-menu`,role:`menu`,"aria-label":`Block actions`,"data-closing":g===`closing`?``:void 0,inert:g===`closing`,children:[(0,A.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:D,children:[(0,A.jsx)(rt,{size:14,"aria-hidden":`true`}),` Add below`]}),(0,A.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:se<=0,onClick:()=>ee(-1),"data-block-move":`up`,children:[(0,A.jsx)(qe,{size:14,"aria-hidden":`true`}),` Move up`]}),(0,A.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:se<0||se>=oe.length-1,onClick:()=>ee(1),"data-block-move":`down`,children:[(0,A.jsx)(Ge,{size:14,"aria-hidden":`true`}),` Move down`]}),(0,A.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`plan-block-menu-danger`,disabled:ce,title:ce?`Locked cards cannot be removed`:void 0,onClick:te,children:[(0,A.jsx)(Xn,{size:14,"aria-hidden":`true`}),` Delete`]})]}):null]}),e===`root`?(0,A.jsx)(`button`,{ref:y,type:`button`,className:`plan-block-add`,"aria-label":`Add a block below`,title:`Add a block below`,"data-block-add":``,"data-plan-grab-ignore":``,hidden:!i||!f||u!==null,style:f?{top:f.top,left:f.left,width:f.width}:void 0,onPointerEnter:S,onPointerLeave:C,onMouseDown:e=>e.preventDefault(),onClick:D,children:(0,A.jsx)(rt,{size:10,strokeWidth:2.5,"aria-hidden":`true`})}):null,u===null?null:(0,A.jsx)(`div`,{className:`plan-block-drop-line`,style:{top:u},"aria-hidden":`true`})]}),n)}function $B(){return(0,A.jsx)(QB,{level:`root`})}function eV(){return(0,A.jsx)(QB,{level:`nested`})}var tV=ii({init(e){e.pubIn({[KS]:$B,[ZS]:eV})}}),nV=100,rV=`insert`,iV=`backspace`,aV=`delete`,oV=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??nV)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(cV),redoStack:this.#t.map(cV),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){this.#e.length===0?this.push(e):(this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0)}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function sV(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(lV),selectionsAfter:e.selectionsAfter?.map(lV),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function cV(e){return{...sV(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function lV(e){return{...e,start:{...e.start},end:{...e.end}}}function uV(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?iV:n?aV:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function dV(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=mV(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
84
+ `)&&!a.text.includes(`
85
+ `),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
86
+ `)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=rV,n!==rV||e.coalescingMode!==void 0&&e.coalescingMode!==rV||t.coalescingMode!==void 0&&t.coalescingMode!==rV))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=aV;else if(c+(o.end-o.start)!==i.start)return!1;else r=iV;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1}else return!1}return n!==void 0}function fV(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=mV(c.start,e.forwardEdits);o.text.length>0?(i??=rV,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text)):u===o.end?(i??=aV,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text)):(i??=iV,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text))}return{forwardEdits:n,inverseEdits:pV(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function pV(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function mV(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;n<e.start||(n>=e.start+r?n-=i:n=e.start+Math.min(n-e.start,t))}return n}var hV=1e5,gV=10,_V=13,vV=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,yV=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},bV=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=re(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===gV||r===_V)&&(r===_V&&e.charCodeAt(n+1)===gV&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},xV=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!AV(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!AV(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},SV=class{#e;#t=new bV(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new bV(e);let t=this.#y(yV.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&CV(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=wV(e,0,this.#r),i=wV(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&CV(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=TV(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=EV(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=TV(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!DV(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
87
+ `)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=FV(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,hV)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=re(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&CV(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=RV(u,a);continue}let s=c+a;if((!t||PV(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=RV(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=wV(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=wV(e,0,this.#r),r=wV(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=wV(n.start,0,this.#r),i=wV(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=wV(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=wV(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e)t=t.left;else{if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=wV(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e)t=t.left;else{if(r+=(t.left?.subtreeLineBreakCount??0)-+!!AV(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(jV(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&AV(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!AV(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!AV(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!AV(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===yV.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=jV(r.lineOffsets,t),o=jV(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new yV(e,t,n,a,o,s===_V&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(yV.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new xV(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new xV(this.#y(e.piece.source,e.piece.offset,i)),o=new xV(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new xV(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(OV(n.piece,t)){n.piece=kV(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function CV(e){return e===10||e===13}function wV(e,t,n){return Math.min(Math.max(e,t),n)}function TV(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function EV(e,t){let n=[];for(let[r,i]of e){let e=wV(r,0,t),a=wV(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];t!==void 0&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):r.push(e)}return r}function DV(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function OV(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!AV(e.lastCharCode,t.firstCharCode)}function kV(e,t){return new yV(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function AV(e,t){return e===_V&&t===gV}function jV(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function MV(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function NV(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return vV.includes(t)}function PV(e,t,n){let r=t<=0||NV(e.charCodeAt(t-1)),i=t+n>=e.length||NV(e.charCodeAt(t+n));return r&&i}function FV(e,t,n){let r=t?e:MV(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function IV(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function LV(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=FV(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:IV(r.replaceText,u)}function RV(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var zV=new WeakMap;function BV(e){return zV.get(e)}function VV(e,t){zV.set(e,t)}var HV=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new oV,a){if(this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new SV(t),this.#i=i,a!=null)this.#a=a;else{let e=this.#r.getLineText(0,!0);this.#a=e.endsWith(`\r
88
+ `)?`\r
89
+ `:e.endsWith(`\r`)?`\r`:`
90
+ `}}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get history(){return this.#i.getLiveState()}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}clearHistory(){this.#i.clear()}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=uV(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&dV(o,a)?this.#i.replaceLastUndo(fV(o,a)):this.#i.push(a),VV(s,{appliedEdits:a.forwardEdits,inverseEdits:a.inverseEdits}),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;VV(t,{appliedEdits:e.inverseEdits,inverseEdits:e.forwardEdits}),this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;VV(t,{appliedEdits:e.forwardEdits,inverseEdits:e.inverseEdits}),this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],f=t[l*2],p=t[l*2+1],m=f.line,h=p.line,g=d(u.text),_=m+i,v=_+g,y=g-(h-m);n=Math.min(n,m),r=Math.max(r,v);let b=a[a.length-1];b!==void 0&&_<=b[1]+1?a[a.length-1]=[b[0],Math.max(b[1],v)]:a.push([_,v]),o.push([_,v,y,f.character,p.character,h===s&&p.character===c]),i+=y}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}},UV=e(gn(),1),WV=100,GV=class{type;#e=new UV.default.LRUMap(WV);#t=new Map;constructor(e){this.type=e}activate(e,t,n){let r=this.#t.get(e);if(r!=null&&r.owner!==t)throw Error(`Editor: editStateKey "${e}" is already attached to another editor`);if(r!=null)return n!=null&&(r.session=n),r.session;let i=this.#e.delete(e),a={type:this.type},o=n??i??a;return this.#t.set(e,{owner:t,session:o}),o}release(e,t,n=!1){let r=this.#t.get(e);if(r?.owner!==t||(this.#t.delete(e),n))return;let i=JV(r.session);i!=null&&this.#e.set(e,i)}get(e){let t=this.#t.get(e);return t==null?this.#e.find(e):JV(t.session)??void 0}clear(e,t){if(this.#t.has(e))return!1;let n=this.#e.find(e);return n!=null&&(t==null||t.document===!0?this.#e.delete(e):YV(n,t),!0)}clearAll(){this.#e.clear()}setCapacity(e){if(!Number.isSafeInteger(e)||e<1)throw RangeError(`EditStateManager: capacity must be a positive integer`);for(;this.#e.size>e;)this.#e.shift();this.#e.limit=e}},KV=class{#e=new GV(`file`);#t=new GV(`file-diff`);activate(e,t,n,r){return e===`file`?this.#e.activate(t,n,r):this.#t.activate(t,n,r)}releaseFile(e,t,n=!1){this.#e.release(e,t,n)}releaseFileDiff(e,t,n=!1){this.#t.release(e,t,n)}get(e,t){return e===`file`?this.#e.get(t):this.#t.get(t)}clear(e,t,n){return e===`file`?this.#e.clear(t,n):this.#t.clear(t,n)}clearAll(){this.#e.clearAll(),this.#t.clearAll()}setCapacity(e){this.#e.setCapacity(e),this.#t.setCapacity(e)}};function qV(e){return{selections:e.selections?.map(e=>({...e,start:{...e.start},end:{...e.end}})),view:e.view==null?void 0:{...e.view}}}function JV(e){if(e.document!=null&&e.fileInfo!=null&&(e.type===`file`||e.diffSession!=null))return e.editor??={},e}function YV(e,t){e!=null&&(t.history===!0&&e.document?.clearHistory(),e.editor!=null&&((t.editor===!0||t.selections===!0)&&(e.editor.selections=void 0),(t.editor===!0||t.view===!0)&&(e.editor.view=void 0)))}var XV=new KV;function ZV({metaKey:e,ctrlKey:t},n=g()){return n?e&&!t:t&&!e}function QV(e){let t=g();if(t&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(!e.altKey&&ZV(e,t)){if(e.key===`ArrowLeft`)return t?`textStart`:`wordLeft`;if(e.key===`ArrowRight`)return t?`end`:`wordRight`}}var $V=new WeakMap,eH=nH([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),tH={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function nH(e){let t=$V.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}$V.set(e,t)}return t}function rH(e,t,n=g()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):tH[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=nH(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=eH[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function iH(e,t=g()){if(!e.altKey&&ZV(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var aH=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,this.#f()&&e===void 0&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[dn(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[dn(r,`scroll`,t,{passive:!0})],dn(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function oH(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0?(e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`)):(e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`))}function sH(e){return l(e)}function cH(e,t){let n=lH(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(`side`in a&&a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=uH(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||fH(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){if(c===a.lineNumber)r.push(a);else{let e={...a,lineNumber:c};S(e,h(a)),r.push(e)}i=!0}else r.push(a)}return i?r:void 0}function lH(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function uH(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(dH(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return pH(t.startLine+r,n)}function dH(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function fH(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function pH(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function mH(e,t,n,r=sH){let i=new Map,a=new Map;for(let t of e){let e=t.lineNumber;i.has(e)||i.set(e,[]),a.has(e)||a.set(e,[]),(`side`in t&&t.side===`deletions`?a:i).get(e).push(r(t))}let o=t.parentElement?.previousElementSibling,s,c;if(o!=null&&o instanceof HTMLElement&&o.dataset.deletions!==void 0)for(let e of o.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(c=t):s=t}hH(t,n),c!==void 0&&hH(c,s);let l=gH(i,t,n);if(c===void 0)return;let u=gH(a,c,s);requestAnimationFrame(()=>{_H(i,a,l,u)})}function hH(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function gH(e,t,n){let r=new Map;for(let n of t.children){let t=an(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=t-1,a=O(`div`,{dataset:{lineAnnotation:`0,`+e},children:[O(`div`,{dataset:`annotationContent`,children:i.map(e=>O(`slot`,{name:e}))})]});n.after(a),r.set(t,a)}}}if(n!==void 0)for(let t of n.children){let n=an(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=O(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function _H(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=vH(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=vH(t);n>0&&i.set(e,n)}}yH(e,n,i),yH(t,r,i)}function vH(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function yH(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var bH=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),xH=new Set([`'`,`"`,"`"]),SH=new Set([`{`,`[`,`(`,`<`]);function CH(e,t=0){let n=jU(e.startContainer,e.startOffset),r=jU(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function wH(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function TH(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`||n===`wordLeft`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=GH(t);a=i.line,o=i.character;let s=OH(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+OU(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=EH(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=EH(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(WH(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`||n===`wordLeft`){if(o>0)o=n===`left`?wU(e,a,o,!1):xU(e.getLineText(a),o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=n===`right`?wU(e,a,o,!0):xU(e.getLineText(a),o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function EH(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=OH(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=AH(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=kH(s,i);c=AH(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:DH(f,d)}}function DH(e,t){if(t<=0||t>=e.length)return t;let n=un();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function OH(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=AH(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return AH(e,t,n<(a[0]??0)?0:a.length-2,r)}function kH(e,t){let n=t.getSoftLineOffsets?.(e);return n===void 0||n.length<2?1:n.length-1}function AH(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function jH(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=TH(e,[{start:i,end:i,direction:0}],n,r);return QH(t,a)})}function MH(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=AU(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=AU(e,{start:g.start,end:g.end,text:f.text},i),n=DU(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));g!==void 0&&t<g.end?(g.end=Math.max(g.end,n),g.indices.push(e.index)):(_(),g={start:t,end:n,indices:[e.index]})}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=kU(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=cH(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function NH(e,t){if(t.length!==e.length+2)return;let n=bH.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function PH(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=NH(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function FH(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end)n-=e.end-e.start;else{r=e.start+n;break}}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=DU(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=PH(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=kU(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=cH(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function IH(e,t){return e===`never`?!1:e===`brackets`?SH.has(t):e!==`quotes`||xH.has(t)}function LH(e,t,n,r){if(n.length!==1||t.length===0)return;let i=bH.get(n);if(i===void 0||!IH(r,n))return;let a=[];for(let r of t){if(WH(r))return;a.push(n+e.getText(r)+i)}return a}function RH(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=TU(e,n);if(!WH(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=CU(l),p;if(s>0&&s<u){let e=SU(l,s,!1,f),t=SU(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?SU(n,r,!1,CU(n)):r,u=SU(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=kU(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=cH(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function zH(e,t,n){let r=t.map(t=>{let n=EU(e,t);return{start:n.start,end:n.end,direction:0}});return FH(e,r,r.map(()=>``),n)}function BH(e,t,n,r){let i=t.map(t=>{if(!WH(t))return{start:t.start,end:t.end,direction:0};let r=GH(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return FH(e,i,i.map(()=>``),r)}function VH(e,t,n){let r=t.map(t=>{let[n,r]=yU(e,t);return{start:n,end:r,direction:0}});return FH(e,r,r.map(()=>``),n)}function HH(e,t,n){if(!WH(t))return[t.start,t.end];let r=GH(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:wU(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:wU(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function UH(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=HH(e,t,n);if(!n&&WH(t)){let t=AU(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return FH(e,a,a.map(()=>``),r)}function WH(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function GH(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function KH(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function qH(e,t){let n=WH(e),r=WH(t);return n&&r?JH(e.start,t.start)===0:n?JH(t.start,e.start)<=0&&JH(e.start,t.end)<=0:r?JH(e.start,t.start)<=0&&JH(t.start,e.end)<=0:JH(e.start,t.end)<0&&JH(t.start,e.end)<0}function JH(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function YH(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function XH(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function ZH(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=XH(a,r),c=XH(o,r);return YH(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function QH(e,t){let n=e.direction===-1?e.end:e.start,r=JH(n,t.start),i=JH(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=JH(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function $H(e,t){let n=JH(t.start,e.start)<0,r=JH(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:JH(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:JH(e.start,t.end)===0?0:1}}function eU(e,t){return tU(e.map(e=>$H(e,t)))}function tU(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=JH(e.selection.start,t.selection.start);if(n!==0)return n;let r=JH(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1))if(qH(r.selection,e.selection)){let t=e.index>r.index?e:r,n=JH(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=JH(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&JH(n,i)!==0&&(a=JH(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}}}else n.push(r),r=e;return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function nU(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&JH(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function rU(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function iU(e,t){if(t.length===0)return;let n=t.map(t=>WH(t)?_U(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return JH(e.start,r.start)!==0||JH(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=YH(e,o,o+i.length);return[...n,s]}function aU(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function oU(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function sU(e,t){if(WH(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function cU(e,t){return t.map(t=>sU(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function lU(e,t){return cU(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function uU(e,t){let n=cU(e,t),r=e.eol,i=``,a=-1;for(let t of n)t.end<=t.start||(t.start<=a?t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end):(i.length>0&&!rn(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end));return i}function dU(e,t){if(WH(t))return fU(e,t);let[n,r]=JH(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function fU(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function pU(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function mU(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function hU(e,t){let n=[...t.map((t,n)=>({index:n,edit:dU(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=pU(n);return{text:uU(e,t),edits:r,nextSelectionOffsets:mU(n,r)}}function gU(e,t){let n=Math.max(0,t),r=MU(e),i=null;for(let e of r){i=e;let t=BU(e);if(n<=t+(e.textContent?.length??0)){let r=NU(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=NU(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=VU(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,VU(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,VU(o.textContent,o.textContent?.length??0)]}function _U(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=vU(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function vU(e,t){let n=ln({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function yU(e,t){if(!WH(t))return[t.start,t.end];let n=GH(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=CU(a),s=i,c;for(;s>0;){let e=SU(a,s,!1,o),t=bU(a.slice(e,s));if(c!==void 0&&t!==c)break;(t!==0||s!==i)&&(c=t),s=e}return[{line:r,character:s},{line:r,character:i}]}function bU(e){return/\S/.test(e)?/\p{Alphabetic}|\p{Number}|_/u.test(e)?1:2:0}function xU(e,t,n){let r=un()?.segment(e),i=t,a=0;for(;n?i<e.length:i>0;){let t,o,s=r?.containing(n?i:i-1);if(s!==void 0)t=s.segment,o=n?s.index+t.length:s.index;else{let r=n?i:(e.codePointAt(i-2)??0)>65535?i-2:i-1;t=String.fromCodePoint(e.codePointAt(r)??0),o=n?i+t.length:r}let c=bU(t);if(a!==0&&c!==a)break;a=c,i=o}return i}function SU(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function CU(e){let t=[0],n=un();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function wU(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=un();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=un();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function TU(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(GH(t))]}function EU(e,t){if(!WH(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function DU(e,t,n){if(t!==`
91
+ `&&t!==`\r`&&t!==`\r
92
+ `)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=OU(i);return a===0?t:t+i.slice(0,a)}function OU(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function kU(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function AU(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function jU(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&zU(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=zU(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:LU(e.parentElement)===null?{line:r,character:IU(n,e)+VU(e.textContent,t)}:{line:r,character:RU(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=RU(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=BU(e);if(t!==void 0)return{line:r,character:t};let n=LU(e),i=n===null?void 0:BU(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?RU(i.childNodes[t-1]):IU(n,i)}}return{line:r,character:IU(n,i)}}return null}function MU(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(BU(e)!==void 0)t.push(e);else for(let n of e.childNodes)n.nodeType===1&&BU(n)!==void 0&&t.push(n)}}return t}function NU(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=VU(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function PU(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=VU(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function FU(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function IU(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=RU(e.childNodes[t]);return n}for(let n of MU(e))if(FU(n,t))return BU(n)+(t.nodeType===3?PU(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&zU(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=RU(e.childNodes[r]);r=e}return n}function LU(e){let t=e;for(;t!==null;){if(zU(t)!==void 0)return null;if(BU(t)!==void 0)return t;t=t.parentElement}return null}function RU(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=LU(n);if(r===null)return 0;let i=BU(r);if(i===void 0)return 0;let a=t===void 0?VU(e.textContent,e.textContent?.length??0):VU(e.textContent,t);return i+PU(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=BU(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,RU(e));return i}function zU(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function BU(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function VU(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var HU=300,UU=100,WU=`marker-popover`,GU=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];n===void 0?this.removePopover():this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[dn(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),dn(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=an(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(qH({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){e===this.#l||e===this.#c?this.#p():(this.#f(),this.#p(),this.#r===void 0?(this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},HU)):this.#y(e))}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},UU))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){oH(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:WU})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(WU)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(WU),s!==void 0){qU(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e}else this.#r=O(`div`,{dataset:{editorWidget:``,markerPopover:``,[JU(i)]:``},children:[O(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[dn(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),dn(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},KU=[`error`,`warning`,`info`,`hint`];function qU(e,t){for(let t of KU)delete e.dataset[JU(t)];e.dataset[JU(t)]=``}function JU(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}function YU(e){return{...e,oldFile:e.oldFile==null?null:{...e.oldFile,lines:[...e.oldFile.lines]},hunks:D(e.hunks)}}var XU=`@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:"";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:"↵"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto auto;grid-template-areas:"toggle find matches nav"".replace actions.";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:"toggle find matches nav"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".replace replace replace"".nav matches actions"}[data-search-grid][data-mode=find]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".nav matches matches"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-replace-toggle]{--diffs-search-icon-size:16px;grid-area:toggle;align-self:stretch;height:auto;&[aria-expanded=false] svg{transform:rotate(-90deg)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}
93
+ `,ZU=350,QU=150,$U=512,eW=662,tW=131072,nW=6144,rW=1e3,iW=8,aW=3,oW=[11,aW],sW=new TextEncoder;function cW(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===13&&e.charCodeAt(n+1)===10&&n++,(e.charCodeAt(n)===10||e.charCodeAt(n)===13)&&t.push(n+1);return t}function lW(e,t){return e.length===0?0:t.at(-1)===e.length?t.length-1:t.length}function uW(e,t,n){let r=t[n+1];return r===void 0?e.length:r-(e.charCodeAt(r-1)===10&&e.charCodeAt(r-2)===13?2:1)}function dW(e,t,n,r,i,a){let o=t[n],s=i[a],c=uW(e,t,n)-o;if(c!==uW(r,i,a)-s)return!1;for(let t=0;t<c;t++)if(e.charCodeAt(o+t)!==r.charCodeAt(s+t))return!1;return!0}function fW(e,t,n,r){let i=lW(e,t),a=lW(n,r),o=0;for(;o<i&&o<a&&dW(e,t,o,n,r,o);)o++;let s=0;for(;s<i-o&&s<a-o&&dW(e,t,i-1-s,n,r,a-1-s);)s++;return{oldLineCount:i,newLineCount:a,prefixLines:o,suffixLines:s}}function pW(e,t,n,r=0){if(t===n)return;let i=cW(t),a=cW(n),o=fW(t,i,n,a);if(o.prefixLines===o.oldLineCount&&o.prefixLines===o.newLineCount)return;let s=o.oldLineCount-o.suffixLines,c=o.newLineCount-o.suffixLines,l=t.slice(i[o.prefixLines]??t.length,i[s]??t.length),u=n.slice(a[o.prefixLines]??n.length,a[c]??n.length);if(sW.encode(l).byteLength>nW||sW.encode(u).byteLength>nW)return;let d=Math.max(0,o.prefixLines-aW),f=Math.min(o.oldLineCount,s+aW),p=Math.min(o.newLineCount,c+aW),m=f-d,h=p-d,g=d+r,_=[`--- a/${e}`,`+++ b/${e}`,`@@ -${m===0?g:g+1},${m} +${h===0?g:g+1},${h} @@`];for(let e=d;e<o.prefixLines;e++)_.push(` ${t.slice(i[e],uW(t,i,e))}`);for(let e=o.prefixLines;e<s;e++)_.push(`-${t.slice(i[e],uW(t,i,e))}`);for(let e=o.prefixLines;e<c;e++)_.push(`+${n.slice(a[e],uW(n,a,e))}`);for(let e=s;e<f;e++)_.push(` ${t.slice(i[e],uW(t,i,e))}`);let v=_.join(`
94
+ `);return sW.encode(v).byteLength<=nW?{hunk:v,bounds:o}:void 0}function mW(e,t,n){let r=[],i=0;for(let a of n){let n=a.start-t,o=a.end-t;if(n<i||o<n||o>e.length)return;r.push(e.slice(i,n),a.text),i=o}return r.push(e.slice(i)),r.join(``)}function hW(e,t){let n=t.inverseEdits;if(n.length===0)return;let r=n[0].start,i=n[0].end;for(let e=1;e<n.length;e++)r=Math.min(r,n[e].start),i=Math.max(i,n[e].end);let[a,o]=e.positionsAt([r,i]);for(let t of oW){let r=Math.max(0,a.line-t),i=Math.min(e.lineCount-1,o.line+t),s=e.offsetAt({line:r,character:0}),c=i+1<e.lineCount?e.offsetAt({line:i+1,character:0}):e.offsetAt({line:i,character:e.getLineLength(i)});if(c-s>nW)continue;let l=e.getTextSlice(s,c);if(sW.encode(l).byteLength>nW)continue;let u=mW(l,s,n);if(!(u===void 0||u.length>nW||sW.encode(u).byteLength>nW))return{beforeText:u,afterText:l,startOffset:s,startLine:r,bounds:fW(u,cW(u),l,cW(l))}}}function gW(e,t,n,r,i,a=Date.now()){let o=e.slice(-10),s=hW(n,r);if(s===void 0){let e=o.at(-1);return e?.fragment!==void 0&&(o[o.length-1]={...e,fragment:void 0}),o}if(s.beforeText===s.afterText)return o;let c=s.startLine+s.bounds.prefixLines,l=s.startLine+s.bounds.oldLineCount-s.bounds.suffixLines,u=o.at(-1),d=u!==void 0&&c>u.end?c-u.end:u!==void 0&&u.start>l?u.start-l:0;if(u!==void 0&&u.fragment!==void 0&&u.path===t&&u.source===i&&a-u.at<rW&&d<=iW){let e=u.fragment,n=s.startOffset+s.beforeText.length,c=Math.max(e.currentStart,s.startOffset),l=Math.min(e.currentEnd,n);if(c<=l&&e.currentText.slice(c-e.currentStart,l-e.currentStart)===s.beforeText.slice(c-s.startOffset,l-s.startOffset)){let c=Math.min(e.currentStart,s.startOffset),l=e.currentStart<=s.startOffset?e.currentText+s.beforeText.slice(Math.max(0,e.currentEnd-s.startOffset)):s.beforeText+e.currentText.slice(Math.max(0,n-e.currentStart)),u=l.slice(0,e.currentStart-c),d=l.slice(e.currentEnd-c),f=u+e.baseText+d,p=mW(l,c,r.appliedEdits),m=e.currentStart<=s.startOffset?e.startLine:s.startLine;if(p!==void 0&&f.length<=nW&&p.length<=nW&&sW.encode(f).byteLength<=nW&&sW.encode(p).byteLength<=nW){if(f===p)return o.pop(),o;let e=pW(t,f,p,m);if(e!==void 0)return o[o.length-1]={path:t,hunk:e.hunk,start:m+e.bounds.prefixLines,end:m+e.bounds.newLineCount-e.bounds.suffixLines,at:a,source:i,fragment:{baseText:f,currentText:p,currentStart:c,currentEnd:c+p.length,startLine:m}},o}}}let f=o.at(-1);f?.fragment!==void 0&&(o[o.length-1]={...f,fragment:void 0});let p=pW(t,s.beforeText,s.afterText,s.startLine);return p===void 0?o:(o.push({path:t,hunk:p.hunk,start:c,end:s.startLine+s.bounds.newLineCount-s.bounds.suffixLines,at:a,source:i,fragment:{baseText:s.beforeText,currentText:s.afterText,currentStart:s.startOffset,currentEnd:s.startOffset+s.afterText.length,startLine:s.startLine}}),o.slice(-10))}function _W(e,t,n,r,i,a){for(;a>0&&(r>0||i<e-1);){let o=!1;if(r>0&&n(r-1)){let e=t(r-1);e<=a&&(r--,a-=e,o=!0)}if(i<e-1&&n(i+1)){let e=t(i+1);e<=a&&(i++,a-=e,o=!0)}if(!o)break}return{first:r,last:i}}function vW(e,t,n,r,i){if(t.lineCount<=0)return;let a=t.lineCount-1,o=t.offsetAt({line:a,character:t.getLineLength(a)}),s=Math.max(0,Math.min(Number.isFinite(n)?Math.trunc(n):0,o)),c=t.charAt(s-1).charCodeAt(0),l=t.charAt(s).charCodeAt(0);s>0&&s<o&&(c===13&&l===10||c>=55296&&c<=56319&&l>=56320&&l<=57343)&&s--;let u=t.positionAt(s).line,d=new Map,f=e=>{if(e<0||e>=t.lineCount)return!1;let n=d.get(e);return n??(n=i(e),d.set(e,n)),n};if(!f(u))return;let p=new Map,m=e=>{let n=p.get(e);if(n!==void 0)return n;let r=t.getLineLength(e);if(Math.floor(r/3)>eW)return p.set(e,663),663;let i=Math.max(1,Math.floor(sW.encode(t.getLineText(e)).byteLength/3));return p.set(e,i),i},h=u,g=u,_=Math.max(0,Math.floor(ZU*3/4)-m(u));for(;_>0&&(f(h-1)||f(g+1));){if(f(g+1)){let e=m(g+1);if(e>_)break;g++,_-=e}if(f(h-1)&&_>0){let e=m(h-1);if(e>_)break;h--,_-=e}}_+=88,{first:h,last:g}=_W(t.lineCount,m,f,h,g,_);let v=h,y=g;({first:v,last:y}=_W(t.lineCount,m,()=>!0,v,y,QU));let b=0;for(let e=h;e<=g;e++)b+=m(e);let x=0;for(let e=v;e<=y;e++)x+=m(e);if(b>$U||x>eW)return;let S=t.offsetAt({line:v,character:0}),C=t.offsetAt({line:y,character:t.getLineLength(y)}),w=t.getTextSlice(S,C),T={path:e,version:t.version,eol:t.eol,excerptText:w,excerptStartLine:v,cursorOffsetInExcerpt:s-S,editableRange:{start:t.offsetAt({line:h,character:0})-S,end:t.offsetAt({line:g,character:t.getLineLength(g)})-S},editHistory:r.slice(-10).map(({hunk:e,source:t})=>({diff:e,source:t}))};return sW.encode(JSON.stringify(T)).byteLength<=tW?T:void 0}function yW(e,t){if(typeof t!=`string`)return new RegExp(t.source,t.flags).test(e);t=t.replaceAll(`\\`,`/`);let n=`^`;for(let e=0;e<t.length;e++){let r=t[e];r===`*`?t[e+1]===`*`?(e++,t[e+1]===`/`?(e++,n+=`(?:.*/)?`):n+=`.*`):n+=`[^/]*`:n+=r===`?`?`[^/]`:/[\\^$.*+?()[\]{}|]/.test(r)?`\\${r}`:r}return RegExp(`${n}$`).test(e)}function bW(e,t){let n=t.changedLineChanges?.some(([,,e])=>e!==0)===!0?[[t.startLine,t.endLine]]:t.changedLineRanges,r=new Map;for(let[t,i]of n){let n=Math.min(i,e.lineCount-1);if(n<t)continue;if(n===t){r.set(t,e.getLineText(t,!0));continue}let a=n+1<e.lineCount?{line:n+1,character:0}:{line:n,character:e.getLineText(n).length},o=e.getText({start:{line:t,character:0},end:a}),s=c(o);for(let e=t;e<=n;e++)r.set(e,s[e-t])}return r}var xW=`//`,SW=[`/*`,`*/`],CW={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function wW(e,t){let n={...CW[e],...t?.[e]};return{lineComment:n.lineComment===void 0?xW:n.lineComment,blockComment:n.blockComment??SW}}function TW(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var EW=50;function DW(e,t,n,r,i){let a=Math.max(0,r-EW),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+EW),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=100?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+EW),p=d??e.getTextSlice(i-EW,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function OW(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length}else if(e>i.end)o+=i.text.length-(i.end-i.start);else return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function kW(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=DW(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;o&&t!==void 0?s.push(t.open,t.close):t===void 0&&(e.from===e.to?s.push({start:e.from,end:e.to,text:n+` `+r}):s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r}))}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=OW(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?OW(e.end,s,u,e.endAssociation):n,a[t].direction]})}}var AW=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),jW=new Map([...AW].map(([e,t])=>[t,e])),MW=1e3,NW=5e4;function PW(e,t,n){let r=FW(e,t,e.normalizePosition(n));if(r===void 0)return;let i=AW.get(r.char),a=jW.get(r.char);if(i!==void 0)return WW(r,RW(e,t,r,i));if(a!==void 0)return WW(zW(e,t,r,a),r)}function FW(e,t,n){let r=IW(n);if(r!==void 0){let n=LW(e,t,r);if(n!==void 0)return n}return LW(e,t,n)}function IW(e){if(e.character>0)return{line:e.line,character:e.character-1}}function LW(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!AW.has(r)&&!jW.has(r)||BW(t,n)))return{...n,char:r}}function RW(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=MW)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=NW)return;if(o++,HW(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function zW(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=MW)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=NW)return;if(o++,UW(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function BW(e,t){return VW(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function VW(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function HW(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function UW(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function WW(e,t){if(e!==void 0&&t!==void 0)return[GW(e),GW(t)]}function GW(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var KW=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
95
+ <symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
96
+ <path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
97
+ </symbol>
98
+ <symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
99
+ <path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
100
+ </symbol>
101
+ <symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
102
+ <path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
103
+ </symbol>
104
+ <symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
105
+ <path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
106
+ <path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
107
+ </symbol>
108
+ <symbol id="diffs-editor-icon-chevron" viewBox="0 0 16 16">
109
+ <path fill="currentColor" d="M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z"></path>
110
+ </symbol>
111
+ <symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
112
+ <path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
113
+ <path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
114
+ <path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
115
+ </symbol>
116
+ <symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
117
+ <path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
118
+ <path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
119
+ </symbol>
120
+ <symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
121
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
122
+ </symbol>
123
+ <symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
124
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
125
+ </symbol>
126
+ </svg>`,qW=()=>{let e=document.createElement(`div`);e.innerHTML=KW;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},JW=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
127
+ <use href="#diffs-editor-icon-${e}"></use>
128
+ </svg>`,YW=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=O(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(re.disabled=n,ie.disabled=n,n)f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);else if(delete f.dataset.noMatches,e?.syncSelection===!1){let e=c(d.all,{syncSelection:!1});m(e)}else m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e,r=d.all.findIndex(e=>e[0]===t&&e[1]===n);f.textContent=`${r+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0){if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:LV(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text!==``&&d.all.length!==0&&(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>O(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:JW(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=O(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=iH(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=O(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=iH(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?ZV(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),le(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let ee=O(`div`,{dataset:`searchToggles`,children:[C,w,T]}),D=O(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,ee]}),te=O(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),ne=O(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),re=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),ie=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});re.disabled=!0,ie.disabled=!0;let ae=O(`div`,{dataset:`searchNav`,children:[re,ie]}),oe=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),se=x({icon:`chevron`,label:`Toggle Replace`,dataset:{replaceToggle:``},onClick:()=>{ce.dataset.mode===`replace`?le(`find`):(le(`replace`),E.focus())}});se.ariaExpanded=String(i===`replace`);let ce=O(`div`,{dataset:{searchGrid:``,mode:i},children:[se,D,te,ne,f,ae,oe]}),le=e=>{ce.dataset.mode=e,se.ariaExpanded=String(e===`replace`),this.#t.focus(),this.#t.select()};this.#r=le,this.#e=O(`div`,{dataset:`searchPanel`,children:[O(`div`,{dataset:`editorWidget`,children:[ce]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},XW=class{#e;#t;#n;constructor(e,t,n){this.#e=O(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,oH(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}},ZW=4096,QW=/\p{Mark}/u,$W=class{#e;#t;#n;#r;#i=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#n!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=O(`canvas`,{style:{display:`none`}}),this.#n??=this.#t.getContext(`2d`)??void 0,this.#n===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=on(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#r!==o||this.ch===-1)&&(this.#r=o,this.#a(o),this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#n===void 0||this.#r===void 0)return!1;this.#a(this.#r);let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#s();return t||n}#a(e){let t=this.#e,n=this.#t,r=this.#n;if(t==null||n==null||r==null)throw Error(`Metrics not initialized`);t.append(n);try{r.font=e}finally{n.remove()}}measureTextWidth(e){if(!e.includes(` `))return this.#o(e);if(this.#n===void 0)throw Error(`Metrics not initialized`);let t=rG(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#o(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#o(e.slice(r))),on(n)}segmentTextWidth(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=rG(r,this.tabSize);return i===-1?this.measureTextWidth(r):i*this.ch}#o(e){return eG(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#n===void 0)throw Error(`Metrics not initialized`);return on(this.#n.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#r,n=this.#i.get(t);if(n!==void 0)return n;let r=O(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=on(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#i.size>=ZW){let e=this.#i.keys().next().value;e!==void 0&&this.#i.delete(e)}return this.#i.set(t,i),i}clearTextWidthCache(){this.#s()}#s(){let e=this.#i.size>0;return this.#i.clear(),e}};function eG(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&QW.test(e.charAt(t)))return!0}return!1}function tG(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!eG(e))return n;let r=un();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function nG(e){if(!eG(e))return;let t=[0],n=un();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function rG(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var iG=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;get themeType(){return this.#r}get highlighter(){return this.#e}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=x,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#l():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#l();this.#c(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#s=[dn(this.#n,`change`,()=>{let e=this.#l();this.#c(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#a=i,this.#o=o,this.#u(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d),this.#t=t.createEditorTokenizer({textDocument:n,theme:this.#i,tokenizeMaxLineLength:u,matchBrackets:r,__debug:s,onDeferTokenize:e=>a(e,this.#r)})}#c(e,t){(e!==this.#i||t!==this.#r)&&(this.#u(e,t),this.#t.setTheme(e),this.#o?.())}#l(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=x}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#c(n,e);return}let r=t===`system`?this.#l():t,i=n[r];(r!==this.#r||i!==this.#i)&&this.#c(i,r)}#u(e,t){let n=this.#e.getTheme(e),{colors:r={}}=n,i=r[`editor.selectionBackground`],a=r[`editor.lineHighlightBackground`],o=a!=null&&a.trim()!==``&&!hn.isFullyTransparent(a)?a:void 0,s=r[`editor.lineHighlightBorder`]??(o==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),c=o==null?`100%`:`85%`,l=r[`editorCursor.foreground`],u=r[`editor.findMatchBackground`],d=r[`editor.findMatchHighlightBackground`],f=r[`editorBracketMatch.background`],p=r[`editorBracketMatch.border`],m=r[`editorHint.foreground`],h=r[`editorInfo.foreground`],g=r[`editorWarning.foreground`],_=r[`editorError.foreground`];this.#a(`:host {
129
+ --diffs-editor-selection-bg: ${i??`var(--diffs-line-bg)`};
130
+ --diffs-editor-line-highlight-border: ${s};
131
+ --diffs-editor-active-line-source-mix: ${c};
132
+ --diffs-editor-match-bg: ${u??`initial`};
133
+ --diffs-editor-match-highlight-bg: ${d??`initial`};
134
+ --diffs-editor-bracket-match-bg: ${f??`initial`};
135
+ --diffs-editor-bracket-match-border: ${p??`initial`};
136
+ --diffs-editor-cursor-fg: ${l??`initial`};
137
+ --diffs-editor-hint-fg: ${m??`initial`};
138
+ --diffs-editor-info-fg: ${h??`initial`};
139
+ --diffs-editor-warning-fg: ${g??`initial`};
140
+ --diffs-editor-error-fg: ${_??`initial`};
141
+ }`),this.#i=e,this.#r=t??n.type}cleanUp(){this.#t.dispose(),this.#s?.forEach(e=>e()),this.#s=void 0}tokenize(e,t,n=!1){return this.#t.tokenize(e,t,n)}getStringCommentRegexpRangesInLine(e){return this.#t.getStringCommentRegexpRangesInLine(e)}prebuildStateStack(e){this.#t.prebuildStateStack(e)}stopBackgroundTokenize(){this.#t.stopBackgroundTokenize()}pauseBackgroundTokenize(){this.#t.pauseBackgroundTokenize()}resumeBackgroundTokenize(){this.#t.resumeBackgroundTokenize()}};function aG(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?O(`br`):n:O(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function oG(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function sG(e,t){let n=re(e),r=n[n.length-1]??0;return{start:0,end:e.length,text:t,range:{start:{line:0,character:0},end:{line:n.length-1,character:e.length-r}}}}function cG(e){return e!=null&&`renderType`in e&&e.renderType===`virtualized`}var lG=2,uG=1e4,dG=300,fG=256,pG=131072,mG=new TextEncoder,hG=`selection-action`,gG=`application/vnd.pierre.diffs-selections+json`,_G=class{type;#e;#t;#n;#r=new $W;#i;#a;#o;#s;#c;#l;#u={generation:0,callback:void 0,delivered:!1};#d;#f;#p;#m=new Map;#h=new Map;#g=new Map;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I=!1;#L=!1;#R;#z;#B;#V;#H;#U;#W;#G;#K;#q=!0;#J=!1;#Y=!1;#X=!1;#Z;#Q=!1;#$=!1;#ee=!1;#te;#ne=!1;#re;#ie=``;#ae;#oe;#se;#ce;#le;#ue;#de=!1;#fe=!1;#pe=!1;#me=!1;#he;#ge;#_e;#ve=0;#ye=!1;#be=!1;#xe;#Se=[];#Ce=new Map;#we=new Map;#Te=(e,t)=>{if(this.#I&&(this.#M?.updateRenderCache(e,t),this.#V!==void 0&&this.#V.totalLines!==1/0)){let t=this.#xe===void 0?void 0:new Set(this.#xe.response.edits.map(e=>e.range.start.line)),n=!1,{startingLine:r,totalLines:i}=this.#V,a=Math.min(r+i,(this.#n??this.#t)?.document?.lineCount??0);for(let[i,o]of e)if(i>=r&&i<a){let e=this.#gn(i);e!==void 0&&(e.replaceChildren(...aG(o)),n||=t?.has(i)===!0)}n&&this.#se!==void 0&&this.#Wt(this.#se)}};constructor(e,t={},n){this.type=e,this.#e=t,this.#B=t.ownsVerticalViewport===!0,this.#t=t.initialState,this.#z=n}get#Ee(){return this.type,this}setOptions(e){let t=this.#e.renderCaret,n=this.#e.editPrediction;this.#e={...this.#e,...e},t!==this.#e.renderCaret&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#Gt()),n!==this.#e.editPrediction&&(this.#Rt(!0),this.#Se=[],this.#Bt())}__emitEditComplete(e){this.#e.onComplete?.(e)}__getGhostTextRows(){return this.#we}setCarets(e){let t=this.#n?.document;t!==void 0&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,this.#W=e.length===0?void 0:e.map(e=>{let n=t.normalizePosition(e.anchor),r=t.normalizePosition(e.focus);return{caret:{...e,anchor:n,focus:r},anchorOffset:t.offsetAt(n),focusOffset:t.offsetAt(r)}}),this.#Gt())}edit(e){let t=this.#Ee,n=this.#n;if(this.#I)throw Error(`Editor.edit: the editor is already rendering its component`);if(this.#M!=null&&this.#M!==e)throw Error(`Editor.edit: a recycled edit session cannot attach to a different component`);if(e.type===`file-diff`&&this.#n==null&&!e.__canAttachEditor())throw Error(`Editor.edit: a complete diff is required before editing`);let r=this.#t,i=r?.editor,a=this.#z,o=vG({type:this.type,editStateKey:a,owner:this,initialState:r,previousSession:n}),s=o.diffSession;this.#t=void 0,this.#n=o,this.#M=e,this.#I=!0,this.#L=o.editor!=null;try{if(this.#Ge(),e.type===`file`&&t.type===`file`)t.#N=e.applyDocumentChange.bind(e),t.#P=e.applySuspendedDocumentChange.bind(e),t.#F=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else if(e.type===`file-diff`&&t.type===`file-diff`)t.#N=e.applyDocumentChange.bind(e),t.#P=e.applySuspendedDocumentChange.bind(e),t.#F=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else throw Error(`Editor.edit: Impossible edit state`)}catch(e){throw this.cleanUp(`recycle`),o.type===`file-diff`&&o.diffSession==null&&(o.diffSession=s),this.#l==null&&a!=null&&(t.type===`file`?XV.releaseFile(a,t):XV.releaseFileDiff(a,t)),this.#n=n,this.#l??(this.#M=void 0,this.#N=void 0,this.#P=void 0,this.#F=void 0),r!=null&&i!=null&&(r.editor=i),this.#t=r,e}return()=>{this.cleanUp(`complete`)}}applyEdits(e,t=!0){let n=this.#n?.document;if(n==null)throw Error(`Editor.applyEdits: Editor is not attached`);let r=this.#X,i=this.#se,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=ZH(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#dn(s,c,this.#pn(s),{skipFocus:!r})}get canUndo(){return(this.#n??this.#t)?.document?.canUndo??!1}get canRedo(){return(this.#n??this.#t)?.document?.canRedo??!1}undo(){this.#et(`undo`)}redo(){this.#et(`redo`)}getFile(){let e=this.#n??this.#t,t=e?.fileInfo,n=e?.document;if(t===void 0||n===void 0)return;let r={...t};return Object.defineProperty(r,"contents",{enumerable:!0,get:()=>n.getText()}),r}getText(){return(this.#n??this.#t)?.document?.getText()??``}getViewState(){let e=this.#I?this.#M:void 0;if(!this.#I&&this.#n?.editor!=null)return qV(this.#n.editor);let t=this.#se?.map(e=>({...e,start:{...e.start},end:{...e.end}}));if(e==null)return{selections:t};let n=this.#We(),r=e.getCodeScrollLeft();return n==null?{selections:t,view:{scrollLeft:r}}:{selections:t,view:{scrollLeft:r,scrollTop:n.scrollTop}}}getEditState(){let e=this.#n;if(e!=null){if(this.#M==null)throw Error(`Editor.getEditState: active ${this.type} session has no component`);return JV(e)}}setViewState({selections:e,view:t}){if(!this.#I||this.#M===void 0||this.#n?.document===void 0)throw Error(`Editor.setViewState: Editor is not attached`);if(this.#q=!1,this.#Wt(e??[]),t!=null){this.#M.setCodeScrollLeft(t.scrollLeft);let e=this.#We();t.scrollTop!==void 0&&e!=null&&(e.scrollTop=t.scrollTop)}else this.#B&&this.#gt();this.#De()}setSelections(e){let t=this.#n?.document;if(t===void 0)throw Error(`Editor.setSelections: Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return JH(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#q=!1,this.#Wt(n);let r=n.at(-1);r!==void 0&&this.#Pe(GH(r).line),this.#gt()}setMarkers(e){let t=this.#n?.document;if(t===void 0)throw Error(`Editor.setMarkers: Text document is not initialized`);e.length===0?(this.#U?.cleanup(),this.#U=void 0,this.#Wt(this.#se??[])):(this.#U??=new GU({popoverManager:this.#Re(),getLineHeight:()=>this.#r.lineHeight,getOverlayElement:()=>this.#E,getGutterWidth:()=>this.#_n(),getCharX:(e,t)=>this.#bn(e,t),getLineY:e=>this.#yn(e),isMouseDown:()=>this.#ee||this.#$}),this.#U.setMarkers(e,t),this.#w!==void 0&&this.#U.listenHover(this.#w),this.#Wt(this.#se??[]),this.#Gt())}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#n?.document;if(r==null||!this.#I||this.#M==null)return;let i=n===`first-visible`?this.#pt(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#mt(a,t);return}let r=this.#se?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#ut(e,t)}else this.#ut(void 0,t)}blur(){this.#Z=void 0,this.#X=!1,this.#J=!1,this.#w?.blur()}cleanUp(e=`discard`){let t=this.#M,n=e===`recycle`;this.#Rt(!0,!1),n||(this.#Se=[]);let r=this.#n;if(t!=null&&r!=null){let e=!this.#De();n||this.#Oe(e)}if(this.#Ve(),n||(this.#u.delivered=!1),this.#I=!1,E(this.#Ze),this.#i?.cleanUp(),this.#i=void 0,this.#s?.forEach(e=>e()),this.#s=void 0,this.#o?.forEach(e=>e()),this.#o=void 0,n||(this.#l?.(),this.#l=void 0),this.#f=void 0,this.#p=void 0,this.#m.clear(),this.#h.clear(),this.#g.clear(),this.#_=void 0,this.#v?.remove(),this.#v=void 0,this.#y?.remove(),this.#y=void 0,this.#b?.remove(),this.#b=void 0,this.#x?.remove(),this.#x=void 0,this.#S=void 0,this.#a?.cleanUp(),this.#a=void 0,this.#C=void 0,this.#T=void 0,this.#w?.removeAttribute(`contentEditable`),this.#w=void 0,this.#Z=void 0,this.#X=!1,this.#E?.remove(),this.#E=void 0,this.#j?.disconnect(),this.#j=void 0,this.#me=!1,this.#he!==void 0&&(cancelAnimationFrame(this.#he),this.#he=void 0),this.#Be(n),!n)try{if(t!=null&&r!=null){let n=this.#Ee,r=e===`complete`?`install`:`discard`;if(t.type===`file`&&n.type===`file`)t.__completeEditSession(n,r);else if(t.type===`file-diff`&&n.type===`file-diff`)t.__completeEditSession(n,r);else throw Error(`Editor.cleanUp: Impossible edit state`)}}finally{this.#n=void 0,this.#M=void 0,this.#N=void 0,this.#P=void 0,this.#F=void 0}}#De(){let e=this.#M,t=this.#n;if(e==null||t==null)return!1;let n=this.#I?this.getViewState():t.editor??{},{view:r}=n,i=r!=null&&(r.scrollLeft!==0||(r.scrollTop??0)!==0),a=n.selections!=null||i;if(t.editor=qV(n),t.type===`file`)return!1;let o=e.__captureDocumentSessionState();if(o==null)return t.diffSession=void 0,!1;t.diffSession=o.diffSession;let s=t.document;return o.hasChanges||a||s?.canUndo===!0||s?.canRedo===!0}#Oe(e=!1){let t=this.#z;if(t==null)return;let n=this.#Ee;n.type===`file`?XV.releaseFile(t,n):XV.releaseFileDiff(t,n,e)}__postponeBgTokenizeToNextFrame(){let e=this.#i;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{this.#i===e&&e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#w,t=this.#S?.shadowRoot?.activeElement;e!=null&&(this.#X||t===e||t!=null&&e.contains(t))&&(this.#Z={})}__getDocumentContents(e){let t=this.#n?.fileInfo,n=this.#n?.document;if(n==null)return t==null||e==null?void 0:{...t,contents:e.contents};let r=t??e;if(r!=null)return{name:r.name,lang:r.lang,contents:n.getText()}}__getDocumentSessionState(){let e=this.#n?.diffSession;return e==null?void 0:YU(e)}__syncRenderView(e){let{highlighter:t,fileContainer:n,renderRange:r,externalDocument:i=!1}=e,a=e,o;if(`file`in a&&this.type===`file`)o=a.file;else if(`fileDiff`in a&&this.type===`file-diff`)o=a.fileDiff;else throw Error(`Editor.__syncRenderView: Impossible render state`);let c=a.lineAnnotations,l=this.#z,u=this.#M,d=this.#n;if(!this.#I||u==null||d==null)return;let f=n.shadowRoot;if(f==null){console.error(`[editor] Could not find the shadow root.`);return}let p,m,h,g,_;for(let e of f.querySelectorAll(`[data-code]`)){let t=e.dataset.deletions!=null;t||(p=e);for(let n of e.children){if(!(n instanceof HTMLElement))continue;let{gutter:e,content:r}=n.dataset;e==null?r!=null&&(t?_=n:h=n):t?g=n:m=n}}if(_==null)this.#T=void 0;else if(g==null)throw Error(`Editor.__syncRenderView: the deletions column has no gutter`);else this.#T={content:_,gutter:g};if(p===void 0||h===void 0){this.#Z=void 0;return}this.#Re().setViewportElements(n,p),this.#S!==n&&(this.#S=n,this.#v!==void 0&&n.appendChild(this.#v),this.#y!==void 0&&f.appendChild(this.#y),this.#b!==void 0&&f.appendChild(this.#b),this.#x!==void 0&&f.prepend(this.#x));let v=o.lang??s(o.name),y=`contents`in o?o.contents:o.additionLines.join(``),b=d.document,x=e.resetHistory??(b!=null&&d.fileInfo!=null&&(d.fileInfo.name!==o.name||b.languageId!==v)),S=i&&b!==void 0&&b.getText()!==y?[sG(b.getText(),y)]:void 0,C=i&&x;if(d.document==null||d.fileInfo==null||l==null&&(d.fileInfo.name!==o.name||d.document.languageId!==v)||C){this.#Rt(!0),this.#Se=[],this.#Ve();let{name:e,lang:t}=o,n=C||l==null&&d.fileInfo!=null?void 0:d.document;if(b!=null&&n==null&&(d.editor=void 0),n==null){let e=new oV({maxEntries:this.#e.historyMaxEntries});n=new HV(o.name,y,v,0,e)}d.fileInfo={name:e,lang:t},d.document=n,C&&(d.diffSession=void 0),this.#i?.cleanUp(),this.#i=void 0,this.#Be(),this.#h.clear(),this.#se=this.#oe,this.#e.__debug===!0&&console.log(`[diffs/editor] text document initialized from`,o.name)}if(i&&!C){this.#ke(d,y,c);let{name:e,lang:t}=o;d.fileInfo={name:e,lang:t}}let w=d.document;if(this.#i!=null&&this.#i.highlighter!==t&&(this.#i.cleanUp(),this.#i=void 0),this.#i==null&&w!=null&&(this.#i=new iG({highlighter:t,textDocument:w,codeOptions:this.#M?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#Te,onThemeChange:()=>this.#Ot(),setStyle:e=>{this.#b.textContent=e},__debug:this.#e.__debug})),this.#w!==h&&(this.#C=m,this.#w=cn(h,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#E!==void 0&&h.after(this.#E),this.#r.init(h),this.#st(),this.#Xe(h,m),this.#w!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#Z!=null&&(this.#Z.target=h),h.ariaLabel!==o.name&&(h.ariaLabel=o.name),c!==void 0&&c.length>0||this.#Ie)for(let e of this.#w.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}this.#ze(),this.#i?.syncTheme(this.#M?.__getEffectiveCodeOptions()??{}),this.#R=c,this.#V=r,this.#H=r?.totalLines,this.#i?.prebuildStateStack(r);let T=d.editor,E=this.#L;try{if(this.#U?.removePopover(),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#Wt(this.#se??[]),this.#Gt(),this.#be&&this.#Bt(),this.#oe!==void 0&&this.#A!==void 0?(this.#oe=void 0,this.#gt(!1,`center`)):this.#le===void 0?this.#Z===void 0?this.#se!==void 0&&this.#se.length>0&&this.#X&&!this.#pe&&this.focus({preventScroll:!0}):this.#dt():this.#vt(this.#le,this.#ue,this.#fe),this.#pe&&this.#G?.focus(),E&&(this.#L=!1,T!==void 0&&this.setViewState(T)),this.#e.__debug===!0&&r!==void 0){let{startingLine:e,totalLines:t}=r;console.log(`[diffs/editor] render file:`,o.name,`RenderRange:`,e+`-`+(e+t),`of`,d.document?.lineCount,`lines`)}i&&u.__acknowledgeDocumentUpdate(),this.#De()}catch(e){throw this.#L=E,d.editor=T,e}S!=null&&this.#fn(S,c),this.#He(u)}#ke(e,t,n){let r=e.document;if(r==null||r.getText()===t)return;let i=this.#se,a=i?.map(e=>[r.offsetAt(e.start),r.offsetAt(e.end)]),o={start:0,end:r.getText().length,text:t};if(r.applyResolvedEdits([o],!0,i,void 0,!0)!=null){if(i!=null&&a!=null){let e=ZH(r,i,a,[o]);r.setLastUndoSelectionsAfter(e),this.#se=e}(this.#R!=null||n!=null)&&r.setLastUndoLineAnnotations(this.#R??[],n??[]),this.#i?.cleanUp(),this.#i=void 0,this.#ze(),this.#h.clear(),this.#U?.removePopover(),this.#G!==void 0&&this.#ce!==void 0&&this.#G.updateMatches({syncSelection:!1})}}get#Ae(){return this.#M?.type===`file-diff`?this.#M:void 0}get#je(){return cG(this.#M)?this.#M:void 0}#Me(e){return this.#Ae?.isLineRenderable?.(e+1)??!0}get#Ne(){let e=this.#Ae;if(e!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#Pe(e){this.#Me(e)||this.#Ae?.revealLine?.(e+1)}get#Fe(){return this.#Ae?.options.diffStyle??`split`}get#Ie(){return this.type===`file-diff`}get#Le(){return this.#M?.options.overflow===`wrap`}#Re(){return this.#a??=new aH({hasActivePopover:()=>this.#K!==void 0||this.#U?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#Zt(),this.#U?.updatePopoverPosition()}})}#ze(){this.#m.clear(),this.#g.clear(),this.#_=void 0}#Be(e=!1){this.#Dt(null),this.#f=void 0,this.#p=void 0,this.#Ke(),this.#Y=!1,this.#D?.forEach(e=>e.remove()),this.#D=void 0,this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,e||(this.#W=void 0),this.#se=void 0,this.#le=void 0,this.#U?.cleanup(),this.#U=void 0,this.#G?.cleanup(),this.#G=void 0,this.#K?.cleanup(),this.#K=void 0,this.#q=!0}#Ve(){let e=this.#u;e.generation++,e.callback!=null&&(E(e.callback),e.callback=void 0)}#He(e){let t=this.#u,n=this.#n?.document;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#M!==e||this.#n?.document!==n))return;let a=this.#w,o=this.#S?.shadowRoot;a!=null&&o!=null&&o.contains(a)&&(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,C(i)}#Ue(){let e=this.#je?.getEditorViewport?.();if(e!=null)return e;let t=this.#S;if(this.#M!=null&&t!=null)return fn(t)}#We(){if(!this.#B)return;let e=this.#je?.getEditorViewport?.();if(e instanceof HTMLElement)return e}#Ge(){this.#v=O(`style`,{dataset:`editorGlobalCss`,textContent:`
142
+ [data-annotation-slot] {
143
+ user-select: none;
144
+ -webkit-user-select: none;
145
+ }
146
+ `}),this.#y=O(`style`,{dataset:`editorCss`,textContent:XU}),this.#b=O(`style`,{dataset:`editorThemeCss`}),this.#x=qW(),this.#E=O(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#w?.contains(t)===!0},t=()=>{this.#Z!=null&&(this.#Z=void 0,this.#X=!1,this.#J=!1)},n=e=>{if(e.pointerType!==`mouse`)return;let t=this.#$;this.#Ke(),t&&this.#ut(),this.#e.enabledSelectionAction===!0&&this.#se!==void 0&&this.#se.length>0&&!WH(this.#se.at(-1))&&this.#Wt(this.#se)};this.#s=[dn(document,`focusin`,n=>{e(n)||t()},{passive:!0}),dn(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),dn(document,`selectionchange`,()=>{let e=this.#S?.shadowRoot;if(this.#J||this.#Y||e==null||!this.#X||this.#se!==void 0&&this.#se.length>1&&!this.#ee)return;let t=document.getSelection();if(t==null)return;let n;if(n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:oG(e),n===void 0||!this.#Cn(n))return;let r=CH(n,0);if(r!==void 0){if(this.#ee&&this.#ne&&this.#se!==void 0&&this.#se.length>0){let e=this.#se.at(-1);this.#Wt([$H(e,r)])}else{if(this.#re!==void 0)r.direction=QH(this.#re,r).direction;else if(this.#ee)this.#re=r;else if(this.#se!==void 0&&this.#se.length===1){let e=this.#se[0];JH(e.start,r.start)===0&&JH(e.end,r.end)===0&&(r.direction=e.direction)}this.#te!==void 0&&(this.#te.focusLine=GH(r).line,this.#kt())||(this.#ae===void 0?this.#Wt([r]):this.#Wt([...this.#ae.filter(e=>!qH(e,r)),r]))}}},{passive:!0}),dn(document,`pointerup`,n,{passive:!0}),dn(document,`pointercancel`,n,{passive:!0}),dn(document,`keydown`,e=>{e.key===`Shift`?this.#re=this.#se?.at(-1):e.key===`Alt`&&!e.repeat&&this.#X&&this.#e.editPrediction?.mode===`subtle`&&(this.#ye=!this.#ye,this.#Wt(this.#se??[]))},{passive:!0}),dn(document,`keyup`,e=>{e.key===`Shift`&&(this.#re=void 0)},{passive:!0})]}#Ke(){this.#c?.forEach(e=>e()),this.#c=void 0,this.#J=!1,this.#$=!1,this.#ee=!1,this.#te=void 0,this.#ne=!1,this.#re=void 0,this.#ae=void 0}#qe(e){this.#c?.forEach(e=>e()),this.#c=e}#Je(){return this.#M?.options.enableLineSelection===!0}#Ye(){this.#Y=this.#se!==void 0}#Xe(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#o?.forEach(e=>e()),this.#o=[dn(e,`focus`,()=>{this.#X=!0,n?.(),!this.#ee&&!this.#J&&this.#se!==void 0&&this.#se.length>0&&this.#ht(this.#se.at(-1))},{passive:!0}),dn(e,`blur`,()=>{this.#Z?.target===e&&(this.#Z=void 0,this.#J=!1),this.#X=!1,r?.()},{passive:!0}),dn(e,`pointerdown`,t=>{if(this.#q=!0,this.#Y=!1,t.pointerType!==`mouse`)return;if(this.#te=void 0,this.#bt(t)){this.#Et(!0),this.#se!==void 0&&this.#Wt([]);return}this.#Et(!1),this.#U?.removePopover();let n=[];if(_()&&this.#R!==void 0&&this.#R.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[dn(e,`mouseenter`,()=>{this.#J=!0}),dn(e,`mouseleave`,()=>{this.#J=!1})]).flat();n.push(...t)}this.#ee=!0;let r=t.button===0&&t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(this.#re=void 0,r?(this.#te={pointerId:t.pointerId,startClientX:t.clientX,clientX:t.clientX,startScrollLeft:e.parentElement?.scrollLeft??0},this.#ae=void 0,this.#se=void 0,this.#Wt([]),n.push(dn(document,`pointermove`,e=>{let t=this.#te;t!==void 0&&e.pointerType===`mouse`&&e.pointerId===t.pointerId&&(t.clientX=e.clientX,this.#kt())},{capture:!0,passive:!0}))):t.button===0&&ZV(t)&&(this.#ae=this.#se?.map(e=>({...e}))),this.#qe(n),t.shiftKey){let e=this.#se?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#ht({start:t,end:t,direction:0})}this.#ne=!0}},{passive:!0}),dn(e,`keydown`,e=>{if(!i(e)||(this.#q=!0,this.#Y=!1,e.isComposing||e.keyCode===229))return;if(e.key===`Tab`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing&&!this.#Q&&(!e.altKey||this.#e.editPrediction?.mode===`subtle`)&&this.#xe?.rendered===!0){this.#Ht(),e.preventDefault();return}if(e.key===`Escape`&&this.#xe!==void 0){this.#Rt(!0),e.preventDefault();return}let t=rH(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#G?.close(),this.#G=void 0,this.#pe=!1,this.#K?.cleanup(),this.#K=void 0),this.#et(t);return}let n=QV(e),r=this.#n?.document;if(this.#se!==void 0&&this.#se.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#Le?e=>this.#Sn(e):void 0,resolveRenderableLine:this.#Ne};e.shiftKey?this.#Wt(jH(r,this.#se,n,t)):this.#Wt(TH(r,this.#se,n,t)),this.#gt(),e.preventDefault()}else{if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&ZV(e)){if(e.repeat&&this.#Ie){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),C(this.#Ze);return}}if(this.#G!==void 0){let t=iH(e);if(t!==void 0){e.preventDefault(),this.#G.navigate(t===`previous`);return}}}}),dn(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#wt()?e.clipboardData?.setData(`text`,this.#Tt()):this.#nn(e.clipboardData,this.#en(),this.#tn()))}),dn(e,`cut`,e=>{if(i(e)){if(e.preventDefault(),this.#wt())e.clipboardData?.setData(`text`,this.#Tt());else{let t=this.#tn();this.#nn(e.clipboardData,this.#rn(),t)}}}),dn(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#n?.document;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#se?.length??0;if(a>1){let e=t.getData(gG);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#an(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),dn(e,`beforeinput`,e=>{i(e)&&(e.inputType===`insertCompositionText`?this.#Rt(!0):(e.preventDefault(),this.#lt(e.inputType,e.data)))}),dn(e,`drop`,e=>{i(e)&&e.preventDefault()}),dn(e,`compositionstart`,e=>{i(e)&&(this.#Rt(!0),this.#Q=!0,this.#J=!0)},{passive:!0}),dn(e,`compositionend`,e=>{if(!i(e))return;this.#J=!1;let t=this.#Q;this.#Q=!1,(e.data!==``||!t)&&this.#lt(`insertText`,e.data)},{passive:!0})];let a=this.#S?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#o.push(dn(a,`pointerdown`,e=>{let t=e.composedPath();if(te(t)){this.#Ye();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Je()){this.#Ye();return}if(this.#Ct(r,a,e.pointerType===`mouse`))return}this.#Et(!0),this.#se!==void 0&&this.#Wt([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=an(e)??an(e,`columnNumber`);if(n!==void 0&&t!==void 0&&KH(t))return n-1};this.#o.push(dn(t,`pointerdown`,t=>{let r=t.composedPath();if(te(r)){this.#Ye();return}let i=e(r[0]);if(i!==void 0&&this.#Je()){this.#Ye();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#Ct(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#n?.document,o=n(i);if(o===void 0||a===void 0)return;this.#q=!0,this.#U?.removePopover();let s=this.#yt(o,o,a);this.#$=!0,this.#re=s,this.#Wt([s]),this.#ht(s),this.#ut(),this.#qe([dn(document,`mousemove`,t=>{if(!this.#$)return;let r=this.#n?.document,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#re?.start.line??i,o=this.#yt(a,i,r);this.#re??=o,this.#Wt([o]),this.#ut(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#U?.listenHover(e),this.#j?.disconnect(),this.#j=new ResizeObserver(this.#ot),this.#j.observe(e),this.#j.observe(e.parentElement),this.#Qe(e)}#Ze=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#se?.length??0;if(n>1){let r=await e.readText(gG);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#n?.document;r!=null&&this.#an(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#Qe(e){this.#Ie&&this.#Fe===`split`&&this.#Le&&(this.#d={top:e.offsetTop-this.#r.paddingTop,left:e.offsetLeft-this.#_n()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#d))}get#$e(){if(this.#Ie&&this.#Fe===`split`&&this.#Le)return this.#d}#et(e){let t=this.#n?.document;if(t!=null)switch(e){case`openSearchPanel`:this.#Qt(`find`);break;case`openSearchReplacePanel`:this.#Qt(`replace`);break;case`findNextMatch`:{let e=this.#se;if(e===void 0)break;if(e.some(WH)){let n=e.map(e=>WH(e)?_U(t,e):e);this.#Wt(n),this.focus()}else{let n=iU(t,e);if(n!==void 0){this.#Wt(n);let e=n.at(-1);e!==void 0&&this.#Pe(GH(e).line),this.#gt()}}break}case`moveLineUp`:case`moveLineDown`:this.#at(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#rt(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#se,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#Wt([t]),this.#ut(GH(t));else if(!WH(t)){let e=GH(t);this.#Wt([{start:e,end:e,direction:0}]),this.#ut(e)}break}case`insertBlankLine`:this.#it();break;case`deleteHardLineForward`:this.#ln();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#se;if(n===void 0)break;let{lineComment:r,blockComment:i}=wW(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#nt(TW(t,n,r));break}let a=e===`toggleComment`,o=kW(t,n,i,a);o!==void 0&&this.#nt(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#se!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#se){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=wH(t,o,this.#r.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#r.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#se,r);o!==void 0&&this.#dn(o,r)}break;case`selectAll`:{let e=aU(t);this.#Wt([e]),this.focus();let n=this.#mn(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#Y=!0,this.#ht({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=oU(t,e===`moveCursorToDocEnd`,this.#Ie);this.#Wt([n]),this.#Pe(GH(n).line),this.#gt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#se;if(r!==void 0){let e=oU(t,n,this.#Ie);this.#Wt(eU(r,e)),this.#Pe(GH(e).line),this.#gt()}}break;case`undo`:case`redo`:this.#tt(e)}}#tt(e){let t=this.#n?.document;if(t==null||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#se,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?ZH(t,n,r,c):void 0),u=s??(this.#R==null?void 0:cH(a,this.#R));this.#dn(a,l,u)}#nt(e,t){let n=this.#n?.document,r=this.#se;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?ZH(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#dn(s,c,this.#pn(s))}#rt(e){let t=this.#n?.document,n=this.#se;if(t===void 0||n===void 0)return;let r=nU(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#nt(o,()=>s)}#it(){let e=this.#n?.document,t=this.#se;if(e===void 0||t===void 0)return;let n=t.map(e=>GH(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#nt(o,()=>s)}#at(e){let t=this.#n?.document,n=this.#se;if(t===void 0||n===void 0)return;let r=nU(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>rU(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#dn(d,u)}#ot=()=>{let e=this.#R?.length??0,t=this.#f,n=this.#p;this.#f=void 0,this.#p=void 0;let r=this.#_n()!==t,i=this.#vn()!==n;(r||i)&&(this.#g.clear(),this.#_=void 0,this.#r.clearTextWidthCache(),i&&(this.#h.clear(),(this.#Le||e>0)&&this.#m.clear()),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&(this.#Wt(this.#se??[]),this.#se!==void 0&&this.#X&&this.focus()),this.#U?.removePopover(),this.#Qe(this.#w),this.#Gt())};#st(){if(this.#me)return;let e=document.fonts;e!==void 0&&(this.#me=!0,e.ready.then(()=>{this.#w!==void 0&&this.#r.remeasureCharacterWidth()&&(this.#f=void 0,this.#p=void 0,this.#ze(),this.#h.clear(),(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#Wt(this.#se??[]),this.#Gt(),this.#U?.removePopover())}))}#ct(e,t,n=this.#V,r){let i=this.#i,a=this.#M,o=this.#N,s=this.#n?.document,c=this.#C,l=this.#w;if(i==null||a==null||o==null||s==null||l==null)return;i.stopBackgroundTokenize();let u=performance.now(),d=i.tokenize(e,n,!this.#Ie&&this.#je!=null),f=performance.now();if(d.size>0){let e=l.children,t=new Set;for(let e of d.keys())this.#Me(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=an(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=d.get(i);if(r.replaceChildren(...aG(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=an(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=d.get(e),r=String(e+1);O(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:aG(t)},l),c!==void 0&&O(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[O(`span`,{dataset:{lineNumberContent:``},textContent:r})]},c)}}}if(e.lineDelta<0)for(let t of[l.children,c?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=an(r)??an(r,`columnNumber`),a=r.dataset.lineType;if(i!==void 0&&a!==`change-deletion`){if(i-1<e.lineCount)break;r.remove()}}let p=e.lineDelta!==0;if(p){let e=l.children.length;for(let t of l.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}l.style.gridRow=`span `+e,c!==void 0&&(c.style.gridRow=`span `+e)}a.updateRenderCache(d,i.themeType,{shouldRefreshDiffsView:this.#Ie&&!p,lineCountChangeInFlight:p,changedDocumentLines:this.#Ie&&!p?bW(s,e):void 0,documentLineCount:s.lineCount}),p&&o(s,t,r),(p||this.#Ie&&this.#Fe===`unified`)&&this.#ze(),t!=null&&(this.#R=t,(!this.#Ie||!p)&&mH(t,l,c,a.getAnnotationSlotName)),this.#Gt(),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${on(performance.now()-f)}ms,`,`tokenize in: ${on(f-u)}ms (${d.size} dirty lines)`)}#lt(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#n?.document,r=this.#se,i=n!==void 0&&r!==void 0?LH(n,r,e,this.#e.autoSurround):void 0;this.#an(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#an(this.#n?.document?.eol??`
147
+ `);break;case`deleteContentBackward`:this.#on();break;case`deleteContentForward`:this.#on(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#sn();break;case`deleteWordBackward`:this.#cn();break;case`insertTranspose`:this.#un();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t)}}#ut(e,t=!0,n){this.#X=!0,e===void 0?n?.()===!1?this.#X=!1:this.#w?.focus({preventScroll:t}):(this.#J=!0,this.#ht({start:e,end:e,direction:0}),C(()=>{n?.()===!1||!this.#X?this.#J=!1:(this.#w?.focus({preventScroll:t}),C(()=>{this.#J=!1}))}))}#dt(e){let t=this.#Z;if(t==null)return;if(this.#pe){this.#Z=void 0,this.#X=!1,this.#J=!1;return}let n=this.#w;if(n==null||!this.#ft(n)){this.#Z=void 0,this.#X=!1;return}let r=()=>{if(this.#Z!==t)return!1;let e=this.#ft(n);return this.#Z=void 0,e};if(e!=null){this.#ut(e,!0,r);return}let i=this.#se?.at(-1);if(i==null){this.#ut(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#ut(a,!0,r)}#ft(e){let t=this.#S,n=t?.shadowRoot;if(t==null||n==null||this.#w!==e||!n.contains(e))return!1;let{activeElement:r}=n;if(r===e||r!=null&&e.contains(r))return!0;if(r!=null)return!1;let{ownerDocument:i}=t,{activeElement:a}=i;return a==null||a===i.body||a===i.documentElement||a===t}#pt(e=0){let t=this.#w,n=this.#S;if(this.#n?.document==null||t==null||n==null)return;let r=this.#Ue();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=an(t),r=t.dataset.lineType;if(n==null||r==null||!KH(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#mt(e,t){let n={start:e,end:e,direction:0};this.#q=!1,this.#Wt([n]),this.#Pe(e.line),t?this.#ut(e,!0):this.#gt()}#ht(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;JH(n,r)>0&&([n,r]=[r,n]);let a=this.#gn(n.line),o=this.#gn(r.line);if(a===void 0||o===void 0)return;let[s,c]=gU(a,n.character),[l,u]=gU(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,sn(s,c),l,sn(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#gt(e=!1,t=`nearest`){let n=this.#se?.at(-1);if(n===void 0)return;let r=this.#A;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#Z===void 0?this.#ut(e):this.#dt(e)}}else{let t=GH(n);this.#vt(t.line,t.character,e)}}#_t(){let e=this.#G===void 0?0:48,t=this.#_n()+this.#r.ch;return`${e}px ${this.#r.ch}px 0 ${t}px`}#vt(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=O(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#r.lineHeight+`px`,scrollMargin:this.#_t()}});if(this.#gn(e)!==void 0){let[i,a]=this.#bn(e,t),o=this.#yn(e)+a*this.#r.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#E?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#Z===void 0?this.#ut(n):this.#dt(n)}this.#le=void 0,this.#ue=void 0,this.#de=!1,this.#fe=!1}else{let i=this.#je?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#S?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#Me(e)?(this.#le=e,this.#ue=t,this.#fe=n):(this.#le=void 0,this.#ue=void 0,this.#fe=!1);else{let i=0;if(this.#le===e&&this.#w!==void 0)for(let t=this.#w.childElementCount-1;t>=0;t--){let n=this.#w.children[t],r=n.dataset.lineType,a=an(n);if(r!==void 0&&KH(r)&&a!==void 0){i=(e-(a-1))*this.#r.lineHeight;break}}let a=((this.#R??[]).filter(t=>t.lineNumber<e).length+e)*this.#r.lineHeight+i;r.style.top=a+`px`,this.#S?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#le===e&&(i===0||this.#de)||!this.#Me(e)?(this.#le=void 0,this.#ue=void 0,this.#de=!1,this.#fe=!1):(this.#le=e,this.#ue=t,this.#de=i!==0,this.#fe=n)}}r.remove()}#yt(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#bt(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#xt(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#Et(!0),this.#Wt([]),this.#Dt(an(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#ie=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
148
+ `)}#St(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#Ct(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#St(e,r);return i!==void 0&&(this.#xt(i,i,t),n&&this.#qe([dn(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#St(a,r);e!==void 0&&this.#xt(i,e,t)}},{passive:!0})]),!0)}#wt(){return this.#S?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#Tt(){return this.#ie===``?window.getSelection()?.toString()??``:this.#ie}#Et(e){let t=this.#S?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#Dt(null),this.#ie=``):(t.removeAttribute(`data-deleted-text-selection`),this.#ie=``))}#Dt(e,t=!1,n=`additions`){try{this.#M?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#Ot(){this.#he===void 0&&(this.#he=requestAnimationFrame(()=>{this.#he=void 0,(this.#se!==void 0||this.#ce!==void 0||this.#U!==void 0)&&this.#Wt(this.#se??[])}))}#kt(){let e=this.#te,t=this.#re,n=this.#n?.document;if(e===void 0||e.focusLine===void 0||t===void 0||n===void 0)return!1;let r=t.direction===-1?t.end:t.start,i=this.#w?.parentElement?.scrollLeft??0,a=(e.clientX-e.startClientX+i-e.startScrollLeft)/this.#r.ch,o=a<0?-Math.round(-a):Math.round(a),s=Math.max(0,r.character+o),c={line:e.focusLine,character:s};if(e.renderedGoal!==void 0&&JH(e.renderedGoal,c)===0)return!0;e.renderedGoal=c;let l=[],u=c.line<r.line?-1:1;for(let e=r.line;;e+=u){if(this.#Me(e)){let t=n.getLineText(e),i=Math.min(r.character,t.length),a=Math.min(s,t.length),o=DH(t,i),c=a===i?o:DH(t,a);l.push({start:{line:e,character:Math.min(o,c)},end:{line:e,character:Math.max(o,c)},direction:o===c?0:o<c?1:-1})}if(e===c.line)break}return this.#Wt(l),!0}#At(){for(let[e,t]of this.#D??[])e.startsWith(`editPrediction`)&&(t.remove(),this.#D?.delete(e))}#jt(e,t,n){let r=t[n],i=n,a=r.range.end.line;for(;i+1<t.length&&t[i+1].range.start.line<=a;)i++,a=Math.max(a,t[i].range.end.line);if(i===n&&(r.newText.length===0||JH(r.range.start,r.range.end)===0))return{edit:r,endIndex:i};let o=r.range.start,s={line:a,character:e.getLineLength(a)},c=[],l=e.offsetAt(o);for(let r=n;r<=i;r++){let n=t[r],i=e.offsetAt(n.range.start),a=e.offsetAt(n.range.end);c.push(e.getTextSlice(l,i),n.newText),l=a}return c.push(e.getTextSlice(l,e.offsetAt(s))),{edit:{range:{start:o,end:s},newText:c.join(``)},endIndex:i}}#Mt(){let e=this.#xe,t=this.#n?.document;if(e==null||t==null||e.document!==t||e.version!==t.version||this.#e.editPrediction?.mode===`subtle`&&!this.#ye)return;let{edits:n}=e.response,r=[],i=n.length>0;for(let e=0;e<n.length;){let{edit:a,endIndex:o}=this.#jt(t,n,e);for(let e=a.range.start.line;i&&e<=a.range.end.line;e++)i=this.#wn(e);r.push({edit:a,startIndex:e,endIndex:o}),e=o+1}return{groups:r,allVisible:i}}#Nt(e,t,n,r,i){this.#Le?(e.dataset.wrap=``,e.style.width=`calc(100cqw - ${r}px)`):(delete e.dataset.wrap,e.style.width=`max-content`);let a=t.split(/\r\n|\r|\n/);for(let t=0;t<a.length;t++){let o=a[t],s=t===a.length-1?i:void 0,c=o.length===0&&s===void 0,l=O(`span`,{dataset:c?[`editPredictionLine`,`empty`]:`editPredictionLine`,textContent:c?`​`:o},e);s!==void 0&&O(`span`,{dataset:`editPredictionSuffix`},l).append(s),t===0&&n!==r&&(l.style.textIndent=`${n-r}px`)}}#Pt(e){let t=this.#xe,n=this.#n?.document;if(t==null||n==null)return;let{edit:r,startIndex:i,endIndex:a}=e,{start:o,end:s}=r.range;if(!(JH(o,s)===0&&o.character<n.getLineLength(o.line))||t.response.edits[i-1]?.range.end.line===o.line||t.response.edits[a+1]?.range.start.line===o.line)return;let c=this.#gn(o.line);if(c===void 0)return document.createTextNode(n.getLineText(o.line).slice(o.character));let[l,u]=gU(c,o.character),d=document.createRange();d.selectNodeContents(c),d.setStart(l,sn(l,u));let f=d.cloneContents();return f.firstChild?.textContent===``&&f.firstChild.remove(),f}#Ft(e){let{edit:t}=e,{start:n}=t.range,[r,i]=this.#bn(n.line,n.character),a=1,o=t.newText.split(/\r\n|\r|\n/).length,s=this.#E;if(this.#Le&&s!=null){a=Math.max(1,this.#Sn(n.line).length-1);let i=O(`span`,{dataset:`editPrediction`,style:{visibility:`hidden`}},s);this.#Nt(i,t.newText,r,this.#bn(n.line,0)[0],this.#Pt(e));let{width:c,height:l}=i.getBoundingClientRect();i.remove();let{lineHeight:u}=this.#r;c>0&&l>0&&u>0&&(o=Math.round(l/u))}return Math.max(0,o-(a-i))}#It(e=!0){let t=new Map,n=new Map,r=this.#we,i=!1,a=this.#w,o=this.#Mt();if(a!=null&&o!=null&&o.allVisible){for(let e of o.groups){let{edit:t}=e;if(t.newText.length===0)continue;let r=this.#Ft(e);r>(n.get(t.range.start.line)??0)&&n.set(t.range.start.line,r)}if(n.size>0){let e,o=this.#V?.startingLine??0;for(let[s,c]of n){i||=r.get(s)!==c;let n=this.#gn(s);if(n===void 0)continue;let l=s-o;if(a.children[l]!==n){if(e===void 0){e=new Map;for(let t=0;t<a.children.length;t++)e.set(a.children[t],t)}l=e.get(n)??-1}if(l<0)continue;t.set(n,c);let u=this.#C?.children[l];u instanceof HTMLElement&&t.set(u,c);let d=this.#Lt(l);d!=null&&(t.set(d.content,(t.get(d.content)??0)+c),t.set(d.gutter,(t.get(d.gutter)??0)+c))}}}let s=!1;for(let[e,n]of this.#Ce)t.get(e)!==n&&(delete e.dataset.editPredictionSpacer,e.style.removeProperty(`--diffs-edit-prediction-spacer-height`),s=!0);for(let[e,n]of t)this.#Ce.get(e)!==n&&(e.dataset.editPredictionSpacer=``,e.style.setProperty(`--diffs-edit-prediction-spacer-height`,`${n}lh`),s=!0);this.#Ce=t,(i||n.size!==r.size)&&(this.#we=n,e&&this.#je?.syncGhostTextRows()),s&&this.#ze()}#Lt(e){let t=this.#T,n=this.#w;if(t==null||n==null||!this.#Ie||this.#Fe!==`split`||this.#Le)return;let r=0;for(let t=0;t<e;t++)r+=yG(n.children[t]);let{content:i,gutter:a}=t,o=0;for(let e=0;e<i.children.length;e++){let t=i.children[e];if(o+=yG(t),o>r){let n=a.children[e];if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))throw Error(`Editor: deletions column rows and gutter cells are out of step`);return{content:t,gutter:n}}}}#Rt(e,t=!0){this.#ge!==void 0&&(clearTimeout(this.#ge),this.#ge=void 0),this.#_e?.abort(),this.#_e=void 0,this.#ve++,this.#ye=!1,this.#be=!1,this.#xe=void 0,this.#It(t),e&&this.#At()}#zt(e){let t=this.#e.editPrediction;if(t===void 0)return!1;let n=e.replaceAll(`\\`,`/`);return(t.include===void 0||t.include.some(e=>yW(n,e)))&&t.exclude?.some(e=>yW(n,e))!==!0}#Bt(){this.#Rt(!0);let e=this.#se?.[0];if(this.#e.editPrediction===void 0||this.#n?.document===void 0||this.#n?.fileInfo===void 0||this.#se?.length!==1||e===void 0||!WH(e))return;let t=this.#n?.document,n=t.offsetAt(GH(e));this.#ge=setTimeout(()=>{this.#ge=void 0;let e=this.#e.editPrediction,r=this.#se?.[0],i=this.#n?.fileInfo?.name;if(e===void 0||i===void 0||this.#n?.document!==t||this.#se?.length!==1||r===void 0||!WH(r)||t.offsetAt(GH(r))!==n||!this.#zt(i))return;let a=e=>this.#hn(e)&&this.#Me(e);if(!a(GH(r).line)){this.#be=!0;return}let o=vW(i,t,n,this.#Se,a);if(o===void 0)return;let s=t.offsetAt({line:o.excerptStartLine,character:0}),c=s+o.editableRange.start,l=s+o.editableRange.end,u=new AbortController,d=++this.#ve;this.#_e=u;let f;try{f=e.provider.predict(o,{signal:u.signal})}catch{this.#_e=void 0;return}Promise.resolve(f).then(e=>{let r=this.#se?.[0];if(u.signal.aborted||d!==this.#ve||this.#_e!==u||this.#n?.document!==t||t.version!==o.version||this.#se?.length!==1||r===void 0||!WH(r)||t.offsetAt(GH(r))!==n||e==null||!Array.isArray(e.edits)||e.edits.length===0||e.edits.length>fG||e.newCursor==null)return;let i=[],a=0;for(let n of e.edits){if(n==null||typeof n.newText!=`string`||!bG(t,n.range?.start)||!bG(t,n.range?.end)||JH(n.range.start,n.range.end)>0||(a+=mG.encode(n.newText).byteLength,a>pG))return;let e=t.offsetAt(n.range.start),r=t.offsetAt(n.range.end),o=t.resolveEdits([n])[0];if(o.start!==e||o.end!==r)return;i.push(o)}i.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<i.length;e++){let t=i[e];if(t.start<c||t.end>l||e>0&&i[e-1].end>t.start)return}let s=i.filter(e=>e.text!==t.getTextSlice(e.start,e.end));if(s.length===0)return;let f=t.positionAt(s[0].start),p=t.positionAt(s.at(-1).end),m=t.offsetAt({line:f.line,character:0}),h=t.offsetAt({line:p.line,character:t.getLineLength(p.line)}),g=[],_=m;for(let e of s)g.push(t.getTextSlice(_,e.start),e.text),_=e.end;g.push(t.getTextSlice(_,h));let v=g.join(``).split(/\r\n|\r|\n/),y=f.line+v.length-1,b=v.length-(p.line-f.line+1),x=e.newCursor;if(!(!Number.isInteger(x.line)||!Number.isInteger(x.character)||x.line<0||x.character<0)){if(x.line>=f.line&&x.line<=y){let e=v[x.line-f.line];if(x.character>e.length||xG(e,x.character))return}else{let e=x.line<f.line?x.line:x.line-b;if(e<0||e>=t.lineCount||x.character>t.getLineLength(e))return;let n=t.offsetAt({line:e,character:x.character});if(xG(t.charAt(n-1)+t.charAt(n),1))return}this.#xe={document:t,version:o.version,cursorOffset:n,rendered:!1,response:{edits:s.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),newCursor:{...x}}},this.#Wt(this.#se)}}).catch(()=>{}).finally(()=>{this.#_e===u&&(this.#_e=void 0)})},dG)}#Vt(e,t){let n=this.#n?.document,r=this.#n?.fileInfo?.name,i=BV(e);n!==void 0&&r!==void 0&&i!==void 0&&this.#zt(r)&&(this.#Se=gW(this.#Se,r,n,i,t))}#Ht(){let e=this.#xe,t=this.#n?.document,n=this.#se?.[0];if(e===void 0||!e.rendered||t===void 0||e.document!==t||e.version!==t.version||this.#se?.length!==1||n===void 0||!WH(n)||t.offsetAt(GH(n))!==e.cursorOffset)return;let{edits:r,newCursor:i}=e.response;this.#Rt(!0);let a=t.applyEdits(r.map(e=>({range:{start:{...e.range.start},end:{...e.range.end}},newText:e.newText})),!0,this.#se,void 0,!0);if(a===void 0){this.#Bt();return}let o=t.normalizePosition(i),s=[{start:o,end:o,direction:0}];t.setLastUndoSelectionsAfter(s),this.#dn(a,s,this.#pn(a),{editSource:`prediction`})}#Ut(e){let t=this.#xe,n=this.#n?.document;t!==void 0&&(t.rendered=!1);let r=this.#Mt();if(t!=null&&n!=null&&r!=null&&r.allVisible){for(let t of r.groups){let{edit:r,endIndex:i}=t,{start:a,end:o}=r.range,s=r.newText.length===0,c=JH(a,o)!==0,l=n.getLineLength(a.line),u=!c&&a.character<l;if(c?this.#Kt(e,s?`editPredictionDeletion`:`editPredictionReplacement`,{start:a,end:o}):u&&this.#Kt(e,`editPredictionInsertion`,{start:a,end:{line:a.line,character:l}}),s)continue;let[d,f]=this.#bn(a.line,a.character),p=this.#bn(a.line,0)[0],m=this.#yn(a.line)+f*this.#r.lineHeight,h=`editPrediction-${i}`,g=this.#D?.get(h);if(g===void 0?g=O(`span`,{ariaHidden:`true`,contentEditable:`false`,dataset:`editPrediction`},e.fragment):(this.#D?.delete(h),g.replaceChildren()),c){g.dataset.replacement=``;let e=this.#gn(a.line);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else delete g.dataset.replacement,g.style.removeProperty(`--diffs-edit-prediction-bg`);this.#Nt(g,r.newText,d,p,this.#Pt(t)),g.style.transform=`translateX(${p}px) translateY(${m}px)`,e.elements.set(h,g)}t.rendered=!0}}#Wt(e){this.__postponeBgTokenizeToNextFrame();let t=this.#se,n=t?.length!==e.length;if(!n&&t!==void 0)for(let r=0;r<e.length;r++){let i=t[r],a=e[r];if(i.direction!==a.direction||JH(i.start,a.start)!==0||JH(i.end,a.end)!==0){n=!0;break}}if(n&&this.#Rt(!0),this.#It(),this.#A=void 0,this.#Dt(null),e.length===0&&this.#ce===void 0&&this.#U===void 0){this.#se=void 0,this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#K?.cleanup(),this.#K=void 0,n&&this.#Bt();return}let r=document.createDocumentFragment(),i={fragment:r,elements:new Map};if(e.length>0){let t=tU(e),n=t.at(-1);this.#se=t;let r=t.some(e=>!WH(e)),a=GH(n).line+1;this.#Dt(a,r);for(let e of t)WH(e)||this.#Kt(i,`selection`,e),this.#Xt(i,e,e===n);let o=this.#e.matchBrackets!==!1&&this.#n?.document!=null&&this.#i!==void 0&&WH(n)?PW(this.#n?.document,this.#i,n.start):void 0;if(o!==void 0)for(let e of o)this.#Kt(i,`bracketMatch`,e)}let a=this.#n?.document;if(this.#ce!==void 0&&a!==void 0){let e=this.#ce,t=this.#V,n=t!=null&&Number.isFinite(t.totalLines)||this.#Ie&&this.#Ae?.options.expandUnchanged!==!0?this.#mn():void 0,r=this.#se?.at(-1),o=r===void 0?-1:a.offsetAt(r.start),s=r===void 0?-1:a.offsetAt(r.end),c=0,l=n?.length??1;for(let t=0;t<l;t++){let r=1/0,l=n?.[t];if(l!==void 0){let[t,n]=l,i=a.offsetAt({line:t,character:0}),o=n+1;r=o<a.lineCount?a.offsetAt({line:o,character:0}):a.offsetAt({line:o-1,character:a.getLineLength(o-1)});let s=c,u=e.length;for(;s<u;){let t=s+Math.floor((u-s)/2);e[t][1]<=i?s=t+1:u=t}c=s}for(;c<e.length;c++){let[t,n]=e[c];if(t>=r)break;let l={start:a.positionAt(t),end:a.positionAt(n)},u=o===t&&s===n;this.#Kt(i,`match`,l,u?`focus`:void 0)}}}if(this.#U!==void 0&&a!==void 0)for(let e of this.#U.markers)this.#Kt(i,`marker`,e,JU(e.severity));this.#Ut(i),this.#E?.appendChild(r),this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#D=i.elements,this.#Zt(),n&&this.#Bt()}#Gt(){let e=this.#W,t=this.#e.renderCaret,n=this.#E;if(this.#k?.forEach(e=>e.remove()),this.#k=void 0,e===void 0||t===void 0||n===void 0){this.#O?.forEach(e=>e.remove()),this.#O=void 0;return}let r=this.#O??=new Map;for(let[e,t]of r)this.#wn(e.caret.focus.line)||(t.remove(),r.delete(e));let i=document.createDocumentFragment(),a=[];for(let n of e){let{caret:e}=n,{line:o,character:s}=e.focus;if(n.anchorOffset!==n.focusOffset){let t={fragment:i,elements:new Map};this.#Kt(t,`caretHighlight`,n.anchorOffset<n.focusOffset?{start:e.anchor,end:e.focus}:{start:e.focus,end:e.anchor},void 0,e.focus);for(let n of t.elements.values())n.style.setProperty(`--diffs-caret-highlight-bg`,`color-mix(in srgb, ${e.metadata.color} 32%, transparent)`),a.push(n)}if(!this.#wn(o))continue;let c=r.get(n);c===void 0&&(c=O(`div`,{dataset:`remoteCaret`,children:[t(e)]},i),r.set(n,c));let[l,u]=this.#bn(o,s),d=this.#yn(o)+u*this.#r.lineHeight;c.style.transform=`translateX(${l}px) translateY(${d}px)`}this.#k=a,n.appendChild(i)}#Kt(e,t,n,r,i){if(this.#n?.document==null)return;let{start:a,end:o}=n,s=a.line,c=o.line+1;if(this.#V!==void 0){let{startingLine:e,totalLines:t}=this.#V;s=Math.max(s,e),c=Math.min(c,e+t)}for(let n=s;n<c;n++){if(!this.#wn(n))continue;let s=n===o.line,c=n===a.line?a.character:0,l=s?o.character:this.#n?.document.getLineLength(n);if(c===l&&(t===`editPredictionDeletion`||t===`editPredictionReplacement`)){if(s&&n!==a.line)continue;let[i,o]=this.#bn(n,c);this.#Yt(e,t,n,o,i,this.#r.ch,r);continue}if(this.#Le){let a=this.#vn(),o=this.#n?.document.getLineText(n);if(2*this.#r.ch+this.#r.measureTextWidth(o)>a){this.#qt(e,n,o,c,l,s,t,r,i);continue}}let u=0,d=0,f=0;u=c===0?this.#_n()+this.#r.ch+(this.#$e?.left??0):this.#bn(n,c)[0],!s&&t===`selection`&&(f=this.#r.ch),d=c===l?f:this.#bn(n,l)[0]-u+f,this.#Yt(e,t,n,0,u,d,r,{start:i?.line===a.line&&i.character===a.character&&n===a.line,end:i?.line===o.line&&i.character===o.character&&n===o.line})}}#qt(e,t,n,r,i,a,o,s,c){let l=this.#Sn(t),u=l.length-1,d=this.#_n()+this.#r.ch+(this.#$e?.left??0);for(let f=0;f<u;f++){let p=l[f],m=l[f+1],h=Math.max(r,p),g=Math.min(i,m);if(h>g)continue;let _=this.#Jt(n,p,h),v=d+_,y=0;!a&&f===u-1&&o===`selection`&&(y=this.#r.ch);let b=h===g?y:this.#Jt(n,p,g)-_+y;this.#Yt(e,o,t,f,v,b,s,{start:c?.line===t&&c.character===r&&h===r,end:c?.line===t&&c.character===i&&g===i})}}#Jt(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=rG(r,this.#r.tabSize);return i===-1?this.#r.measureTextWidth(r):i*this.#r.ch}#Yt(e,t,n,r,i,a,o,s){if(a===0)return;let{ch:c,lineHeight:l}=this.#r,u=this.#yn(n)+r*l,d=`${t}-${n}/${r}-${i}-${a} ${o??``}`,f=this.#D,p=(this.#e.roundedSelection??!0)&&(t===`selection`||t===`caretHighlight`),m=(n,r,i,a)=>{let o=this.#yn(n)+r*l,s=this.#gn(n),u=`initial`;s!==void 0&&(s.dataset.lineType===`change-addition`||s.dataset.selectedLine!==void 0)&&(u=getComputedStyle(s).getPropertyValue(`--diffs-line-bg`));let d=`width:${c}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(f?.has(h)===!0?(g=f.get(h),g.style.cssText=d,f.delete(h)):g=O(`div`,{dataset:t===`caretHighlight`?`caretHighlightRange`:`selectionRange`,style:{cssText:d},children:[O(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},h=t=>{let o=i+a,l=t.dataset,u=e.previousSelectionRange;if((u===void 0||u.line!==n||u.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),u===void 0||o<=u.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{l[e]=``});else{let e=u.line,t=u.wrapLine,a=u.left,s=u.element.dataset,d=a+u.width;a>i&&m(e,t,a-c,`rbr`),delete s.rbl,delete l.rtl,delete l.rtr,o>=d&&delete s.rbr,o>d&&(m(e,t,d,`rbl`),l.rtr=``),o<d&&m(n,r,o,`rtl`),i<a&&(l.rtl=``),l.rbl=``,l.rbr=``}s?.start===!0&&(delete l.rtl,delete l.rbl),s?.end===!0&&(delete l.rtr,delete l.rbr)},g=e.elements.get(d);if(g!==void 0)p&&h(g);else{if(f?.has(d)===!0?(g=f.get(d),f.delete(d)):g=O(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),g.style.width=`${a}px`,g.style.transform=`translateX(${i}px) translateY(${u}px)`,t===`editPredictionInsertion`||t===`editPredictionReplacement`){let e=this.#gn(n);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else g.style.removeProperty(`--diffs-edit-prediction-bg`);p&&h(g),e.elements.set(d,g)}}#Xt(e,t,n){let{line:r,character:i}=GH(t);if(!this.#wn(r))return;let[a,o]=this.#bn(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=a-1,l=this.#yn(r)+o*this.#r.lineHeight,u=O(`div`,{dataset:`caret`,style:{transform:`translateX(${c}px) translateY(${l}px)`}},e.fragment);e.elements.set(s,u),n&&(u.style.scrollMargin=this.#_t(),this.#A=u)}#Zt(){let e=this.#se?.at(-1),t=this.#E,n=this.#n?.document,r=this.#e.renderSelectionAction,i=()=>{this.#K?.cleanup(),this.#K=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||WH(e)||this.#ee||t===void 0||n===void 0){i();return}let a=GH(e);if(!this.#wn(a.line)){i();return}if(this.#K===void 0){if(!this.#q)return;let a=()=>this.#se?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#n?.document?.getText(a())??``,replaceSelectionText:e=>{this.#an(e,[a()])},close:()=>{i(),this.#gt()}});this.#K=new XW(o,t,()=>this.#Zt()),this.#Re().resetPlacement(hG)}let o=this.#r.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#K.height,d=e=>{let[t,n]=this.#bn(e.anchor.line,e.anchor.character),r=this.#yn(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#wn(l.anchor.line)?d(l):void 0,g=this.#Re(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:hG})===`fallback`;h===void 0&&g.setPlacement(`preferred`,hG);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#K.reposition(b,x,this.#_n(),y,w,_)}#Qt(e){this.#G===void 0?this.#$t(e):this.#G.setMode(e)}#$t(e){this.#G?.cleanup();let t=this.#n?.document,n=this.#S?.shadowRoot?.querySelector(`pre`),r=this.#se;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(WH(e)){e=_U(t,e),this.#Wt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
149
+ `)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=YH(t,e,n);this.#Wt([i]),this.#Pe(GH(i).line),this.#gt(!0),this.#pe=r},s=new YW({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#se);n!==void 0&&this.#dn(n,void 0,this.#pn(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#ce=void 0,this.#Wt(this.#se??[]);return}if(this.#ce=e,n?.syncSelection===!1){this.#Wt(this.#se??[]);let n=this.#se?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#se?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#Wt(this.#se??[]):o(a,!0),a},onClose:()=>{this.#G=void 0,this.#pe=!1,this.#ce=void 0,this.#Wt(this.#se??[])}});this.#G=s,this.#pe=!1}#en(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?``:uU(e,t)}#tn(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?[]:lU(e,t)}#nn(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(gG,JSON.stringify(n)))}#rn(){let e=this.#n?.document,t=this.#se;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>WH(e))){let n=hU(e,t);return this.#in(n.edits,n.nextSelectionOffsets),n.text}let n=uU(e,t);return this.#an(``,void 0,!0),n}#in(e,t){let n=this.#n?.document,r=this.#se;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#dn(i,a,this.#pn(i))}#an(e,t=this.#se,n=!1,r=`selection`){if(t===void 0)return;let i=this.#n?.document,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?FH(i,t,e,this.#R,n,r):MH(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#R,void 0,n);s!==void 0&&this.#dn(s,o,this.#pn(s))}#on(e=!1){let t=this.#se,n=this.#n?.document;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=UH(n,t,e,this.#R,this.#r.tabSize);i!==void 0&&this.#dn(i,r,this.#pn(i))}#sn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=BH(t,e,this.#Le?(e,t)=>{let n=this.#Sn(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#cn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=VH(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#ln(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=zH(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#un(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=RH(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#dn(e,t,n,r){this.#xe!=null&&this.#Rt(!0);let i=this.#n?.document;if(i!==void 0&&this.#W!==void 0)for(let t of this.#W)t.anchorOffset=XH(t.anchorOffset,e.changes),t.focusOffset=XH(t.focusOffset,e.changes),t.caret.anchor=i.positionAt(t.anchorOffset),t.caret.focus=i.positionAt(t.focusOffset);if(e.lineDelta!==0||this.#Le)for(let t of this.#m.keys())t>=e.startLine&&this.#m.delete(t);if(this.#h.size>0){if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#h.delete(e);else for(let t of this.#h.keys())t>=e.startLine&&this.#h.delete(t)}this.#_=void 0;let a=this.#V,o;if(a!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=a.startingLine+a.totalLines;if(n.end.line>=r){let t=n.end.line-a.startingLine+1,i=this.#H===void 0||this.#H===1/0?1/0:this.#H*lG;e.startLine<=r&&t<=i&&this.#Me(n.end.line)?(n.end.line>r&&(o=!0),a={...a,totalLines:t},this.#V=a):o=!0}}if(this.#I&&this.#i!=null&&this.#w!=null?this.#ct(e,n,a,o):i!=null&&(this.#P?.(i,n),n!=null&&(this.#R=n)),t!=null&&this.#Wt(t),this.#M?.__acknowledgeDocumentUpdate(),this.#De(),this.#Vt(e,r?.editSource??`user`),this.#Bt(),this.#fn(e.changes,n??this.#R),r?.skipSearchRefresh!==!0&&this.#G!==void 0&&this.#ce!==void 0&&this.#G.updateMatches({syncSelection:!1}),t!=null&&r?.skipFocus!==!0){let e=t.at(-1);if(e!==void 0&&this.#Pe(GH(e).line),this.#A!==void 0)requestAnimationFrame(()=>{this.#A?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=GH(t.at(-1));this.#vt(e.line,e.character)}this.focus({preventScroll:!0})}}#fn(e,t){let n=this.getFile(),r=this.#F;n!=null&&r!=null&&r(e,n,t)}#pn(e){if(this.#R!=null){let t=cH(e,this.#R);if(t!=null)return this.#n?.document?.setLastUndoLineAnnotations(this.#R,t),t}}#mn(){let e=this.#w;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=an(e);if(i===void 0||r===void 0||!KH(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#hn(e){let t=this.#V;return t==null||e>=t.startingLine&&e<t.startingLine+t.totalLines}#gn(e){let t=this.#g.get(e);if(t!==void 0)return t??void 0;let n=this.#V;if(!this.#hn(e))return;let r=this.#w;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=an(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&KH(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Fe===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#g.set(e,t),t??void 0}}#_n(){if(this.#C===void 0)return 0;if(this.#f===void 0){let e=this.#w?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#f=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#C.offsetWidth}return this.#f}#vn(){if(this.#w===void 0)return 0;if(this.#p===void 0){let e=this.#w.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#p=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#w.offsetWidth}return this.#p}#yn(e){let t=this.#m.get(e);if(t!==void 0)return t;let n=this.#gn(e);if(n===void 0)return-1;let r=n.offsetTop+this.#r.paddingTop;return r+=this.#$e?.top??0,this.#m.set(e,r),r}#bn(e,t){if(this.#_!==void 0&&this.#_[0]===e&&this.#_[1]===t)return[this.#_[2],this.#_[3]];let n=this.#n?.document?.getLineText(e),r=this.#_n()+this.#r.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#$e?.left??0),0];let i=tG(n,Math.min(t,n.length)),a=n.slice(0,i),o=rG(a,this.#r.tabSize),s=0,c=0;if(s=o===-1?r+this.#r.measureTextWidth(a):r+o*this.#r.ch,this.#Le){let t=this.#vn();if(2*this.#r.ch+this.#r.measureTextWidth(n)>t){let t=this.#xn(e);if(t==null)return[s+(this.#$e?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=rG(t,this.#r.tabSize);s=o===-1?r+this.#r.measureTextWidth(t):r+o*this.#r.ch;break}}}s+=this.#$e?.left??0}return this.#_===void 0?this.#_=[e,t,s,c]:(this.#_[0]=e,this.#_[1]=t,this.#_[2]=s,this.#_[3]=c),[s,c]}#xn(e){let t=this.#h.get(e);if(t!==void 0)return t;this.#h.size>=uG&&this.#h.clear();let n=this.#n?.document?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#h.set(e,t),t}let r=this.#w;if(r==null||!r.isConnected)return;let i=O(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#r.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=nG(n),c=t.left+this.#r.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>{o.setStart(a,u(e)),o.setEnd(a,u(e+1));let t=o.getClientRects();return t.item(t.length-1)??o.getBoundingClientRect()};s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=_()&&n-c>this.#r.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#h.set(e,m),m}finally{i.remove()}}#Sn(e){let t=this.#xn(e);if(t!==void 0)return t;let n=this.#n?.document?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Cn({startContainer:e,endContainer:t}){let n=this.#w;return n!==void 0&&n.contains(e)&&n.contains(t)}#wn(e){let t=this.#n?.document?.lineCount??0;return e<0||e>=t?!1:this.#gn(e)!==void 0}};function vG({type:e,editStateKey:t,owner:n,initialState:r,previousSession:i}){if(r!=null&&r.type!==e)throw TypeError(`Editor: initialState: a ${r.type} state cannot initialize a ${e} editor`);let a=r;return t==null?a??i??(e===`file`?{type:`file`}:{type:`file-diff`}):XV.activate(e,t,n,a)}function yG(e){return e instanceof HTMLElement?Number(e.dataset.bufferSize??1):1}function bG(e,t){return t!==void 0&&Number.isInteger(t.line)&&Number.isInteger(t.character)&&t.line>=0&&t.line<e.lineCount&&t.character>=0&&t.character<=e.getLineLength(t.line)}function xG(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return t>0&&t<e.length&&n>=55296&&n<=56319&&r>=56320&&r<=57343}var SG=[{value:`text`,label:`Plain text`},{value:`mermaid`,label:`Mermaid`},{value:`ts`,label:`TypeScript`},{value:`tsx`,label:`TSX`},{value:`js`,label:`JavaScript`},{value:`jsx`,label:`JSX`},{value:`json`,label:`JSON`},{value:`bash`,label:`Bash`},{value:`python`,label:`Python`},{value:`go`,label:`Go`},{value:`rust`,label:`Rust`},{value:`java`,label:`Java`},{value:`ruby`,label:`Ruby`},{value:`sql`,label:`SQL`},{value:`yaml`,label:`YAML`},{value:`toml`,label:`TOML`},{value:`html`,label:`HTML`},{value:`css`,label:`CSS`},{value:`md`,label:`Markdown`},{value:`diff`,label:`Diff`}],CG=new Set([`workflow`]);function wG(e){let t=e.trim().toLowerCase();return pn(t)?t:`text`}var TG=new Set;function EG(e){TG.add(e)}var DG=new Map;function OG(e){let t=DG.get(e);t?t():EG(e)}function kG(e){let t=e.getText().split(`
150
+ `);e.focus({lineNumber:t.length,character:t.at(-1)?.length??0})}var AG=[`keydown`,`keypress`,`keyup`,`beforeinput`,`input`,`paste`,`cut`,`copy`,`drop`];function jG(e){(0,k.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>e.stopPropagation();for(let e of AG)t.addEventListener(e,n);return()=>{for(let e of AG)t.removeEventListener(e,n)}},[e])}function MG({source:e}){let t=(0,k.useRef)(null),n=`plan-editor-mermaid-${(0,k.useId)().replace(/[^A-Za-z0-9_-]+/g,``)}`,[r,i]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let r=setTimeout(()=>{let r=t.current;if(!r)return;let a=e.trim();if(!a)r.replaceChildren(),i(null);else try{r.innerHTML=mn(a,n),i(null)}catch(e){i(e instanceof Error?e.message:String(e))}},250);return()=>clearTimeout(r)},[n,e]),(0,A.jsxs)(`figure`,{className:`plan-editor-mermaid`,"data-mermaid-preview":``,"aria-label":`Mermaid preview`,children:[(0,A.jsx)(`div`,{className:`plan-editor-mermaid-figure`,ref:t}),r?(0,A.jsx)(`figcaption`,{className:`plan-editor-mermaid-error`,role:`status`,children:r}):null]})}function NG({code:e,language:t}){let{setCode:n,setLanguage:r,lexicalNode:i}=JR(),[o,s]=(0,k.useState)(e),c=(0,k.useRef)(e),l=(0,k.useRef)(null);jG(l);let u=(0,k.useRef)(null),d=(0,k.useMemo)(()=>(e,t,n)=>{let r=new _G(e,t,n);return e===`file`&&(u.current=r),r},[]);(0,k.useEffect)(()=>{let e=i.getKey(),t=0,n=()=>{let e=0,n=()=>{let r=u.current;r?.getFile()?kG(r):e++<60&&(t=requestAnimationFrame(n))};cancelAnimationFrame(t),t=requestAnimationFrame(n)};return DG.set(e,n),TG.has(e)&&(TG.delete(e),n()),()=>{cancelAnimationFrame(t),DG.get(e)===n&&DG.delete(e)}},[i]);let f=ee(),m=p(),h=t.trim(),g=CG.has(h),_=SG.some(e=>e.value===h)||!h?SG:[...SG,{value:h,label:h}],v=(0,k.useMemo)(()=>({name:`fence`,contents:c.current,lang:wG(h)}),[h]),y=b(),x=(0,k.useMemo)(()=>({...w(m,y),theme:f,disableFileHeader:!0}),[f,y,m]);return(0,A.jsxs)(`div`,{className:`plan-editor-code`,ref:l,"data-code-fence":h||`text`,children:[(0,A.jsx)(`div`,{className:`plan-editor-code-head`,children:g?(0,A.jsx)(`span`,{className:`plan-editor-code-lang`,children:h}):(0,A.jsxs)(ut,{value:h||`text`,onValueChange:e=>r(String(e??``)===`text`?``:String(e??``)),children:[(0,A.jsx)(ct,{className:`plan-editor-select plan-editor-code-select`,"aria-label":`Code language`,children:(0,A.jsx)(ht,{children:e=>_.find(t=>t.value===e)?.label??e})}),(0,A.jsx)(pt,{className:`plan-editor-select-popup`,children:_.map(e=>(0,A.jsx)(at,{value:e.value,children:e.label},e.value))})]})}),(0,A.jsx)(`div`,{className:`plan-editor-code-body`,onPointerUp:()=>{let e=u.current;e?.getFile()&&e.getText()===``&&kG(e)},children:(0,A.jsx)(a,{createEditor:d,children:(0,A.jsx)(T,{file:v,options:x,edit:!0,disableWorkerPool:!0,className:`plan-code plan-editor-code-file`,onEditChange:e=>{let t=e.file.contents;c.current=t,s(t),n(t)}})})}),h===`mermaid`?(0,A.jsx)(MG,{source:o}):null]})}var PG={priority:0,match:()=>!0,Editor:NG},FG=7,IG=``,LG=``;function RG(e){let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement);if(n<0)return;let r={ArrowRight:1,ArrowLeft:-1,ArrowDown:FG,ArrowUp:-7,Home:-n,End:t.length-1-n}[e.key];r!==void 0&&(e.preventDefault(),t[Math.min(t.length-1,Math.max(0,n+r))]?.focus())}function zG(e,t){return e===Math.max(0,t)?0:-1}function BG({icon:e,color:t,label:n,defaultTint:r,onChange:i}){let[a,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(null),l=(0,k.useRef)(null),u=(0,k.useId)(),d=e?nt(e):null,f=d?Ze(t):void 0,p=[IG,...Qe],m=[LG,..._t],h=p.indexOf(d?e.trim().toLowerCase():IG),g=m.indexOf(f??LG),_=s??(d?[e,f].filter(Boolean).join(` · `):`No icon`),v=r?{"--card-icon-color":r}:void 0;return(0,A.jsxs)(`div`,{className:`plan-card-label plan-editor-kicker`,"data-has-icon":`true`,children:[(0,A.jsxs)(Nt,{open:a,onOpenChange:e=>{o(e),c(null)},children:[(0,A.jsx)(Mt,{className:`plan-card-icon plan-editor-icon`,"data-color":f,"data-empty":d?void 0:`true`,"data-icon-picker":``,"aria-label":d?`Icon ${_}. Change icon`:`Add an icon`,title:d?`Change icon`:`Add an icon`,children:d??(0,A.jsx)(rt,{size:14,strokeWidth:2,"aria-hidden":`true`})}),(0,A.jsxs)(jt,{className:`plan-icon-popover`,side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,initialFocus:l,"data-icon-picker-popup":``,children:[(0,A.jsxs)(`div`,{className:`plan-icon-popover-head`,children:[(0,A.jsx)(`span`,{className:`plan-icon-popover-title`,id:`${u}-icons`,children:`Icon`}),(0,A.jsx)(`span`,{className:`plan-icon-popover-caption`,"aria-live":`polite`,children:_})]}),(0,A.jsx)(`div`,{className:`plan-icon-grid`,role:`group`,"aria-labelledby":`${u}-icons`,onKeyDown:RG,children:p.map((e,n)=>(0,A.jsx)(`button`,{ref:n===Math.max(0,h)?l:void 0,type:`button`,className:`plan-card-icon plan-icon-option`,"data-icon-option":e||`none`,"data-color":e?f:void 0,"aria-pressed":n===h,"aria-label":e||`No icon`,title:e||`No icon`,tabIndex:zG(n,h),style:e&&!f?v:void 0,"data-tinted":e&&!f&&r?`true`:void 0,onPointerEnter:()=>c(e||`No icon`),onPointerLeave:()=>c(null),onFocus:()=>c(e||`No icon`),onBlur:()=>c(null),onClick:()=>i(e?{icon:e,color:t}:{icon:IG,color:LG}),children:e?nt(e):(0,A.jsx)(Je,{size:16,strokeWidth:2,"aria-hidden":`true`})},e||`none`))}),(0,A.jsx)(`div`,{className:`plan-icon-popover-head`,children:(0,A.jsx)(`span`,{className:`plan-icon-popover-title`,id:`${u}-colors`,children:`Color`})}),(0,A.jsx)(`div`,{className:`plan-icon-grid`,role:`group`,"aria-labelledby":`${u}-colors`,onKeyDown:RG,children:m.map((t,n)=>(0,A.jsx)(`button`,{type:`button`,className:`plan-card-icon plan-icon-option plan-icon-swatch`,"data-color-option":t||`default`,"data-color":t||void 0,"data-tinted":!t&&r?`true`:void 0,style:t?void 0:v,disabled:!d,"aria-pressed":n===g,"aria-label":t||`Default color`,title:d?t||`Default color`:`Pick an icon first`,tabIndex:zG(n,g),onPointerEnter:()=>c(t||`Default color`),onPointerLeave:()=>c(null),onFocus:()=>c(t||`Default color`),onBlur:()=>c(null),onClick:()=>i({icon:e,color:t}),children:d??(0,A.jsx)(`span`,{className:`plan-icon-swatch-dot`,"aria-hidden":`true`})},t||`default`))})]})]}),(0,A.jsx)(`span`,{className:`plan-card-label-text`,children:n})]})}var VG=[`search`,`sort`,`filter`];function HG(e){let t=e?.type;return t===`mdxJsxFlowElement`||t===`mdxJsxTextElement`}function UG(e,t){return HG(e)&&e.name===t}function WG(e){return e?.type===`paragraph`}function GG(e){return e?.type===`text`&&/^\s*$/.test(e.value)}function KG(e){return WG(e)&&e.children.some(HG)&&e.children.every(e=>HG(e)||GG(e))}function qG(e,t){let n=[];return e.children.forEach((e,r)=>{UG(e,t)?n.push({at:r}):WG(e)&&e.children.forEach((e,i)=>{UG(e,t)&&n.push({at:r,inline:i})})}),n}function JG(e,t){let n=e.children[t.at];return t.inline===void 0?n:n.children[t.inline]}var YG=e=>qG(e,`Column`),XG=e=>qG(e,`Row`),ZG=e=>qG(e,`Cell`);function QG(e,t){return e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t)}function $G(e,t){let n=QG(e,t);return!n||n.value===null||n.value===void 0?``:typeof n.value==`string`?n.value:n.value.value}function eK(e,t){let n=QG(e,t);if(!n)return!1;if(n.value===null||n.value===void 0)return!0;let r=(typeof n.value==`string`?n.value:n.value.value).trim();return r===``||r===`true`}function tK(e,t,n){let r=e.attributes.findIndex(e=>e.type===`mdxJsxAttribute`&&e.name===t);r>=0?e.attributes[r]={type:`mdxJsxAttribute`,name:t,value:n}:n!==``&&e.attributes.push({type:`mdxJsxAttribute`,name:t,value:n})}function nK(e,t){e.attributes=e.attributes.filter(e=>e.type!==`mdxJsxAttribute`||e.name!==t)}function rK(e,t,n){if(!n){nK(e,t);return}if(eK(e,t))return;let r=e.attributes.findIndex(e=>e.type===`mdxJsxAttribute`&&e.name===t),i={type:`mdxJsxAttribute`,name:t,value:null};r>=0?e.attributes[r]=i:e.attributes.push(i)}var iK=new Set([`emphasis`,`strong`,`delete`,`link`,`linkReference`,`mdxJsxTextElement`]);function aK(e){let t=[],n=e=>{if(!e||typeof e!=`object`)return;let{type:r=``,value:i,children:a}=e;if((r===`text`||r===`inlineCode`)&&typeof i==`string`&&t.push(i),r===`break`&&t.push(` `),Array.isArray(a)){for(let e of a)n(e);iK.has(r)||t.push(` `)}};for(let t of e)n(t);return t.join(``).replace(/\s+/g,` `).trim()}function oK(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}function sK(e,t){return $G(e,`id`).trim()||oK(cK(e))||`column-${t+1}`}function cK(e){return $G(e,`header`)||aK(e.children)}function lK(e,t,n){let r=oK(e);if(r){let e=r;for(let n=2;t.includes(e);n+=1)e=`${r}-${n}`;return e}let i=n+1;for(;t.includes(`col-${i}`);)i+=1;return`col-${i}`}function uK(e){return{label:$G(e,`label`),columns:YG(e).map((t,n)=>{let r=JG(e,t);return{id:sK(r,n),header:cK(r),search:eK(r,`search`),sort:eK(r,`sort`),filter:eK(r,`filter`)}}),rows:XG(e).map(t=>ZG(JG(e,t)).length)}}function dK(e,t){let n=XG(e)[t];return n?JG(e,n):void 0}function fK(e,t,n){let r=dK(e,t),i=r?ZG(r)[n]:void 0;return r&&i?JG(r,i):void 0}function pK(e){return e.type===`mdxJsxFlowElement`?e.children:e.children.length>0?[{type:`paragraph`,children:e.children}]:[]}function mK(e,t,n){let r=fK(e,t,n);return r?pK(r):[]}function hK(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>hK(e,t[n]));if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;let n=e=>Object.entries(e).filter(([e,t])=>e!==`position`&&t!==void 0).map(([e])=>e).sort(),r=n(e),i=n(t);return r.length!==i.length||r.some((e,t)=>e!==i[t])?!1:r.every(n=>hK(e[n],t[n]))}function gK(){return{type:`mdxJsxTextElement`,name:`Cell`,attributes:[],children:[]}}function _K(){return{type:`text`,value:`
151
+ `}}function vK(e){let t=0,n=e.length;for(;t<n&&GG(e[t]);)t+=1;for(;n>t&&GG(e[n-1]);)--n;return e.slice(t,n)}function yK(e,t){if(t.inline===void 0)return t.at;let n=e.children[t.at],r=n.children[t.inline],i=vK(n.children.slice(0,t.inline)),a=vK(n.children.slice(t.inline+1)),o={type:`mdxJsxFlowElement`,name:r.name,attributes:r.attributes,children:r.children.length>0?[{type:`paragraph`,children:r.children}]:[]},s=[];return i.length>0&&s.push({type:`paragraph`,children:i}),s.push(o),a.length>0&&s.push({type:`paragraph`,children:a}),e.children.splice(t.at,1,...s),t.at+ +(i.length>0)}function bK(e,t,n){let r=e.children[t],i={type:`paragraph`,children:[{type:`mdxJsxTextElement`,name:r.name,attributes:r.attributes,children:n}]};e.children.splice(t,1,i);let a=e.children[t-1];KG(a)&&(a.children.push(_K(),...i.children),e.children.splice(t,1),--t);let o=e.children[t],s=e.children[t+1];KG(s)&&(o.children.push(_K(),...s.children),e.children.splice(t+1,1))}function xK(e,t,n=!1){let r=JG(e,t);if(t.inline!==void 0){let r=e.children[t.at].children,i=n?t.inline:t.inline+1;r.splice(i,0,...n?[gK(),_K()]:[_K(),gK()]);return}let i=r.type===`mdxJsxFlowElement`?{...gK(),type:`mdxJsxFlowElement`}:gK();e.children.splice(n?t.at:t.at+1,0,i)}function SK(e){let t=ZG(e),n=t[t.length-1];n?xK(e,n):e.type===`mdxJsxTextElement`?e.children.push(gK()):e.children.push({type:`paragraph`,children:[gK()]})}function CK(e,t){if(t.inline===void 0){e.children.splice(t.at,1);return}let n=e.children[t.at].children;n.splice(t.inline,1),GG(n[t.inline-1])?n.splice(t.inline-1,1):GG(n[t.inline])&&n.splice(t.inline,1),n.every(GG)&&e.children.splice(t.at,1)}function wK(e){return e.filter(e=>!(WG(e)&&vK(e.children).length===0))}function TK(e,t,n,r){let i=wK(r),a=fK(e,t,n);if((a?hK(pK(a),i):i.length===0)||!dK(e,t))return e;let o=structuredClone(e),s=dK(o,t);for(;ZG(s).length<=n;)SK(s);let c=i.length===0||i.length===1&&WG(i[0]),l=i.length===1&&WG(i[0])?i[0].children:[],u=ZG(s)[n],d=JG(s,u);if(EK(d,pK(d),i),c&&d.type===`mdxJsxTextElement`)d.children=l;else if(c&&d.children.length===0&&l.length>0&&s.type===`mdxJsxFlowElement`)bK(s,u.at,l);else if(d.type===`mdxJsxFlowElement`)d.children=i;else{if(s.type===`mdxJsxTextElement`){let e=XG(o)[t];yK(o,e),s=dK(o,t),u=ZG(s)[n]}let e=yK(s,u);d=s.children[e],d.children=i}return o}function EK(e,t,n){let r=QG(e,`value`);if(!r||typeof r.value!=`string`)return;let i=aK(t),a=aK(n);r.value.trim()===i&&i!==a&&a!==``&&(r.value=a)}function DK(e,t){if($G(e,`label`)===t)return e;let n=structuredClone(e);return tK(n,`label`,t),n}function OK(e,t,n,r=!1){let i=YG(e)[t];if(!i)return e;let a=structuredClone(e),o=JG(a,i);return tK(o,`header`,n),r&&tK(o,`id`,lK(n,YG(a).filter((e,n)=>n!==t).map((e,t)=>sK(JG(a,e),t)),t)),hK(a,e)?e:a}function kK(e,t,n,r){let i=YG(e);if(!i[t])return e;let a=structuredClone(e);return i.forEach((e,i)=>{let o=JG(a,e);i===t?rK(o,n,r):n===`filter`&&r&&rK(o,`filter`,!1)}),hK(a,e)?e:a}function AK(e,t=``){let n=structuredClone(e),r=YG(n),i=r.length,a=[{type:`mdxJsxAttribute`,name:`id`,value:lK(t,r.map((e,t)=>sK(JG(n,e),t)),i)}];t&&a.push({type:`mdxJsxAttribute`,name:`header`,value:t});let o={type:`mdxJsxFlowElement`,name:`Column`,attributes:a,children:[]},s=r[i-1];n.children.splice(s?s.at+1:0,0,o);for(let e of XG(n)){let t=JG(n,e),r=ZG(t);r.length<i||(i>0?xK(t,r[i-1]):r[0]?xK(t,r[0],!0):SK(t))}return n}function jK(e,t){let n=YG(e)[t];if(!n)return e;let r=structuredClone(e);for(let e of XG(r)){let n=JG(r,e),i=ZG(n)[t];i&&CK(n,i)}return CK(r,n),r}function MK(e){let t=structuredClone(e),n=YG(t).length,r=[];for(let e=0;e<n;e+=1)e>0&&r.push(_K()),r.push(gK());let i={type:`mdxJsxFlowElement`,name:`Row`,attributes:[],children:r.length>0?[{type:`paragraph`,children:r}]:[]},a=XG(t),o=YG(t),s=a[a.length-1]??o[o.length-1];return t.children.splice(s?s.at+1:t.children.length,0,i),t}function NK(e,t){let n=XG(e)[t];if(!n)return e;let r=structuredClone(e);return CK(r,n),r}function PK(e){return!HG(e)||e.type!==`mdxJsxFlowElement`||e.children.length===0?!1:e.name===`DataTable`||e.name===`Row`&&qG(e,`Cell`).length>0}function FK(e){return e?.type===`mdxJsxFlowElement`||KG(e)}var IK=`data-table-parts`;function LK(e){let t=0;for(let n=e.stack.length-1;n>=0;--n){let r=e.stack[n];if(r===`blockquote`||r===`listItem`)break;r===`mdxJsxFlowElement`&&(t+=1)}return t}function RK(e){return function(t,n,r,i){if(!PK(t))return e(t,n,r,i);let a=e({...t,children:[{type:`html`,value:IK}]},n,r,i),o=r.enter(`mdxJsxFlowElement`),s=` `.repeat(LK(r));r.indexStack.push(-1);let c=``;return t.children.forEach((e,n)=>{r.indexStack[r.indexStack.length-1]=n;let i=r.handle(e,t,r,{before:`
152
+ `,after:`
153
+ `,now:{line:1,column:1},lineShift:0}),a=e.type===`mdxJsxFlowElement`?i:r.indentLines(i,(e,t,n)=>(n?``:s)+e);e.type!==`list`&&(r.bulletLastUsed=void 0),n>0&&(c+=FK(t.children[n-1])&&FK(e)?`
154
+ `:`
155
+
156
+ `),c+=a}),r.indexStack.pop(),o(),a.replace(s+IK,c)}}function zK(){let e=(e,t)=>({type:`mdxJsxFlowElement`,name:`Column`,attributes:[{type:`mdxJsxAttribute`,name:`id`,value:e},{type:`mdxJsxAttribute`,name:`header`,value:t}],children:[]}),t=e=>({type:`mdxJsxTextElement`,name:`Cell`,attributes:[],children:[{type:`text`,value:e}]});return{type:`mdxJsxFlowElement`,name:`DataTable`,attributes:[{type:`mdxJsxAttribute`,name:`label`,value:`New table`}],children:[e(`name`,`Name`),e(`notes`,`Notes`),{type:`mdxJsxFlowElement`,name:`Row`,attributes:[],children:[{type:`paragraph`,children:[t(`First row`),_K(),t(`What this row holds.`)]}]}]}}var BK=[`keydown`,`keypress`,`keyup`,`beforeinput`,`paste`,`cut`,`copy`,`drop`];function VK(e){(0,k.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let t=e.target;(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLButtonElement)&&e.stopPropagation()};for(let e of BK)t.addEventListener(e,n);return()=>{for(let e of BK)t.removeEventListener(e,n)}},[e])}var HK={search:{label:`Search`,hint:`The search field looks in it`,Icon:Wn},sort:{label:`Sort`,hint:`Its header sorts the rows`,Icon:Ke},filter:{label:`Filter`,hint:`A select of its values`,Icon:Bn}};function UK(){let{parentEditor:e,lexicalNode:t}=iR();return{current:(0,k.useCallback)(()=>e.getEditorState().read(()=>H(t.getKey())?.getMdastNode?.()??null),[e,t]),change:(0,k.useCallback)(n=>{WB();let r=!1;return e.update(()=>{let e=H(t.getKey()),i=e?.getMdastNode?.();if(!e?.setMdastNode||!i)return;let a=n(i);a!==i&&(e.setMdastNode(a),r=!0)},{discrete:!0,tag:[ac,cc,sc]}),r&&e.dispatchCommand(Hx,void 0),r},[e,t])}}function WK(e,t=12){let n=t=>{let r=e();if(r){if(r.isContentEditable){let e=Ku(r);e?e.focus(void 0,{defaultSelection:`rootStart`}):r.focus()}else r.focus()}else t>0&&requestAnimationFrame(()=>n(t-1))};requestAnimationFrame(()=>n(t))}function GK({row:e,column:t,label:n,current:r}){let i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=i.current;if(!e)return;let t=t=>{if(t.key!==`Backspace`||!(t.target instanceof HTMLElement)||!t.target.classList.contains(`plan-dt-cell-content`)||t.target.closest(`td`)!==e)return;let n=t.target.innerText;(n===`
157
+ `||n===``)&&(t.preventDefault(),t.stopPropagation())};return e.addEventListener(`keydown`,t,!0),()=>e.removeEventListener(`keydown`,t,!0)},[]),(0,A.jsx)(`td`,{ref:i,className:`plan-dt-cell`,"data-dt-cell":`${e}:${t}`,children:(0,A.jsx)(sR,{block:!0,contentEditableProps:{className:`plan-dt-cell-content`,"aria-label":n},getContent:n=>mK(n,e,t),getUpdatedMdastNode:(n,i)=>TK(r()??n,e,t,i)})})}function KK(e){let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement);if(n<0)return;let r={ArrowDown:1,ArrowUp:-1,Home:-n,End:t.length-1-n}[e.key];r!==void 0&&(e.preventDefault(),t[(n+r+t.length)%t.length]?.focus())}function qK({column:e,name:t,disabled:n,onFlag:r,onRemove:i}){let[a,o]=(0,k.useState)(!1),s=VG.filter(t=>e[t]);return(0,A.jsxs)(Nt,{open:a,onOpenChange:o,children:[(0,A.jsxs)(Mt,{className:`plan-dt-column-button`,disabled:n,"data-dt-column-menu":``,"aria-label":`${t} column${s.length?`: ${s.join(`, `)}`:``}. Column options`,title:`Search, sort, filter, or remove`,children:[s.length?(0,A.jsx)(`span`,{className:`plan-dt-flags`,"aria-hidden":`true`,children:s.map(e=>{let{Icon:t}=HK[e];return(0,A.jsx)(t,{size:12,strokeWidth:2.25,"data-dt-flag-on":e},e)})}):null,(0,A.jsx)(kt,{size:14,strokeWidth:2,"aria-hidden":`true`})]}),(0,A.jsxs)(jt,{className:`plan-dt-column-popover`,side:`bottom`,align:`end`,sideOffset:6,collisionPadding:12,"data-dt-column-popup":``,children:[(0,A.jsxs)(`div`,{className:`plan-dt-column-popover-head`,children:[(0,A.jsx)(`span`,{className:`plan-dt-column-popover-title`,children:t}),(0,A.jsx)(`code`,{className:`plan-dt-column-id`,title:`The column's id. It stays as it is.`,children:e.id})]}),(0,A.jsxs)(`div`,{className:`plan-dt-column-options`,role:`group`,"aria-label":`${t} column options`,onKeyDown:KK,children:[VG.map(t=>{let{label:n,hint:i,Icon:a}=HK[t];return(0,A.jsxs)(`button`,{type:`button`,className:`plan-dt-column-option`,"data-dt-flag":t,"aria-pressed":e[t],onClick:()=>r(t,!e[t]),children:[(0,A.jsx)(a,{size:14,strokeWidth:2,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`plan-dt-column-option-text`,children:[(0,A.jsx)(`span`,{className:`plan-dt-column-option-label`,children:n}),(0,A.jsx)(`span`,{className:`plan-dt-column-option-hint`,children:i})]}),(0,A.jsx)(Dt,{size:14,strokeWidth:2.25,className:`plan-dt-column-option-check`,"aria-hidden":`true`})]},t)}),(0,A.jsxs)(`button`,{type:`button`,className:`plan-dt-column-option plan-dt-column-remove`,"data-dt-remove-column":``,onClick:()=>{o(!1),i()},children:[(0,A.jsx)(Xn,{size:14,strokeWidth:2,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`plan-dt-column-option-text`,children:[(0,A.jsx)(`span`,{className:`plan-dt-column-option-label`,children:`Remove column`}),(0,A.jsx)(`span`,{className:`plan-dt-column-option-hint`,children:`With its cell in every row`})]})]})]})]})]})}function JK({mdastNode:e}){let t=e,n=(0,k.useMemo)(()=>uK(t),[t]),{current:r,change:i}=UK(),a=oR(),o=(0,k.useContext)(LB),s=FB(t),c=o||s,l=(0,k.useMemo)(()=>zB(t),[t]),u=(0,k.useRef)(null);VK(u);let d=(0,k.useRef)({next:0,rows:[],columns:[],named:new Set}),f=()=>`k${d.current.next+=1}`;d.current.rows.length!==n.rows.length&&(d.current.rows=n.rows.map(f)),d.current.columns.length!==n.columns.length&&(d.current.columns=n.columns.map(f),d.current.named.clear());let p=e=>n.columns[e]?.header.trim()||`Column ${e+1}`,m=()=>{if(!i(MK))return;d.current.rows.push(f());let e=n.rows.length;WK(()=>u.current?.querySelector(`[data-dt-cell="${e}:0"] .plan-dt-cell-content`)??null)},h=()=>{if(!i(e=>AK(e)))return;let e=f();d.current.columns.push(e),d.current.named.add(e);let t=n.columns.length;WK(()=>u.current?.querySelector(`[data-dt-header="${t}"]`)??null)},g=e=>{i(t=>NK(t,e))&&d.current.rows.splice(e,1)},_=e=>{if(i(t=>jK(t,e))){let[t]=d.current.columns.splice(e,1);t&&d.current.named.delete(t)}},v=(e,t)=>{let n=d.current.columns[e];i(r=>OK(r,e,t,n!==void 0&&d.current.named.has(n)))},y=s&&PB(t)===!0,b=n.rows.length;return(0,A.jsxs)(`section`,{ref:u,className:`plan-dt-editor`,"data-editor-entry":`DataTable`,"data-locked":c?`true`:void 0,"aria-disabled":c||void 0,children:[y?(0,A.jsxs)(`div`,{className:`plan-editor-locked-note`,children:[(0,A.jsx)($e,{size:12,strokeWidth:2.25,"aria-hidden":`true`}),(0,A.jsx)(`span`,{children:`Locked by the plan · it can be moved, not changed`})]}):null,(0,A.jsxs)(`div`,{className:`plan-dt-card`,children:[(0,A.jsxs)(`div`,{className:`plan-dt-head`,children:[(0,A.jsx)(tt,{icon:(0,A.jsx)(Kn,{size:16,strokeWidth:2}),className:`plan-editor-kicker`,children:`Data table`}),(0,A.jsx)(`input`,{className:`plan-dt-label`,"aria-label":`Table label`,placeholder:`Table label`,value:n.label,disabled:c,"data-dt-label":``,onChange:e=>i(t=>DK(t,e.target.value))}),(0,A.jsx)(`span`,{className:`plan-dt-count`,"aria-live":`polite`,children:b===1?`1 row`:`${b} rows`}),(0,A.jsx)(`button`,{type:`button`,className:`plan-editor-remove`,"aria-label":`Remove data table`,title:c?`Locked cards cannot be removed`:l?`It holds a locked card, so it cannot be removed`:`Remove`,disabled:c||l,onClick:a,children:(0,A.jsx)(Xn,{size:14,"aria-hidden":`true`})})]}),(0,A.jsx)(`div`,{className:`plan-dt-scroll`,children:(0,A.jsxs)(`div`,{className:`plan-dt-grid-line`,children:[(0,A.jsxs)(`table`,{className:`plan-dt-grid`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[n.columns.map((e,t)=>(0,A.jsx)(`th`,{scope:`col`,"data-dt-column":e.id,children:(0,A.jsxs)(`div`,{className:`plan-dt-th`,children:[(0,A.jsx)(`input`,{className:`plan-dt-header`,"aria-label":`Column ${t+1} header`,placeholder:`Column ${t+1}`,size:Math.max(6,Math.min(32,(e.header||`Column ${t+1}`).length+1)),value:e.header,disabled:c,"data-dt-header":t,onChange:e=>v(t,e.target.value)}),(0,A.jsx)(qK,{column:e,name:p(t),disabled:c,onFlag:(e,n)=>i(r=>kK(r,t,e,n)),onRemove:()=>_(t)})]})},d.current.columns[t])),(0,A.jsx)(`th`,{className:`plan-dt-tools`,"aria-hidden":`true`})]})}),(0,A.jsxs)(`tbody`,{children:[(0,A.jsx)(LB.Provider,{value:c,children:n.rows.map((e,t)=>(0,A.jsxs)(`tr`,{"data-dt-row":t,children:[n.columns.map((e,n)=>(0,A.jsx)(GK,{row:t,column:n,label:`${p(n)}, row ${t+1}`,current:r},`${d.current.rows[t]}:${d.current.columns[n]}`)),(0,A.jsx)(`td`,{className:`plan-dt-tools`,children:(0,A.jsx)(`button`,{type:`button`,className:`plan-dt-remove-row`,"aria-label":`Remove row ${t+1}`,title:`Remove this row`,disabled:c,"data-dt-remove-row":t,onClick:()=>g(t),children:(0,A.jsx)(nr,{size:14,strokeWidth:2,"aria-hidden":`true`})})})]},d.current.rows[t]))}),n.columns.length===0?(0,A.jsx)(`tr`,{children:(0,A.jsx)(`td`,{className:`plan-dt-empty`,children:`No columns yet. Add one with the + on the right.`})}):null]})]}),c?null:(0,A.jsx)(`button`,{type:`button`,className:`plan-dt-add plan-dt-add-column`,"aria-label":`Add a column`,title:`Add a column`,"data-dt-add-column":``,onClick:h,children:(0,A.jsx)(rt,{size:10,strokeWidth:2.5,"aria-hidden":`true`})})]})}),c?null:(0,A.jsx)(`button`,{type:`button`,className:`plan-dt-add plan-dt-add-row`,"aria-label":`Add a row`,title:`Add a row`,"data-dt-add-row":``,onClick:m,children:(0,A.jsx)(rt,{size:10,strokeWidth:2.5,"aria-hidden":`true`})})]})]})}var YK=ii({init(e){let t=(Yt().extensions??[]).map(e=>e.handlers?.mdxJsxFlowElement).find(e=>e!==void 0);t&&e.pubIn({[OS]:{handlers:{mdxJsxFlowElement:RK(t)}}})}}),XK={name:`DataTable`,kind:`flow`,props:[{name:`label`,type:`string`}],hasChildren:!0,Editor:JK},ZK=[`neutral`,`success`,`warning`,`danger`];function QK(e){return ZK.includes(e)?e:`neutral`}function $K({mdastNode:e,kind:t}){let{parentEditor:n,lexicalNode:r}=iR(),i=(0,k.useContext)(LB),a=(0,k.useRef)(null);VK(a),(0,k.useEffect)(()=>{let e=a.current;if(!e)return;let t=t=>{t.key===`Enter`&&t.target instanceof HTMLElement&&(t.target.closest(`[data-editor-label]`)!==e||t.metaKey||t.ctrlKey||(t.preventDefault(),t.stopPropagation()))};return e.addEventListener(`keydown`,t,!0),()=>e.removeEventListener(`keydown`,t,!0)},[]);let o=QK($G(e,`tone`).trim()),s=ZK[(ZK.indexOf(o)+1)%ZK.length];return(0,A.jsxs)(`span`,{ref:a,className:t===`pill`?`plan-pill plan-editor-label`:`plan-chip plan-editor-label`,"data-tone":t===`pill`?o:void 0,"data-editor-label":t,children:[t===`pill`?(0,A.jsx)(`button`,{type:`button`,className:`plan-editor-pill-tone`,disabled:i,"data-pill-tone":``,"aria-label":`Tone ${o}. Change to ${s}`,title:`Tone: ${o} · click for ${s}`,onClick:()=>{n.update(()=>{let e=H(r.getKey()),t=e?.getMdastNode?.();if(!t||!e?.setMdastNode)return;let n=t.attributes.filter(e=>e.type!==`mdxJsxAttribute`||e.name!==`tone`),i=t.attributes.findIndex(e=>e.type===`mdxJsxAttribute`&&e.name===`tone`);n.splice(i<0?n.length:i,0,{type:`mdxJsxAttribute`,name:`tone`,value:s}),e.setMdastNode({...t,attributes:n})},{discrete:!0,tag:[ac,cc,sc]}),n.dispatchCommand(Hx,void 0)}}):null,(0,A.jsx)(sR,{block:e.type===`mdxJsxFlowElement`,contentEditableProps:{className:`plan-editor-label-text`,"aria-label":t===`pill`?`Pill text`:`Chip text`},getContent:e=>e.children,getUpdatedMdastNode:(e,t)=>({...e,children:t})})]})}function eq({mdastNode:e}){return(0,A.jsx)($K,{mdastNode:e,kind:`pill`})}function tq({mdastNode:e}){return(0,A.jsx)($K,{mdastNode:e,kind:`chip`})}var nq=[{name:`Pill`,kind:`text`,props:[{name:`tone`,type:`string`}],hasChildren:!0,Editor:eq},{name:`Chip`,kind:`text`,props:[],hasChildren:!0,Editor:tq}],rq=e(ve(),1),iq={}.hasOwnProperty,aq=new Map,oq=/[A-Z]/g,sq=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),cq=new Set([`td`,`th`]),lq=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function uq(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=xq(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=bq(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?le:oe,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=dq(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function dq(e,t,n){if(t.type===`element`)return fq(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return pq(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return hq(e,t,n);if(t.type===`mdxjsEsm`)return mq(e,t);if(t.type===`root`)return gq(e,t,n);if(t.type===`text`)return _q(e,t)}function fq(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=le,e.schema=i),e.ancestors.push(t);let a=Dq(e,t.tagName,!1),o=Sq(e,t),s=wq(e,t);return sq.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!fe(e)})),vq(e,o,a,t),yq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function pq(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Oq(e,t.position)}function mq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Oq(e,t.position)}function hq(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=le,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Dq(e,t.name,!0),o=Cq(e,t),s=wq(e,t);return vq(e,o,a,t),yq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function gq(e,t,n){let r={};return yq(r,wq(e,t)),e.create(t,e.Fragment,r,n)}function _q(e,t){return t.value}function vq(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function yq(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function bq(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function xq(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ae(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Sq(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&iq.call(t.properties,i)){let a=Tq(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&cq.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Cq(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Oq(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Oq(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function wq(e,t){let n=[],r=-1,i=e.passKeys?new Map:aq;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=dq(e,a,o);s!==void 0&&n.push(s)}return n}function Tq(e,t,n){let r=de(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ue(n):ce(n)),r.property===`style`){let t=typeof n==`object`?n:Eq(e,String(n));return e.stylePropertyNameCase===`css`&&(t=kq(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?be[r.property]||r.property:r.attribute,n]}}function Eq(e,t){try{return(0,rq.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Ft("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=lq+`#cannot-parse-style-attribute`,r}}function Dq(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Lt(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Lt(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return iq.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Oq(e)}function Oq(e,t){let n=new Ft("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=lq+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function kq(e){let t={},n;for(n in e)iq.call(e,n)&&(t[Aq(n)]=e[n]);return t}function Aq(e){let t=e.replace(oq,jq);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function jq(e){return`-`+e.toLowerCase()}var Mq=`Locked in the editor: answered on the page`,Nq=Object.fromEntries(Object.entries(tn).map(([e,t])=>[t,e]));function Pq(e){function t(t){return(0,A.jsx)(e,{...t,locked:!0,lockedState:Mq})}return t.displayName=`Locked${e.displayName??e.name}`,t}var Fq={form:Pq(st),questions:Pq(ft),choice:Pq(ot),approve:Pq(vt),field:mt,item:lt,option:dt};function Iq(e){return(Nq[e]??e)in Fq}function Lq(e){let t={...e};return typeof t.name==`string`&&(t.name=Nq[t.name]??t.name),Array.isArray(t.children)&&(t.children=t.children.map(e=>Lq(e))),t}function Rq(e){try{return uq(ke({type:`root`,children:[Lq(e)]},{passThrough:[`mdxJsxFlowElement`,`mdxJsxTextElement`]}),{Fragment:A.Fragment,jsx:A.jsx,jsxs:A.jsxs,components:Fq,elementAttributeNameCase:`react`,stylePropertyNameCase:`dom`})}catch{return null}}var zq=[`pending`,`active`,`blocked`,`done`,`failed`];function Bq(e){let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);if(n<0)return;let r={ArrowDown:1,ArrowUp:-1,Home:-n,End:t.length-1-n}[e.key];r!==void 0&&(e.preventDefault(),t[(n+r+t.length)%t.length]?.focus())}function Vq({status:e,onChange:t,disabled:n=!1}){let[r,i]=(0,k.useState)(!1),a=(0,k.useRef)(null);return(0,A.jsxs)(Nt,{open:r,onOpenChange:i,children:[(0,A.jsx)(Mt,{className:`plan-phase-status plan-editor-status plan-editor-status-button`,"data-status":e,"data-status-picker":``,disabled:n,"aria-label":`Status ${Ye(e)}. Change status`,title:`Change status`,children:(0,A.jsx)(Xe,{status:e})}),(0,A.jsx)(jt,{className:`plan-status-popover`,side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,initialFocus:a,"data-status-picker-popup":``,children:(0,A.jsx)(`div`,{className:`plan-status-list`,role:`group`,"aria-label":`Status`,onKeyDown:Bq,children:zq.map(n=>(0,A.jsxs)(`button`,{ref:n===e?a:void 0,type:`button`,className:`plan-status-option`,"data-status":n,"data-status-option":n,"aria-pressed":n===e,tabIndex:n===e?0:-1,onClick:()=>{t(n),i(!1)},children:[(0,A.jsx)(`span`,{className:`plan-status-option-icon`,"aria-hidden":`true`,children:(0,A.jsx)(Xe,{status:n})}),(0,A.jsx)(`span`,{className:`plan-status-option-label`,children:Ye(n)}),n===e?(0,A.jsx)(Dt,{size:14,strokeWidth:2.25,className:`plan-status-option-check`,"aria-hidden":`true`}):null]},n))})})]})}var Hq=[`note`,`tip`,`risk`,`decision`,`warning`],Uq=[`text`,`number`,`textarea`,`select`,`checkbox`,`stepper`],Wq=[`modified`,`added`,`deleted`,`renamed`,`unchanged`],Gq=[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`],Kq=[`path`,`query`,`header`,`body`,`cookie`],qq=[`1-n`,`1-1`,`n-1`,`n-n`],Jq=[`on-track`,`at-risk`,`off-track`],Yq=`__none__`,Xq={name:`id`,label:`Id`,control:`text`,placeholder:`id`},Zq={tip:`var(--ok)`,risk:`var(--danger)`,warning:`var(--danger)`,decision:`var(--accent-2)`},Qq=[{tag:`phase`,label:`Phase`,pickStatus:!0,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Phase title`},Xq],hasChildren:!0},{tag:`callout`,label:`Callout`,pickIcon:!0,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Callout title`},{name:`kind`,label:`Kind`,control:`select`,options:Hq},Xq],hasChildren:!0},{tag:`choice`,label:`Choice`,pickIcon:!0,props:[{name:`prompt`,label:`Prompt`,control:`text`,wide:!0,placeholder:`What should the person pick?`},Xq],hasChildren:!0},{tag:`plan-option`,label:`Option`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Option label`},Xq,{name:`recommended`,label:`Recommended`,control:`flag`}],hasChildren:!0,row:!0},{tag:`plan-form`,label:`Form`,pickIcon:!0,props:[{name:`prompt`,label:`Prompt`,control:`text`,wide:!0,placeholder:`What should the person fill in?`},Xq],hasChildren:!0},{tag:`field`,label:`Field`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Field label`},{name:`name`,label:`Name`,control:`text`,placeholder:`name`},{name:`type`,label:`Type`,control:`select`,options:Uq},{name:`options`,label:`Options`,control:`text`,placeholder:`a, b, c`},{name:`default`,label:`Default`,control:`text`,placeholder:`default`},{name:`required`,label:`Required`,control:`flag`}],hasChildren:!1,row:!0},{tag:`questions`,label:`Questions`,pickIcon:!0,props:[{name:`prompt`,label:`Prompt`,control:`text`,wide:!0,placeholder:`What should the person answer?`},Xq],hasChildren:!0},{tag:`item`,label:`Item`,pickStatus:!0,props:[],hasChildren:!0,row:!0},{tag:`approve`,label:`Approval`,pickIcon:!0,props:[{name:`prompt`,label:`Prompt`,control:`text`,wide:!0,placeholder:`What should the person approve?`},Xq],hasChildren:!0},{tag:`checklist`,label:`Checklist`,icon:`list`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Checklist title`},Xq],hasChildren:!0},{tag:`workflow`,label:`Workflow`,icon:`branch`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Expected execution`},Xq],hasChildren:!0},{tag:`FileTree`,label:`File tree`,icon:`file`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Files touched`}],hasChildren:!0},{tag:`File`,label:`File`,props:[{name:`path`,label:`Path`,control:`text`,wide:!0,placeholder:`src/path/file.ts`},{name:`change`,label:`Change`,control:`select`,options:Wq},{name:`from`,label:`From`,control:`text`,placeholder:`old/path`,when:{name:`change`,is:`renamed`}}],hasChildren:!0,row:!0},{tag:`Endpoint`,label:`API endpoint`,icon:`globe`,props:[{name:`path`,label:`Path`,control:`text`,wide:!0,placeholder:`/api/resource/{id}`},{name:`method`,label:`Method`,control:`select`,options:Gq},{name:`change`,label:`Change`,control:`select`,options:Wq,optional:!0},{name:`auth`,label:`Auth`,control:`text`,placeholder:`API key`},{name:`open`,label:`Open`,control:`flag`}],hasChildren:!0},{tag:`Param`,label:`Param`,props:[{name:`name`,label:`Name`,control:`text`,wide:!0,placeholder:`name`},{name:`in`,label:`In`,control:`select`,options:Kq},{name:`type`,label:`Type`,control:`text`,placeholder:`string`},{name:`required`,label:`Required`,control:`flag`}],hasChildren:!0,row:!0},{tag:`Request`,label:`Request`,props:[],hasChildren:!0,row:!0},{tag:`Response`,label:`Response`,props:[{name:`status`,label:`Status`,control:`text`,wide:!0,placeholder:`200`}],hasChildren:!0,row:!0},{tag:`DataModel`,label:`Data model`,icon:`database`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Tables`}],hasChildren:!0},{tag:`Entity`,label:`Table`,props:[{name:`name`,label:`Name`,control:`text`,wide:!0,placeholder:`table_name`},{name:`change`,label:`Change`,control:`select`,options:Wq,optional:!0},{name:`collapsed`,label:`Folded`,control:`flag`}],hasChildren:!0,row:!0},{tag:`Attr`,label:`Field`,props:[{name:`name`,label:`Name`,control:`text`,wide:!0,placeholder:`column`},{name:`type`,label:`Type`,control:`text`,placeholder:`text`},{name:`fk`,label:`FK`,control:`text`,placeholder:`table.id`},{name:`change`,label:`Change`,control:`select`,options:Wq,optional:!0},{name:`pk`,label:`PK`,control:`flag`},{name:`nullable`,label:`Null`,control:`flag`}],hasChildren:!1,row:!0},{tag:`Relation`,label:`Relation`,props:[{name:`from`,label:`From`,control:`text`,wide:!0,placeholder:`table`},{name:`to`,label:`To`,control:`text`,placeholder:`table`},{name:`kind`,label:`Kind`,control:`select`,options:qq}],hasChildren:!1,row:!0},{tag:`JsonView`,label:`JSON`,icon:`package`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`Response body`},{name:`depth`,label:`Open levels`,control:`text`,placeholder:`2`}],hasChildren:!0},{tag:`AnnotatedCode`,label:`Annotated code`,icon:`file`,props:[{name:`title`,label:`Title`,control:`text`,wide:!0,placeholder:`src/path/file.ts`},{name:`start`,label:`First line`,control:`text`,placeholder:`1`}],hasChildren:!0},{tag:`Note`,label:`Note`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Short label`},{name:`lines`,label:`Lines`,control:`text`,placeholder:`12-14`}],hasChildren:!0,row:!0},{tag:`Tabs`,label:`Tabs`,icon:`list`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`What the tabs show`}],hasChildren:!0},{tag:`Tab`,label:`Tab`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Tab name`}],hasChildren:!0,row:!0},{tag:`Compare`,label:`Compare`,icon:`branch`,props:[],hasChildren:!0},{tag:`Pane`,label:`Pane`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Before`}],hasChildren:!0,row:!0},{tag:`Update`,label:`Update`,icon:`flag`,props:[{name:`by`,label:`By`,control:`text`,wide:!0,placeholder:`Agent`},{name:`health`,label:`Health`,control:`select`,options:Jq,optional:!0},{name:`date`,label:`Date`,control:`text`,placeholder:`YYYY-MM-DD`}],hasChildren:!0},{tag:`Properties`,label:`Properties`,icon:`list`,props:[],hasChildren:!0},{tag:`Prop`,label:`Property`,props:[{name:`label`,label:`Label`,control:`text`,wide:!0,placeholder:`Owner`}],hasChildren:!0,row:!0}];function $q(e,t){for(let n of e.attributes)if(n.type===`mdxJsxAttribute`&&n.name===t)return typeof n.value==`string`?n.value:n.value===null||n.value===void 0?`true`:n.value.value;return``}function eJ(e,t,n){let r=e.attributes.findIndex(e=>e.type===`mdxJsxAttribute`&&e.name===t),i=[...e.attributes];if(n===``)return r>=0&&i.splice(r,1),i;let a={type:`mdxJsxAttribute`,name:t,value:n};return r>=0?i.splice(r,1,a):i.push(a),i}function tJ(e,t){return Object.entries(t).reduce((t,[n,r])=>eJ({...e,attributes:t},n,r),e.attributes)}function nJ({spec:e,value:t,onChange:n,disabled:r=!1}){let i=(0,k.useId)();if(e.control===`flag`)return(0,A.jsxs)(`label`,{className:`plan-editor-flag`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:t===`true`,disabled:r,onChange:e=>n(e.target.checked?`true`:`false`)}),e.label]});if(e.control===`select`){let i=e.optional?[Yq,...e.options??[]]:e.options??[],a=t||(e.optional?Yq:i[0]??``);return(0,A.jsxs)(ut,{value:a,disabled:r,onValueChange:e=>n(e===Yq?``:String(e??``)),children:[(0,A.jsx)(ct,{className:`plan-editor-select`,"aria-label":e.label,children:(0,A.jsx)(ht,{children:e=>e===Yq?`none`:String(e??``)})}),(0,A.jsx)(pt,{className:`plan-editor-select-popup`,children:i.map(e=>(0,A.jsx)(at,{value:e,children:e===Yq?`none`:e},e))})]})}return(0,A.jsx)(`input`,{id:i,className:et(`plan-editor-input`,e.wide&&`plan-editor-input-wide`),"aria-label":e.label,placeholder:e.placeholder,value:t,disabled:r,onChange:e=>n(e.target.value)})}function rJ(){let{parentEditor:e,lexicalNode:t,mdastNode:n}=iR();return r=>{e.update(()=>{H(t.getKey())?.setMdastNode?.({...n,...r})},{discrete:!0,tag:[ac,cc,sc]}),e.dispatchCommand(Hx,void 0)}}function iJ({spec:e,mdastNode:t}){let n=rJ(),r=oR(),i=e.tag===`item`&&$q(t,`done`)===`true`?`done`:void 0,a=gt($q(t,`status`)||i),o=e.tag===`callout`?it($q(t,`kind`)||void 0):void 0,s=(e,r)=>n({attributes:eJ(t,e,r)}),c=o?`${e.label} · ${o}`:e.label,l=(0,k.useRef)(null);VK(l);let u=(0,k.useContext)(LB),d=FB(t),f=d&&PB(t)===!0&&!NB(e.tag),p=u||d,m=(0,k.useMemo)(()=>zB(t),[t]),h=(0,k.useMemo)(()=>d&&!f&&Iq(e.tag)?Rq(t):null,[d,t,e.tag]);if(h)return(0,A.jsxs)(`section`,{className:`plan-editor-locked-card`,"data-editor-entry":e.tag,"data-locked":`true`,"aria-disabled":`true`,ref:l,children:[(0,A.jsxs)(`div`,{className:`plan-editor-locked-note`,children:[(0,A.jsx)($e,{size:12,strokeWidth:2.25,"aria-hidden":`true`}),(0,A.jsx)(`span`,{children:`Answered on the page · it can be moved, not changed`})]}),h]});let g=e=>(0,A.jsx)(nJ,{spec:e,value:$q(t,e.name),disabled:p,onChange:t=>s(e.name,t)});return(0,A.jsxs)(`section`,{className:et(`plan-editor-card`,e.row?`plan-editor-row`:`plan-entry`,e.tag===`callout`&&`plan-callout`),"data-editor-entry":e.tag,"data-kind":o,"data-status":e.pickStatus?a:void 0,"data-locked":p?`true`:void 0,"aria-disabled":p||void 0,children:[f?(0,A.jsxs)(`div`,{className:`plan-editor-locked-note`,children:[(0,A.jsx)($e,{size:12,strokeWidth:2.25,"aria-hidden":`true`}),(0,A.jsx)(`span`,{children:`Locked by the plan · it can be moved, not changed`})]}):null,(0,A.jsxs)(`div`,{className:`plan-editor-head`,ref:l,children:[e.pickStatus?(0,A.jsx)(Vq,{status:a,disabled:p,onChange:r=>e.tag===`item`?n({attributes:tJ(t,{done:r===`done`?`true`:$q(t,`done`)?`false`:``,status:r===`done`||r===`pending`?``:r})}):s(`status`,r)}):null,e.pickIcon&&p?(0,A.jsx)(tt,{icon:$q(t,`icon`)||void 0,color:$q(t,`color`),className:`plan-editor-kicker`,children:c}):e.pickIcon?(0,A.jsx)(BG,{icon:$q(t,`icon`),color:$q(t,`color`),label:c,defaultTint:o?Zq[o]:void 0,onChange:e=>n({attributes:tJ(t,e)})}):(0,A.jsx)(tt,{icon:e.icon,className:`plan-editor-kicker`,children:c}),e.props.filter(e=>e.wide).map(e=>(0,A.jsx)(k.Fragment,{children:g(e)},e.name)),d?(0,A.jsxs)(`span`,{className:`plan-editor-locked`,title:f?`Locked by the plan. It can be moved, not changed.`:`The agent writes this card for people to answer on the page. Move it with its grip.`,children:[(0,A.jsx)($e,{size:12,strokeWidth:2.25,"aria-hidden":`true`}),`Locked`]}):null,(0,A.jsx)(`button`,{type:`button`,className:`plan-editor-remove`,"aria-label":`Remove ${e.label.toLowerCase()}`,title:p?`Locked cards cannot be removed`:m?`It holds a locked card, so it cannot be removed`:`Remove`,disabled:p||m,onClick:r,children:(0,A.jsx)(Xn,{size:14,"aria-hidden":`true`})}),(0,A.jsx)(`div`,{className:`plan-editor-props`,children:e.props.filter(e=>!e.wide).filter(e=>!e.when||$q(t,e.when.name)===e.when.is||$q(t,e.name)!==``).map(e=>e.control===`flag`?(0,A.jsx)(k.Fragment,{children:g(e)},e.name):(0,A.jsxs)(`span`,{className:`plan-editor-prop`,children:[(0,A.jsx)(`span`,{className:`plan-editor-prop-name`,"aria-hidden":`true`,children:e.label}),g(e)]},e.name))})]}),e.hasChildren?(0,A.jsx)(`div`,{className:`plan-editor-body plan-rich`,children:(0,A.jsx)(LB.Provider,{value:p,children:(0,A.jsx)(sR,{block:t.type!==`mdxJsxTextElement`,getContent:e=>e.children,getUpdatedMdastNode:(e,t)=>({...e,children:t})})})}):null]})}function aJ(e){function t({mdastNode:t}){return(0,A.jsx)(iJ,{spec:e,mdastNode:t})}return t.displayName=`${e.label}Editor`,t}function oJ(e){let t=FB(e.mdastNode);return(0,A.jsx)(LB.Provider,{value:t,children:(0,A.jsxs)(`div`,{className:`plan-editor-generic`,"data-locked":t?`true`:void 0,children:[t?(0,A.jsxs)(`div`,{className:`plan-editor-locked-note`,children:[(0,A.jsx)($e,{size:12,strokeWidth:2.25,"aria-hidden":`true`}),(0,A.jsx)(`span`,{children:`Locked by the plan · it can be moved, not changed`})]}):null,(0,A.jsx)(NR,{...e})]})})}var sJ=[...Qq.map(e=>({name:e.tag,kind:`flow`,props:[...e.props.map(e=>e.name),...e.pickIcon?[`icon`,`color`]:[],...e.pickStatus?[`status`]:[]].map(e=>({name:e,type:`string`})),hasChildren:e.hasChildren,Editor:aJ(e)})),{name:`Path`,kind:`text`,props:[`path`,`change`,`lines`].map(e=>({name:e,type:`string`})),hasChildren:!0,Editor:NR},XK,...nq,{name:`*`,kind:`flow`,props:[],hasChildren:!0,Editor:oJ}],cJ=si?k.useLayoutEffect:k.useEffect,lJ=class{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}},uJ=e=>{let t=e.closest(`#typeahead-menu`);if(!t)return;let n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:`center`}),n.top<0&&t.scrollIntoView({block:`center`}),e.scrollIntoView({block:`nearest`})};function dJ(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top>=r.top-6&&n.top<=r.bottom+6}function fJ(e,t,n,r){let[i]=gx();(0,k.useEffect)(()=>{if(t!=null&&e!=null){let e=i.getRootElement(),a=e==null?document.body:Lm(e,!1),o=!1,s=dJ(t,a),c=function(){o||=(window.requestAnimationFrame(function(){n(),o=!1}),!0);let e=dJ(t,a);e!==s&&(s=e,r?.(e))},l=new ResizeObserver(n),u=nf(e??t);return l.observe(t),xm(Ss(window,`resize`,n),Ss(document,`scroll`,c,{capture:!0,passive:!0}),...u.map(e=>Ss(e,`scroll`,c,{capture:!0,passive:!0})),()=>l.unobserve(t))}},[t,i,r,n,e])}var pJ=P(`SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND`);function mJ({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item`;return t&&(a+=` selected`),(0,A.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.icon,(0,A.jsx)(`span`,{className:`text`,children:i.title})]},i.key)}function hJ({close:e,editor:t,anchorElementRef:n,resolution:r,options:i,menuRenderFn:a,onSelectOption:o,shouldSplitNodeWithQuery:s=!1,commandPriority:c=1,preselectFirstItem:l=!0}){let[u,d]=(0,k.useState)(null),f=u===null?null:Math.min(i.length-1,u),p=r.match&&r.match.matchingString;(0,k.useEffect)(()=>{l&&d(0)},[p,l]);let m=(0,k.useCallback)(n=>{t.update(()=>{o(n,r.match!=null&&s?function(e){let t=R();if(!I(t)||!t.isCollapsed())return null;let n=t.anchor;if(n.type!==`text`)return null;let r=n.getNode();if(!r.isSimpleText())return null;let i=n.offset,a=r.getTextContent().slice(0,i),o=e.replaceableString.length,s=i-function(e,t,n){let r=n;for(let n=r;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(r=n);return r}(a,e.matchingString,o);if(s<0)return null;let c;return s===0?[c]=r.splitText(i):[,c]=r.splitText(s,i),c}(r.match):null,e,r.match?r.match.matchingString:``)})},[t,s,r.match,o,e]),h=(0,k.useCallback)(e=>{let n=t.getRootElement();n!==null&&(n.setAttribute(`aria-activedescendant`,`typeahead-item-`+e),d(e))},[t]),g=(0,k.useCallback)(()=>n.current&&i.length?jx.createPortal((0,A.jsx)(`div`,{className:`typeahead-popover mentions-menu`,children:(0,A.jsx)(`ul`,{children:i.map((e,t)=>(0,A.jsx)(mJ,{index:t,isSelected:f===t,onClick:()=>{d(t),m(e)},onMouseEnter:()=>{d(t)},option:e},e.key))})}),n.current):null,[n,i,f,m,d]);(0,k.useEffect)(()=>()=>{let e=t.getRootElement();e!==null&&e.removeAttribute(`aria-activedescendant`)},[t]),cJ(()=>{i===null?d(null):f===null&&l&&h(0)},[i,f,h,l]),(0,k.useEffect)(()=>xm(t.registerCommand(pJ,({option:e})=>!(!e.ref||e.ref.current==null)&&(uJ(e.ref.current),!0),c)),[t,h,c]),(0,k.useEffect)(()=>xm(t.registerCommand(Xo,e=>{let n=e;if(i!==null&&i.length){let e=f===null||f===i.length-1?0:f+1;h(e);let r=i[e];if(!r)return h(-1),n.preventDefault(),n.stopImmediatePropagation(),!0;r.ref&&r.ref.current&&t.dispatchCommand(pJ,{index:e,option:r}),n.preventDefault(),n.stopImmediatePropagation()}return!0},c),t.registerCommand(Yo,e=>{let t=e;if(i!==null&&i.length){let e=f===null||f===0?i.length-1:f-1;h(e);let n=i[e];if(!n)return h(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&uJ(n.ref.current),t.preventDefault(),t.stopImmediatePropagation()}return!0},c),t.registerCommand(es,t=>{let n=t;return n.preventDefault(),n.stopImmediatePropagation(),e(),!0},c),t.registerCommand(ns,e=>{let t=e;return i!==null&&f!==null&&i[f]!=null&&(t.preventDefault(),t.stopImmediatePropagation(),m(i[f]),!0)},c),t.registerCommand(Zo,e=>!(i===null||f===null||i[f]==null||e&&e.shiftKey)&&(e!==null&&(e.preventDefault(),e.stopImmediatePropagation()),m(i[f]),!0),c)),[m,e,t,i,f,h,c]);let _=(0,k.useMemo)(()=>({options:i,selectOptionAndCleanUp:m,selectedIndex:f,setHighlightedIndex:d}),[m,f,i]);return a==null?g():a(n,_,r.match?r.match.matchingString:``)}function gJ(e,t){t!=null&&(e.className=t),e.setAttribute(`aria-label`,`Typeahead menu`),e.setAttribute(`role`,`listbox`),e.style.display=`block`,e.style.position=`absolute`}function _J(e,t,n,r,i=!0){let[a]=gx(),o=r??function(e){if(!si)return;let t=e.getRootElement();if(t!==null){let e=t.getRootNode();return ef(e)?e:t.ownerDocument.body}return document.body}(a),s=si?af(a.getRootElement()).createElement(`div`):null,c=(0,k.useRef)(s),l=(0,k.useCallback)(()=>{if(c.current===null||o===void 0)return;c.current.style.top=c.current.style.bottom;let t=a.getRootElement(),r=c.current,s=r.firstChild;if(t!==null&&e!==null){let{left:a,top:l,width:u,height:d}=e.getRect(),f=c.current.offsetHeight;if(r.style.top=`${l+f+3+(i?window.pageYOffset:0)}px`,r.style.left=`${a+window.pageXOffset}px`,r.style.height=`${d}px`,r.style.width=`${u}px`,s!==null){s.style.top=`${l}`;let e=s.getBoundingClientRect(),n=e.height,o=e.width,c=t.getBoundingClientRect();a+o>c.right&&(r.style.left=`${c.right-o+window.pageXOffset}px`),(l+n>window.innerHeight||l+n>c.bottom)&&l-c.top>n+d&&(r.style.top=`${l-n-d+(i?window.pageYOffset:0)}px`)}r.isConnected||(gJ(r,n),o.append(r)),r.setAttribute(`id`,`typeahead-menu`),t.setAttribute(`aria-controls`,`typeahead-menu`)}},[a,e,i,n,o]);(0,k.useEffect)(()=>{let t=a.getRootElement();return e!==null&&l(),()=>{t!==null&&t.removeAttribute(`aria-controls`);let e=c.current;e!==null&&e.isConnected&&(e.remove(),e.removeAttribute(`id`))}},[a,l,e]);let u=(0,k.useCallback)(n=>{e!==null&&(n||t(null))},[e,t]);return fJ(e,c.current,l,u),s!=null&&s===c.current&&(gJ(s,n),o?.append(s)),c}var vJ=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function yJ(e,{minLength:t=1,maxLength:n=75,punctuation:r=vJ,allowWhitespace:i=!1}){return(0,k.useCallback)(a=>{let o=RegExp(`(^|\\s|\\()([`+e+`]((?:`+(`[^`+e+r+(i?``:`\\s`)+`]`)+`){0,`+n+`}))$`).exec(a);if(o!==null){let e=o[1],n=o[3];if(n.length>=t)return{leadOffset:o.index+e.length,matchingString:n,replaceableString:o[2]}}return null},[i,e,r,n,t])}function bJ({options:e,onQueryChange:t,onSelectOption:n,onOpen:r,onClose:i,menuRenderFn:a,triggerFn:o,anchorClassName:s,commandPriority:c=1,parent:l,preselectFirstItem:u=!0,ignoreEntityBoundary:d=!1}){let[f]=gx(),[p,m]=(0,k.useState)(null),h=_J(p,m,s,l),g=(0,k.useCallback)(()=>{if(p===null)return;let e=()=>{m(null)},t;try{t=i&&i()}finally{t?t.then(e,e):e()}},[i,p]),_=(0,k.useCallback)(e=>{m(e),r!=null&&p===null&&r(e)},[r,p]);return(0,k.useEffect)(()=>{let e=f.registerUpdateListener(()=>{f.read(`latest`,()=>{if(!f.isEditable())return void g();if(f.isComposing())return;let e=f._window||window,n=e.document.createRange(),r=R(),i=function(e){let t=null;return e.read(`latest`,()=>{let e=R();I(e)&&(t=function(e){let t=e.anchor;if(t.type!==`text`)return null;let n=t.getNode();if(!n.isSimpleText())return null;let r=t.offset;return n.getTextContent().slice(0,r)}(e))}),t}(f);if(!I(r)||!r.isCollapsed()||i===null||n===null)return void g();let a=o(i,f);if(t(a?a.matchingString:null),a!==null&&(d||!function(e,t){return t===0&&e.read(`latest`,()=>{let e=R();if(I(e)){let t=e.anchor.getNode().getPreviousSibling();return F(t)&&t.isTextEntity()}return!1})}(f,a.leadOffset))&&function(e,t,n,r){let i=Qd(n);if(i===null||!i.isCollapsed)return!1;let a=lf(i,r),o=a.anchorNode,s=e,c=a.anchorOffset;if(o==null||c==null)return!1;try{t.setStart(o,s),t.setEnd(o,c)}catch{return!1}return!0}(a.leadOffset,n,e,f.getRootElement())!==null)return void(0,k.startTransition)(()=>_({getRect:()=>n.getBoundingClientRect(),match:a}));g()})});return()=>{e()}},[f,o,t,p,g,_,d]),(0,k.useEffect)(()=>f.registerEditableListener(e=>{e||g()}),[f,g]),p===null||f===null||h.current===null?null:(0,A.jsx)(hJ,{close:g,resolution:p,editor:f,anchorElementRef:h,options:e,menuRenderFn:a,shouldSplitNodeWithQuery:!0,onSelectOption:n,commandPriority:c,preselectFirstItem:u})}var xJ=/^(?:javascript|vbscript|data|file):/i,SJ=/^data:image\/(?:png|jpe?g|gif|webp|avif|svg\+xml);/i,CJ=/^[a-z][a-z0-9+.-]*:/i,wJ=/^(?:\/|#|\?|\.\.?\/)/;function TJ(e,t){let n=e.trim();return n?/\s/.test(n)?{ok:!1,reason:`An address has no spaces.`}:t===`image`&&SJ.test(n)?{ok:!0,url:n}:xJ.test(n)?{ok:!1,reason:`Use an http or https address.`}:CJ.test(n)||wJ.test(n)?{ok:!0,url:n}:{ok:!0,url:`https://${n}`}:{ok:!1,reason:t===`image`?`Paste the image address.`:`Paste the link address.`}}function EJ(e){if(SJ.test(e)||wJ.test(e))return!0;let t;try{t=new URL(e)}catch{return!1}if(t.protocol!==`https:`&&t.protocol!==`http:`)return!1;let n=/^https?:\/\/(?:[^@/?#]*@)?(\[[^\]]*\]|[^/:?#]+)/i.exec(e)?.[1]?.toLowerCase()??``;return n===`localhost`||/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n)||/\.[a-z]{2,}$/i.test(n)}var DJ={link:{title:`Link`,url:`Address`,text:`Text`,textHint:`Shown instead of the address (optional)`,submit:`Add link`},image:{title:`Image`,url:`Image address`,text:`Description`,textHint:`Read aloud and shown if the image does not load`,submit:`Add image`}};function OJ({kind:e,anchor:t,onSubmit:n,onCancel:r}){let i=DJ[e],a=(0,k.useId)(),o=(0,k.useRef)(null),[s,c]=(0,k.useState)(``),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(!1),[p,m]=(0,k.useState)(!1),[h,g]=(0,k.useState)(null),_=TJ(s,e),v=e===`image`&&_.ok?_.url:null;(0,k.useEffect)(()=>{if(g(null),m(!1),!v||!EJ(v))return;let e=setTimeout(()=>g(v),450);return()=>clearTimeout(e)},[v]);let y=(0,k.useMemo)(()=>({getBoundingClientRect:()=>t}),[t]);return(0,A.jsx)(Nt,{open:!0,onOpenChange:e=>e?void 0:r(),children:(0,A.jsx)(jt,{className:`plan-insert-prompt`,anchor:y,side:`bottom`,align:`start`,sideOffset:8,collisionPadding:12,initialFocus:o,"data-insert-prompt":e,children:(0,A.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(!0),_.ok?n({url:_.url,text:l.trim()}):o.current?.focus()},noValidate:!0,children:[(0,A.jsx)(`div`,{className:`plan-insert-prompt-title`,children:i.title}),(0,A.jsxs)(`label`,{className:`plan-insert-prompt-field`,htmlFor:`${a}-url`,children:[(0,A.jsx)(`span`,{children:i.url}),(0,A.jsx)(`input`,{id:`${a}-url`,ref:o,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://`,value:s,"aria-invalid":d&&!_.ok,"aria-describedby":d&&!_.ok?`${a}-error`:void 0,"data-insert-url":``,onChange:e=>c(e.target.value)})]}),d&&!_.ok?(0,A.jsx)(`p`,{className:`plan-insert-prompt-error`,id:`${a}-error`,role:`alert`,children:_.reason}):null,(0,A.jsxs)(`label`,{className:`plan-insert-prompt-field`,htmlFor:`${a}-text`,children:[(0,A.jsx)(`span`,{children:i.text}),(0,A.jsx)(`input`,{id:`${a}-text`,type:`text`,autoComplete:`off`,placeholder:i.textHint,value:l,"data-insert-text":``,onChange:e=>u(e.target.value)})]}),h?(0,A.jsx)(`div`,{className:`plan-insert-prompt-preview`,"data-broken":p?`true`:void 0,children:p?(0,A.jsx)(`span`,{children:`This address does not load as an image here. You can still add it.`}):(0,A.jsx)(`img`,{src:h,alt:``,onError:()=>m(!0)})}):null,(0,A.jsxs)(`div`,{className:`plan-insert-prompt-actions`,children:[(0,A.jsx)(`button`,{type:`button`,className:`plan-btn plan-btn-secondary`,onClick:r,children:`Cancel`}),(0,A.jsx)(`button`,{type:`submit`,className:`plan-btn plan-btn-primary`,"data-insert-submit":``,children:i.submit})]})]})})})}var kJ=[`Text`,`Links and media`,`Labels`,`Code`,`Cards`,`Data`,`Layout`,`In this card`];function AJ(e){return`${e}-${Math.random().toString(36).slice(2,6)}`}function jJ(e){return{type:`paragraph`,children:[{type:`text`,value:e}]}}function MJ(e){return Object.entries(e).map(([e,t])=>({type:`mdxJsxAttribute`,name:e,value:t}))}function $(e,t,n=[]){return{type:`mdxJsxFlowElement`,name:e,attributes:MJ(t),children:n}}function NJ(e,t){return{type:`code`,lang:e,value:t}}function PJ(e,t,n,r,i,a){return{key:e,section:`In this card`,label:n,hint:r,icon:i,keywords:[e,n.toLowerCase()],nested:!0,parents:[t],build:a}}function FJ(e){return(0,A.jsx)(e,{size:16,strokeWidth:2})}var IJ=[wn,En,On,An,Mn,Pn];function LJ(e){let t=`h${e}`;return{key:t,section:`Text`,label:`Heading ${e}`,hint:e===1?`The largest title`:e===6?`The smallest title`:`A level ${e} title`,icon:FJ(IJ[e-1]),keywords:[t,`heading`,`heading${e}`,`title`,`#`.repeat(e)],block:()=>J_(t)}}function RJ(e,t,n,r=!1){return{key:`callout-${e}`,section:`Cards`,agentOnly:r,label:n,hint:`A ${e} callout`,icon:t,keywords:[`callout`,e],build:()=>$(`callout`,{id:AJ(e),kind:e,title:`New ${n.toLowerCase()}`,icon:t},[jJ(`Write the note here.`)])}}var zJ=[{key:`text`,section:`Text`,label:`Text`,hint:`A paragraph to write in`,icon:FJ(Qn),keywords:[`text`,`paragraph`,`plain`],block:()=>V()},...[1,2,3,4,5,6].map(LJ),{key:`quote`,section:`Text`,label:`Quote`,hint:`Quoted text, shown set apart`,icon:FJ(Hn),keywords:[`quote`,`blockquote`,`citation`,`>`],block:()=>H_()},{key:`link`,section:`Links and media`,label:`Link`,hint:`A link to a web address`,icon:FJ(Rn),keywords:[`link`,`url`,`href`,`web`],prompt:`link`},{key:`image`,section:`Links and media`,label:`Image`,hint:`An image from a web address`,icon:FJ(In),keywords:[`image`,`picture`,`photo`,`img`,`screenshot`],prompt:`image`},{key:`chip`,section:`Labels`,label:`Chip`,hint:`A small label inside a sentence`,icon:FJ(Jn),keywords:[`chip`,`label`,`tag`,`inline`],inline:{name:`Chip`,props:{},text:`label`}},{key:`pill`,section:`Labels`,label:`Pill`,hint:`A status label; its dot changes the tone`,icon:FJ(vn),keywords:[`pill`,`label`,`status`,`badge`,`tone`,`inline`],inline:{name:`Pill`,props:{tone:`success`},text:`status`}},{key:`code`,section:`Code`,label:`Code`,hint:`A code block with syntax highlighting`,icon:FJ(bn),keywords:[`code`,`snippet`,`fence`,`block`],fence:{language:`ts`,code:``}},{key:`mermaid`,section:`Code`,label:`Mermaid`,hint:`A diagram drawn from mermaid code`,icon:FJ(er),keywords:[`mermaid`,`diagram`,`chart`,`flowchart`],fence:{language:`mermaid`,code:`flowchart LR
158
+ A[Start] --> B[Finish]`}},{key:`phase`,section:`Cards`,label:`Phase`,hint:`A step of the work, with a status`,icon:`flag`,keywords:[`phase`,`step`,`status`],build:()=>$(`phase`,{id:AJ(`phase`),title:`New phase`,status:`pending`},[jJ(`Describe the work in this phase.`)])},RJ(`note`,`info`,`Note`),RJ(`tip`,`idea`,`Tip`),RJ(`risk`,`alert`,`Risk`),RJ(`decision`,`decision`,`Decision`,!0),RJ(`warning`,`shield`,`Warning`),{key:`choice`,section:`Cards`,agentOnly:!0,label:`Choice`,hint:`The person picks one option`,icon:`decision`,keywords:[`choice`,`pick`,`option`,`radio`],build:()=>$(`choice`,{id:AJ(`choice`),prompt:`Which option should we take?`},[$(`plan-option`,{id:`a`,label:`Option A`},[jJ(`What option A means.`)]),$(`plan-option`,{id:`b`,label:`Option B`},[jJ(`What option B means.`)])])},{key:`form`,section:`Cards`,agentOnly:!0,label:`Form`,hint:`Fields the person fills in`,icon:`file`,keywords:[`form`,`field`,`input`],build:()=>$(`plan-form`,{id:AJ(`form`),prompt:`Fill in the details`},[$(`field`,{name:`value`,label:`Value`,type:`text`})])},{key:`questions`,section:`Cards`,agentOnly:!0,label:`Questions`,hint:`Free-text answers, one per item`,icon:`help`,keywords:[`questions`,`ask`,`answer`],build:()=>$(`questions`,{id:AJ(`questions`),prompt:`Anything the agent should know?`},[$(`item`,{},[jJ(`First question?`)])])},{key:`approve`,section:`Cards`,agentOnly:!0,label:`Approval`,hint:`A yes or no gate`,icon:`check`,keywords:[`approve`,`approval`,`gate`,`yes`,`no`],build:()=>$(`approve`,{id:AJ(`approve`),prompt:`Proceed?`},[jJ(`What happens after approval.`)])},{key:`checklist`,section:`Cards`,label:`Checklist`,hint:`Lines the agent ticks off`,icon:`list`,keywords:[`checklist`,`todo`,`done`],build:()=>$(`checklist`,{id:AJ(`checklist`),title:`Done when`},[$(`item`,{done:`false`},[jJ(`First check`)])])},{key:`update`,section:`Cards`,label:`Update`,hint:`A dated status note with a health level`,icon:`flag`,keywords:[`update`,`status`,`health`,`progress`,`report`],build:()=>$(`Update`,{health:`on-track`,by:`Agent`,date:new Date().toISOString().slice(0,10)},[jJ(`What changed since the last update.`)])},{key:`annotated-code`,section:`Code`,label:`Annotated code`,hint:`Code with numbered notes on its lines`,icon:`file`,keywords:[`annotated`,`code`,`notes`,`walkthrough`,`explain`],build:()=>$(`AnnotatedCode`,{title:`src/file.ts`},[NJ(`ts`,`export function example() {
159
+ return true
160
+ }`),$(`Note`,{lines:`2`,label:`Why`},[jJ(`What this line does.`)])])},{key:`json`,section:`Code`,label:`JSON`,hint:`A payload you can fold`,icon:`package`,keywords:[`json`,`payload`,`response`,`body`,`object`],build:()=>$(`JsonView`,{title:`Response`},[NJ(`json`,`{
161
+ "ok": true
162
+ }`)])},{key:`file-tree`,section:`Data`,label:`File tree`,hint:`Files a change adds, edits, or removes`,icon:`file`,keywords:[`file`,`tree`,`files`,`paths`,`changes`,`touched`],build:()=>$(`FileTree`,{title:`Files touched`},[$(`File`,{path:`src/new-file.ts`,change:`added`},[jJ(`What this file does.`)]),$(`File`,{path:`src/existing.ts`,change:`modified`},[jJ(`What changes here.`)])])},{key:`endpoint`,section:`Data`,label:`API endpoint`,hint:`Method, path, params, and responses`,icon:`globe`,keywords:[`api`,`endpoint`,`route`,`http`,`rest`,`request`],build:()=>$(`Endpoint`,{method:`GET`,path:`/api/resource/{id}`,change:`added`},[jJ(`What the endpoint does.`),$(`Param`,{name:`id`,in:`path`,type:`string`,required:`true`},[jJ(`Which resource.`)]),$(`Response`,{status:`200`},[jJ(`The resource.`)]),$(`Response`,{status:`404`},[jJ(`No resource with this id.`)])])},{key:`data-model`,section:`Data`,label:`Data model`,hint:`Tables, fields, keys, and relations`,icon:`database`,keywords:[`data`,`model`,`schema`,`table`,`database`,`entity`],build:()=>$(`DataModel`,{title:`Tables`},[$(`Entity`,{name:`items`,change:`added`},[$(`Attr`,{name:`id`,type:`text`,pk:`true`}),$(`Attr`,{name:`created_at`,type:`timestamptz`})])])},{key:`table`,section:`Data`,label:`Table`,hint:`Rows and columns`,icon:`list`,keywords:[`table`,`grid`,`rows`,`columns`,`matrix`],table:{rows:3,columns:3}},{key:`data-table`,section:`Data`,label:`Data table`,hint:`Columns that search, sort, and filter`,icon:FJ(Kn),keywords:[`datatable`,`data`,`table`,`grid`,`rows`,`columns`,`sort`,`filter`,`search`],build:zK},{key:`bar-chart`,section:`Data`,label:`Bar chart`,hint:`One bar per label and value`,icon:`zap`,keywords:[`chart`,`bar`,`graph`,`numbers`],build:()=>$(`BarChart`,{ariaLabel:`New chart`},[jJ(`First, 3
163
+ Second, 5
164
+ Third, 2`)])},{key:`line-chart`,section:`Data`,label:`Line chart`,hint:`A value over time`,icon:`zap`,keywords:[`chart`,`line`,`trend`,`graph`,`time`],build:()=>$(`LineChart`,{ariaLabel:`New chart`},[jJ(`Mon, 3
165
+ Tue, 5
166
+ Wed, 4`)])},{key:`tabs`,section:`Layout`,label:`Tabs`,hint:`One view at a time`,icon:`list`,keywords:[`tabs`,`tab`,`views`],build:()=>$(`Tabs`,{},[$(`Tab`,{label:`First`},[jJ(`What the first tab shows.`)]),$(`Tab`,{label:`Second`},[jJ(`What the second tab shows.`)])])},{key:`compare`,section:`Layout`,label:`Compare`,hint:`Before and after, side by side`,icon:`branch`,keywords:[`compare`,`before`,`after`,`side`,`columns`],build:()=>$(`Compare`,{},[$(`Pane`,{label:`Before`},[jJ(`How it works today.`)]),$(`Pane`,{label:`After`},[jJ(`How it works after the change.`)])])},{key:`properties`,section:`Layout`,label:`Properties`,hint:`Labels and values: owner, flag, dates`,icon:`list`,keywords:[`properties`,`props`,`facts`,`meta`,`owner`],build:()=>$(`Properties`,{},[$(`Prop`,{label:`Owner`},[jJ(`Team or person`)]),$(`Prop`,{label:`Target`},[jJ(`Date`)])])},PJ(`file`,`FileTree`,`File`,`One more file`,`file`,()=>$(`File`,{path:`src/file.ts`,change:`modified`},[jJ(`What changes here.`)])),PJ(`param`,`Endpoint`,`Param`,`One more parameter`,`key`,()=>$(`Param`,{name:`name`,in:`query`,type:`string`},[jJ(`What it sets.`)])),PJ(`request`,`Endpoint`,`Request`,`An example request body`,`message`,()=>$(`Request`,{},[NJ(`json`,`{
167
+ "name": "value"
168
+ }`)])),PJ(`response`,`Endpoint`,`Response`,`One more response`,`message`,()=>$(`Response`,{status:`400`},[jJ(`When it happens.`)])),PJ(`entity`,`DataModel`,`Entity`,`One more table in the model`,`database`,()=>$(`Entity`,{name:`table_name`},[$(`Attr`,{name:`id`,type:`text`,pk:`true`})])),PJ(`attr`,`Entity`,`Field`,`One more field`,`key`,()=>$(`Attr`,{name:`column`,type:`text`})),PJ(`relation`,`DataModel`,`Relation`,`How two tables link`,`branch`,()=>$(`Relation`,{from:`parent`,to:`child`,kind:`1-n`})),PJ(`note`,`AnnotatedCode`,`Note`,`A note on a line`,`message`,()=>$(`Note`,{lines:`1`},[jJ(`What this line does.`)])),PJ(`tab`,`Tabs`,`Tab`,`One more tab`,`list`,()=>$(`Tab`,{label:`New tab`},[jJ(`What this tab shows.`)])),PJ(`pane`,`Compare`,`Pane`,`One more pane`,`branch`,()=>$(`Pane`,{label:`New pane`},[jJ(`What this pane shows.`)])),PJ(`prop`,`Properties`,`Property`,`One more label and value`,`list`,()=>$(`Prop`,{label:`Label`},[jJ(`Value`)])),{key:`option`,section:`In this card`,parents:[`choice`],label:`Option`,hint:`One more option for a choice`,icon:`branch`,keywords:[`option`],nested:!0,build:()=>$(`plan-option`,{id:AJ(`option`),label:`New option`},[jJ(`What this option means.`)])},{key:`field`,section:`In this card`,parents:[`plan-form`],label:`Field`,hint:`One more field for a form`,icon:`wrench`,keywords:[`field`,`input`],nested:!0,build:()=>$(`field`,{name:AJ(`field`),label:`New field`,type:`text`})},{key:`item`,section:`In this card`,parents:[`checklist`,`questions`],label:`Item`,hint:`A question or checklist line`,icon:`message`,keywords:[`item`,`line`,`question`],nested:!0,build:()=>$(`item`,{},[jJ(`New item`)])}];function BJ(e){let t=R();if(I(t)&&H(t.anchor.key)!==null&&H(t.focus.key)!==null)return;let n=e?H(e):null;z(n)?n.selectEnd():fd(null)}function VJ(){let e=R();if(!I(e)||!e.isCollapsed())return;let t=e.anchor.getNode();if(!F(t))return;let n=e.anchor.offset,r=t.getTextContent().slice(0,n),i=r.lastIndexOf(`/`);i>=0&&/^\/\S*$/.test(r.slice(i))&&(i===0||/\s/.test(r[i-1]??``))&&t.spliceText(i,n-i,``,!0)}function HJ(){let e=R();if(!I(e)||!e.isCollapsed())return;let t=e.anchor.getNode(),n=e.anchor.offset;F(t)&&n===t.getTextContentSize()&&n!==0&&/\s/.test(t.getTextContent()[n-1]??``)&&t.spliceText(n-1,1,``,!0)}function UJ(e,t){let n=XR({code:t.code,language:t.language,meta:``}),r=e?H(e):null;fd(null),Ou(r)&&r.getTextContent()===``?r.replace(n):r?r.insertAfter(n):U().append(n),EG(n.getKey())}function WJ(){let e=R();if(!I(e))return null;let{key:t,offset:n,type:r}=e.anchor;return{key:t,offset:n,type:r}}function GJ(e,t){if(e&&H(e.key)){let t=ul();t.anchor.set(e.key,e.offset,e.type),t.focus.set(e.key,e.offset,e.type),fd(t);return}let n=t?H(t):null;z(n)?n.selectEnd():U().selectEnd()}function KJ(e,t){let n=R();if(I(n)){if(e===`link`){let e=oj(t.url);e.append(jc(t.text||t.url)),n.insertNodes([e])}else n.insertNodes([_L({src:t.url,altText:t.text})])}}function qJ(e,t){return((t?e.getElementByKey(t):null)??e.getRootElement())?.getBoundingClientRect()??new DOMRect(16,16,0,0)}var JJ=class extends lJ{card;constructor(e){super(e.key),this.card=e}},YJ=new Set([`DataTable`,`FileTree`,`File`,`Endpoint`,`Param`,`Request`,`Response`,`DataModel`,`Entity`,`Attr`,`Relation`,`JsonView`,`AnnotatedCode`,`Note`,`Properties`,`Prop`]),XJ=[`Text`,`Links and media`,`Labels`,`Code`,`In this card`];function ZJ(e,t,n){let r=n!=null&&YJ.has(n),i=t=>e&&t===`In this card`?-1:kJ.indexOf(t);return zJ.map((e,t)=>({card:e,index:t})).filter(({card:i})=>!i.agentOnly&&(e||!i.nested)&&(!i.parents||n!=null&&i.parents.includes(n))&&(!r||XJ.includes(i.section))&&$J(i,t)).sort((e,t)=>i(e.card.section)-i(t.card.section)||e.index-t.index).map(({card:e})=>new JJ(e))}function QJ(){let e=R();if(!I(e)||!e.isCollapsed())return null;let t=e.anchor.getNode();if(!F(t))return null;let n=/(?:^|\s)\/(\S{0,24})$/.exec(t.getTextContent().slice(0,e.anchor.offset));return n?n[1]??``:null}function $J(e,t){if(!t)return!0;let n=t.toLowerCase();return e.label.toLowerCase().includes(n)||e.keywords.some(e=>e.startsWith(n))}function eY({nested:e,parent:t}){let[n]=gx(),r=Yr(LR),i=Yr(QA),a=Yr(Wx),[o,s]=(0,k.useState)(null),[c,l]=(0,k.useState)(0),u=(0,k.useRef)(!1),d=(0,k.useRef)(0),f=(0,k.useRef)(null),p=(0,k.useRef)(null),m=(0,k.useRef)(!1),h=(0,k.useRef)(0),g=(0,k.useRef)(null);(0,k.useEffect)(()=>{let e=requestAnimationFrame(()=>{let e=g.current;e?.isConnected&&e.scrollTop!==h.current&&(e.scrollTop=h.current)});return()=>cancelAnimationFrame(e)});let[_,v]=(0,k.useState)(null),y=yJ(`/`,{minLength:0,maxLength:24}),b=(0,k.useCallback)((n,r)=>{let i=y(n,r);return i&&ZJ(e,i.matchingString,t).length>0?i:null},[y,e,t]),x=(0,k.useMemo)(()=>ZJ(e,o??``,t),[e,o,t]);(0,k.useEffect)(()=>n.registerCommand(es,()=>{let e=R();if(!I(e))return!1;let t=e.anchor.getNode().getTopLevelElement();return Ou(t)&&t.getTextContent()===`/`&&(t.clear(),t.select()),!1},2),[n]);let S=(0,k.useCallback)(e=>{let t=new Set(n.getEditorState().read(()=>U().getChildrenKeys())),r=n.registerUpdateListener(({editorState:a})=>{let o=a.read(()=>U().getChildren().find(e=>B(e)&&!t.has(e.getKey()))?.getKey()??null);o&&(r(),clearTimeout(i),n.update(()=>{let n=H(o)?.getPreviousSibling();n&&(n.getKey()===e()||!t.has(n.getKey()))&&Ou(n)&&n.getTextContent()===``&&n.remove()}))}),i=setTimeout(r,1e3)},[n]),C=(0,k.useCallback)(e=>{let t=e=>z(e)?e.getChildren().filter(e=>B(e)).map(e=>e.getKey()):[],r=new Set(n.getEditorState().read(()=>t(e()?H(e()):null))),i=n.registerUpdateListener(({editorState:o})=>{let s=o.read(()=>t(e()?H(e()):null).find(e=>!r.has(e))??null);s&&(i(),clearTimeout(a),setTimeout(()=>requestAnimationFrame(()=>{n.update(()=>{H(s)?.selectNext()}),n.focus()})))}),a=setTimeout(i,1e3)},[n]),w=(0,k.useRef)(()=>{});(0,k.useEffect)(()=>{let r=r=>{if(!u.current)return!1;let i=n.getEditorState().read(QJ);if(i===null)return!1;let a=ZJ(e,i,t)[i===f.current?d.current:0];return a?(r?.preventDefault(),r?.stopImmediatePropagation(),w.current(a,i),!0):!1},i=n.registerCommand(Zo,r,3),a=n.registerCommand(ns,r,3);return()=>{i(),a()}},[n,e,t]);let T=(0,k.useCallback)((e,o,s)=>{let{build:c,fence:l,block:u,prompt:d,table:f,inline:p}=e.card,m=null,h=null;if(n.update(()=>{let e=R();I(e)&&(m=e.anchor.getNode().getTopLevelElement()?.getKey()??null),o?.remove(),BJ(m),VJ(),l?UJ(m,l):u?(HJ(),km(R(),u)):d&&(h=WJ())},{discrete:!0}),s(),d){requestAnimationFrame(()=>v({kind:d,point:h,line:m,anchor:qJ(n,m)}));return}if(f){a(n),i(f),S(()=>m);return}if(p){a(n),C(()=>m),r({kind:`text`,name:p.name,props:p.props,children:[{type:`text`,value:p.text}]}),t!==void 0&&n.dispatchCommand(Hx,void 0);return}if(l||!c)return;let g=c();a(n),r({kind:`flow`,name:g.name??``,props:Object.fromEntries(g.attributes.flatMap(e=>e.type===`mdxJsxAttribute`&&typeof e.value==`string`?[[e.name,e.value]]:[])),children:g.children}),S(()=>m)},[n,r,i,S,a,t,C]);w.current=(e,t)=>{u.current=!1;let n=0,r=()=>{let i=f.current===t?p.current:null;i?i(e):n++<3?requestAnimationFrame(r):T(e,null,()=>{})};r()};let E=e=>{_&&(v(null),n.update(()=>{GJ(_.point,_.line),e&&KJ(_.kind,e)},{discrete:!0}),n.focus(),e&&n.dispatchCommand(Hx,void 0))};return(0,A.jsxs)(A.Fragment,{children:[_?(0,A.jsx)(OJ,{kind:_.kind,anchor:_.anchor,onSubmit:e=>E(e),onCancel:()=>E(null)}):null,(0,A.jsx)(bJ,{onQueryChange:e=>{e===null&&u.current&&l(e=>e+1),u.current=e!==null,e===null&&(p.current=null,m.current=!1,h.current=0),s(e)},onSelectOption:T,triggerFn:b,options:x,menuRenderFn:(e,{selectedIndex:t,selectOptionAndCleanUp:n,setHighlightedIndex:r})=>(d.current=t??0,f.current=o,p.current=n,e.current&&o!==null&&x.length>0?(0,jx.createPortal)((0,A.jsx)(`div`,{className:`plan-slash-menu`,role:`listbox`,"aria-label":`Add a block`,"data-plan-grab-ignore":``,"data-shown":m.current?``:void 0,ref:g,onAnimationEnd:e=>{e.target===e.currentTarget&&(m.current=!0,e.currentTarget.setAttribute(`data-shown`,``))},onScroll:e=>{e.currentTarget.isConnected&&(h.current=e.currentTarget.scrollTop)},children:x.map((e,i)=>(0,A.jsxs)(k.Fragment,{children:[e.card.section===x[i-1]?.card.section?null:(0,A.jsx)(`div`,{className:`plan-slash-section`,role:`presentation`,"data-slash-section":e.card.section,children:e.card.section}),(0,A.jsxs)(`div`,{ref:t=>e.setRefElement(t),role:`option`,"aria-selected":t===i,className:`plan-slash-item`,"data-slash-card":e.card.key,onMouseEnter:()=>r(i),onMouseDown:t=>{t.preventDefault(),r(i),n(e)},children:[(0,A.jsx)(tt,{icon:e.card.icon,children:e.card.label}),(0,A.jsx)(`span`,{className:`plan-slash-hint`,children:e.card.hint})]})]},e.key))}),e.current):null)},c)]})}function tY(){return(0,A.jsx)(eY,{nested:!1})}function nY(){let e=(0,k.useContext)(rR)?.mdastNode?.name??null;return(0,A.jsx)(eY,{nested:!0,parent:e})}var rY=ii({init(e){e.pubIn({[KS]:tY,[ZS]:nY})}}),iY=`data-slash-hint`;function aY(){let[e]=gx();return(0,k.useEffect)(()=>{let t=null,n=()=>{t?.removeAttribute(iY),t=null},r=()=>{let r=e.getEditorState().read(()=>{let e=R();if(!I(e)||!e.isCollapsed())return null;let t=e.anchor.getNode(),n=Ou(t)?t:t.getParent();return!Ou(n)||n.getChildrenSize()>0?null:Gd(n.getParent())?n.getKey():null}),i=e.getRootElement(),a=document.activeElement,o=i!==null&&a!==null&&(i===a||i.contains(a)),s=r&&o?e.getElementByKey(r):null;s!==t&&(n(),s&&(s.setAttribute(iY,``),t=s))},i=e.registerUpdateListener(r),a=e.registerCommand(vs,()=>(requestAnimationFrame(r),!1),1),o=e.registerCommand(ys,()=>(n(),!1),1);return()=>{i(),a(),o(),n()}},[e]),null}var oY=ii({init(e){e.pubIn({[KS]:aY,[ZS]:aY})}});function sY(){let e=R();return L(e)?e.getNodes().some(BB):!I(e)||e.isCollapsed()?!1:e.getNodes().some(BB)}function cY(e){let t=R();if(!I(t)||!t.isCollapsed())return null;let{anchor:n}=t,r=n.getNode(),i=r.getTopLevelElement();if(!i)return null;if(e){let e=i.getFirstDescendant()??i;return n.offset===0&&(r.is(i)||r.is(e))?i:null}let a=i.getLastDescendant()??i,o=r.is(i)?i.getChildrenSize():r.getTextContentSize();return n.offset===o&&(r.is(i)||r.is(a))?i:null}function lY(e){let t=cY(e),n=e?t?.getPreviousSibling():t?.getNextSibling();if(!t||!BB(n))return!1;if(t.getTextContent()===``&&z(t)){let n=t.getPreviousSibling(),r=t.getNextSibling();t.remove(),e?z(r)?r.selectStart():fd(null):z(n)?n.selectEnd():fd(null)}return!0}function uY(){let[e]=gx();return(0,k.useEffect)(()=>{let t=e=>(e?.preventDefault?.(),!0),n=(n,r)=>e.registerCommand(n,e=>r(e)?t(e):!1,4),r=[n($o,()=>sY()||lY(!0)),n(ts,()=>sY()||lY(!1)),n(Mo,e=>sY()||lY(e)),n(Lo,()=>sY()),n(fs,()=>sY()),n(Io,()=>sY()),n(os,()=>sY()),n(Fo,()=>sY())];return()=>{for(let e of r)e()}},[e]),null}function dY(){let[e]=gx(),t=(0,k.useContext)(LB);return(0,k.useEffect)(()=>{e.isEditable()!==!t&&e.setEditable(!t)},[e,t]),null}function fY(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(uY,{}),(0,A.jsx)(dY,{})]})}var pY=ii({init(e){e.pubIn({[KS]:uY,[ZS]:fY})}}),{code:mY,...hY}=mx.text??{},gY={...mx,text:hY};function _Y(e){return e===`add_row`||e===`add_column`?(0,A.jsx)(rt,{size:10,strokeWidth:2.5,"aria-hidden":`true`}):EC[e]}function vY(){return[JC(),gw(),nR(),aw(),Bj(),UL({disableImageResize:!0,disableImageSettingsButton:!0}),$A(),nz({codeBlockEditorDescriptors:[PG]}),BR({jsxComponentDescriptors:sJ}),YK(),rY(),oY(),pY(),tV(),bB()]}function yY(e){(0,k.useEffect)(()=>{let t=e.current;if(!t)return;let n=0,r=window.scrollY,i=()=>{n=performance.now(),r=window.scrollY},a=()=>{if(performance.now()-n>600)return;let e=document.activeElement;if(!(e instanceof HTMLElement)||!t.contains(e))return;let i=bY(e);(i.bottom<0||i.top>window.innerHeight)&&window.scrollTo(0,r)};for(let e of[`keydown`,`beforeinput`,`input`])t.addEventListener(e,i,!0);return window.addEventListener(`scroll`,a,{passive:!0}),()=>{for(let e of[`keydown`,`beforeinput`,`input`])t.removeEventListener(e,i,!0);window.removeEventListener(`scroll`,a)}},[e])}function bY(e){if(e.isContentEditable){let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).getBoundingClientRect();if(t.height>0)return t}}return e.getBoundingClientRect()}var xY=`.plan-slash-menu, .plan-block-handles, .plan-block-menu, .plan-insert-prompt, .mdxeditor-popup-container, [role="dialog"], [role="listbox"], [role="menu"], [data-plan-apply-bar], [data-plan-block-tools], [data-plan-add-bar]`;function SY(e,t){return t instanceof Node&&(e.contains(t)||t instanceof Element&&t.closest(xY)!==null)}function CY(e){let t=Ku(e);if(!t)return()=>void 0;let n=()=>{t.getEditorState().read(()=>{let e=U(),t=e.getLastChild();if(e.getChildrenSize()<2||!Ou(t)||t.getChildrenSize()>0||B(t.getPreviousSibling()))return!1;let n=R();return!(I(n)&&n.anchor.getNode().is(t))})&&t.update(()=>{let e=U().getLastChild();Ou(e)&&e.getChildrenSize()===0&&e.remove()},{tag:`history-merge`})};return n(),t.registerUpdateListener(n)}function wY(e,t,n=12){let r=n=>{let i=t.row!==void 0&&t.column!==void 0?e.querySelector(`[data-dt-cell="${t.row}:${t.column}"] .plan-dt-cell-content`):e.querySelector(`.plan-editor-content`);if(!i){n>0&&requestAnimationFrame(()=>r(n-1));return}if(i.focus({preventScroll:!0}),!Ve(i,t.offset,t.end??t.offset))return;let a=Ku(i);a?.update(()=>{let e=fl(window.getSelection(),a);e&&fd(e)})};r(n)}function TY(e){let t=Re(e),n=t?Ne(t,t===e.parentElement?e:void 0):null;return n?{offset:n.start,end:n.end}:null}var EY=`p, h1, h2, h3, h4, h5, h6, li, blockquote`;function DY(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return;let n=t.getRangeAt(0),r=n.startContainer,i=(r instanceof Element?r:r.parentElement)?.closest(EY);if(!i||!e.contains(i))return;let a=document.createRange();if(a.selectNodeContents(i),a.comparePoint(n.endContainer,n.endOffset)<=0)return;t.setBaseAndExtent(n.startContainer,n.startOffset,i,i.childNodes.length);let o=Ku(i);o?.update(()=>{let e=fl(window.getSelection(),o);e&&fd(e)})}var OY=`input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([disabled]):not([role="combobox"]), textarea:not([disabled]), [contenteditable="true"]`;function kY(e){let t=[];for(let n of Array.from(e.querySelectorAll(`*`)))n.matches(OY)&&t.push(n),n.shadowRoot&&t.push(...kY(n.shadowRoot));return t}function AY(e,t=12){let n=e.querySelector(`.plan-editor-content`),r=(n?Ku(n):null)?.getEditorState().read(()=>{let e=U().getFirstChild();return e&&e.getType()===`codeblock`?e.getKey():null});if(r){OG(r);return}let i=n?kY(n).find(e=>e!==n&&e.getClientRects().length>0):void 0;if(!i)t>0?requestAnimationFrame(()=>AY(e,t-1)):n?.focus({preventScroll:!0});else if(i.focus({preventScroll:!0}),i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement){let e=i.value.length;i.setSelectionRange(e,e)}}function jY(e,t){let n=e.parentElement;if(!n)return null;let r=getComputedStyle(n),i=n.getBoundingClientRect(),a=e=>Number.parseFloat(e)||0,o=i.left+a(r.borderLeftWidth)+a(r.paddingLeft),s=n.clientWidth-a(r.paddingLeft)-a(r.paddingRight);if(t)return{top:i.top+a(r.borderTopWidth)+a(r.paddingTop),left:o,width:s};let c=e.previousElementSibling;return c?{top:c.getBoundingClientRect().top,left:o,width:s}:null}function MY({source:e,target:t,commit:n,onCancel:r,caret:i,margins:a,height:o,closing:s=!1,registerDone:c,blockRange:l,staged:u=!1,onShown:d,onDirty:f}){let p=(0,k.useRef)(null),m=(0,k.useRef)(null),h=t.kind===`cell`||(t.kind===`edit`||t.kind===`add`)&&t.inline===!0,[g]=(0,k.useState)(()=>t.kind===`edit`?EB(e,t.range):t.kind===`cell`?kB(e,t.range):``),_=(0,k.useMemo)(vY,[]),[v,y]=(0,k.useState)(!1),[b,x]=(0,k.useState)(null),S=(0,k.useRef)(null),C=(0,k.useRef)(!1),w=(0,k.useRef)(f);w.current=f;let T=(0,k.useRef)(s);T.current=s;let E=()=>{C.current||T.current||(C.current=!0,w.current?.(!0))},ee=(0,k.useRef)(E);ee.current=E;let[D,te]=(0,k.useState)(!1);(0,k.useEffect)(()=>{if(D)return;let e=0,t=20,n=-1,r=()=>{let i=m.current?.querySelector(`.plan-editor-content`),a=i&&i.childElementCount>0?i.getBoundingClientRect().height:-1;a>0&&a===n||t<=0?te(!0):(n=a,--t,e=requestAnimationFrame(r))};return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},[D]);let ne=(0,k.useRef)(d);ne.current=d,(0,k.useEffect)(()=>{if(!D||!u)return;let e=m.current,t=e?TY(e):null;e&&t&&wY(e,t),ne.current?.()},[D,u]),(0,k.useLayoutEffect)(()=>{let e=m.current;if(!u||!e)return;e.style.removeProperty(`--stage-top`),e.style.removeProperty(`--stage-left`);let n=jY(e,t.kind===`cell`);if(!n)return;let r=e.getBoundingClientRect();e.style.setProperty(`--stage-width`,`${n.width}px`),e.style.setProperty(`--stage-top`,`${n.top-r.top}px`),e.style.setProperty(`--stage-left`,`${n.left-r.left}px`)},[u,t.kind]),yY(m),(0,k.useEffect)(()=>{let e=()=>{},t=()=>{},n=!1,r=0,a=requestAnimationFrame(()=>{let a=m.current;S.current=p.current?.getMarkdown()??null;let o=i??(h?{offset:2**53-1}:void 0),s=t=>{if(!a)return;let r=a.querySelector(`.plan-editor-content`);r&&!n&&(e=CY(r));let i=t??o;i&&wY(a,i)},c={defaultSelection:`rootEnd`,preventScroll:!0};if(h){let e=()=>{let e=a?.querySelector(`.plan-editor-content`),t=e?Ku(e):null;if(!a||!t||n)return!1;let r=TY(a);return t.focus(()=>s(r&&r.end!==r.offset?r:void 0),c),!0};if(a&&!e()){let r=new MutationObserver(()=>{(e()||n)&&r.disconnect()});r.observe(a,{childList:!0,subtree:!0}),t=()=>r.disconnect()}}else if(o)p.current?.focus(()=>s(),c);else{let t=20,i=()=>{let o=a?.querySelector(`.plan-editor-content`);a&&!n&&(o?(e=CY(o),AY(a)):t-->0&&(r=requestAnimationFrame(i)))};i()}});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(r),n=!0,t(),e()}},[]),(0,k.useEffect)(()=>{let e=m.current;if(!e||!h)return;let t=t=>{let n=e.querySelector(`.plan-editor-content`);t.detail>=3&&n&&t.target instanceof Node&&n.contains(t.target)&&DY(n)};return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[h]),(0,k.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>ee.current(),n=e=>UB(e.target);return e.addEventListener(`input`,t,!0),e.addEventListener(`change`,t,!0),e.addEventListener(`focusin`,n),()=>{e.removeEventListener(`input`,t,!0),e.removeEventListener(`change`,t,!0),e.removeEventListener(`focusin`,n)}},[]),(0,k.useEffect)(()=>{s&&C.current&&w.current?.(!1)},[s]),(0,k.useEffect)(()=>()=>w.current?.(!1),[]),(0,k.useEffect)(()=>{let e=e=>{C.current&&!T.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);async function re(i,a){x(null);let o;try{o=t.kind===`cell`?jB(e,t.range,i):t.kind===`edit`?DB(e,{kind:`replace`,range:t.range,edited:i}):DB(e,{kind:`insert`,after:t.after,edited:i})}catch(e){x(e instanceof Error?e.message:`This block cannot be read as part of a plan yet.`);return}if(OB(o,e))r(a);else{y(!0);try{let e=await ze(o);if(e){x(`This block does not render yet. ${e}`);return}let t=await n(o,a);t&&x(t)}catch(e){x(e instanceof Error?e.message:`Could not keep this change`)}finally{y(!1)}}}let ie=(0,k.useRef)(!1),ae=(0,k.useRef)(s);ae.current=s;function oe(){if(ie.current||ae.current)return;WB();let e=p.current?.getMarkdown();e!==void 0&&(S.current!==null&&e===S.current&&t.kind!==`add`?r():(ie.current=!0,re(e).finally(()=>{ie.current=!1})))}let se=(0,k.useRef)(oe);se.current=oe;function ce(){let e=m.current,n=p.current;if(!e||!n||ie.current||ae.current||t.kind!==`edit`&&!(t.kind===`add`&&t.after))return!1;let r=e.querySelector(`.plan-editor-content`),i=r?Ku(r):null;if(!r||!i)return!1;let a=window.getSelection();i.update(()=>{let e=fl(a,i);e&&fd(e)},{discrete:!0});let o=i.getEditorState().read(()=>{let e=U(),t=R();if(e.getChildrenSize()!==1||!I(t))return null;let n=t.anchor.getNode().getTopLevelElement();return!n||!(Ou(n)||Y_(n))?null:e.getTextContent()});if(o===null)return!1;if(!o.trim()||PY(r))return!0;i.update(()=>{let e=R();if(!I(e))return;e.isCollapsed()||e.removeText();let t=e.anchor.getNode();if(F(t)){let n=t.getTextContent(),r=e.anchor.offset,i=/\s*$/.exec(n.slice(0,r))?.[0].length??0,a=/^\s*/.exec(n.slice(r))?.[0].length??0;i+a>0&&t.spliceText(r-i,i+a,``,!0)}R()?.insertParagraph()},{discrete:!0});let s=i.getEditorState(),c=n.getMarkdown();i.update(()=>{for(let e of U().getChildren().slice(1))e.remove()},{discrete:!0});let l=n.getMarkdown();if(i.setEditorState(s),!l.trim()||!c.startsWith(l))return!0;let u=c.slice(l.length).trim(),d=t.kind===`edit`?t.range.start:(t.after?.end??0)+2;return ie.current=!0,re(u?c:l,{open:u?`next`:`add`,start:d}).finally(()=>{ie.current=!1}),!0}let le=(0,k.useRef)(ce);le.current=ce;function ue(){let n=m.current;if(!n||ie.current||ae.current||t.kind!==`edit`&&!(t.kind===`add`&&t.after))return!1;let r=n.querySelector(`.plan-editor-content`),i=r?Ku(r):null;if(!i||!i.getEditorState().read(()=>{let e=U(),t=e.getFirstChild();return e.getChildrenSize()===1&&(Ou(t)||Y_(t))&&t.getChildrenSize()===0}))return!1;let a=t.kind===`edit`?`${t.range.start}-${t.range.end}`:null,o=NY(n,-1,a),s=o?null:NY(n,1,a),c=t.kind===`edit`?DB(e,{kind:`replace`,range:t.range,edited:``}):e,l=o??s,u=l?Number(/^(\d+)-/.exec(l.dataset.planBlock??l.dataset.planText??``)?.[1]):NaN,d=Number.isFinite(u)?De(e,c,u):null;return ie.current=!0,re(``,d===null?void 0:{open:o?`end`:`start`,start:d}).finally(()=>{ie.current=!1}),!0}let de=(0,k.useRef)(ue);de.current=ue;let fe=(0,k.useRef)(c);fe.current=c,(0,k.useEffect)(()=>(fe.current?.(()=>se.current()),()=>fe.current?.(null)),[]),(0,k.useEffect)(()=>{let e=m.current;if(!e)return;let n=e=>{if(e.isComposing)return;if(e.key===`Backspace`){!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&h&&t.kind!==`cell`&&!document.querySelector(`.plan-slash-menu`)&&de.current()&&(e.preventDefault(),e.stopPropagation());return}if(e.key!==`Enter`)return;let n=e.metaKey||e.ctrlKey;!n&&!e.shiftKey&&!e.altKey&&h&&t.kind!==`cell`&&!document.querySelector(`.plan-slash-menu`)&&le.current()?(e.preventDefault(),e.stopPropagation()):(n||t.kind===`cell`&&!e.shiftKey&&!document.querySelector(`.plan-slash-menu`))&&(e.preventDefault(),e.stopPropagation(),se.current())};return e.addEventListener(`keydown`,n,!0),()=>e.removeEventListener(`keydown`,n,!0)},[t.kind,h]),(0,k.useEffect)(()=>{let e=m.current;if(!e||s)return;let t=t=>t instanceof Node&&Re(e)?.contains(t)===!0,n=!1,r=0,i=n=>SY(e,n.target)||t(n.target)?!1:!(n.target===document.documentElement&&n.clientX>=document.documentElement.clientWidth),a=e=>{window.clearTimeout(r),n=t(e.target),n&&(r=window.setTimeout(()=>n=!1,0)),!Me(e)&&i(e)&&se.current()},o=e=>{Be(e)&&i(e)&&se.current()},c=t=>{let r=t.relatedTarget;r===null||SY(e,r)||n||se.current()};return document.addEventListener(`pointerdown`,a,!0),document.addEventListener(`click`,o,!0),e.addEventListener(`focusout`,c),()=>{window.clearTimeout(r),document.removeEventListener(`pointerdown`,a,!0),document.removeEventListener(`click`,o,!0),e.removeEventListener(`focusout`,c)}},[s]);let pe=(0,k.useRef)(()=>{});pe.current=()=>{C.current?oe():r()},(0,k.useEffect)(()=>{let e=m.current;if(!e)return;let t=t=>{t.key!==`Escape`||t.isComposing||document.querySelector(`.plan-slash-menu`)||window.setTimeout(()=>{!t.defaultPrevented&&e.isConnected&&pe.current()},0)};return e.addEventListener(`keydown`,t,!0),()=>e.removeEventListener(`keydown`,t,!0)},[]);let me=(0,k.useRef)(e=>{S.current!==null&&e!==S.current&&E()});me.current=e=>{S.current!==null&&e!==S.current&&E()};let he=(0,k.useMemo)(()=>(0,A.jsx)(RC,{ref:p,className:`plan-editor-surface`,contentEditableClassName:`plan-document plan-ui plan-editor-content`,markdown:g,plugins:_,lexicalTheme:gY,iconComponentFor:_Y,onChange:e=>me.current(e),onError:({error:e})=>x(`The editor could not read part of this block: ${e}`)}),[g,_]),ge=t.kind===`cell`?`Edit cell`:t.kind===`edit`?`Edit block`:`New block`,_e=a?{marginTop:a.top,marginBottom:a.bottom}:{};return(0,A.jsxs)(`div`,{className:`plan-editor plan-block-editor`,"data-plan-block-editor":t.kind,"data-inline":h?``:void 0,"data-closing":s?``:void 0,"data-staged":u?``:void 0,"data-plan-edit-block":l,inert:s||void 0,ref:m,role:`group`,"aria-label":ge,"aria-busy":v||void 0,style:{..._e,minHeight:D||u?void 0:o},children:[he,b?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`host-error`,role:`alert`,children:b}),(0,A.jsx)(`div`,{className:`plan-block-editor-bar`,role:`toolbar`,"aria-label":ge,children:(0,A.jsxs)(`span`,{className:`plan-editor-actions`,children:[(0,A.jsx)(Ot,{variant:`secondary`,onClick:()=>r(),disabled:v,"data-plan-block-cancel":``,children:`Cancel`}),(0,A.jsx)(Ot,{variant:`primary`,onClick:oe,disabled:v,"data-plan-block-done":``,children:v?`Saving…`:`Done`})]})})]}):null]})}function NY(e,t,n){for(let r=t<0?e.previousElementSibling:e.nextElementSibling;r;r=t<0?r.previousElementSibling:r.nextElementSibling)if(r instanceof HTMLElement&&!r.matches(`[data-plan-head]`)&&(n===null||(r.dataset.planBlock??r.dataset.planText)!==n)&&r.matches(`[data-plan-block], [data-plan-text]`))return r;return null}function PY(e){let t=window.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return!1;let n=document.createRange();n.setStart(e,0);try{n.setEnd(t.anchorNode??e,t.anchorOffset)}catch{return!1}return n.toString().trim()===``}export{MY as BlockEditor};