intlayer-editor 9.0.0-canary.2 → 9.0.0-canary.21

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 (179) hide show
  1. package/bin/intlayer-editor.mjs +1 -1
  2. package/client/dist/assets/CodeBlockShiki-bwFgZNdc.js +2 -0
  3. package/client/dist/assets/MarkDownRender-BKqoX1Kl.js +22 -0
  4. package/client/dist/assets/MarkDownRender-rIqTKbuD.js +1 -0
  5. package/client/dist/assets/MarkdownEditor-r-VVVKxx.js +195 -0
  6. package/client/dist/assets/angular-html-4FNbJSpd.js +1 -0
  7. package/client/dist/assets/angular-html-GDUx1il_.js +1 -0
  8. package/client/dist/assets/angular-ts-C1tA97Pk.js +1 -0
  9. package/client/dist/assets/{angular-ts-D8CUV3s9.js → angular-ts-DxeeMHNV.js} +1 -1
  10. package/client/dist/assets/{apl-PcM4Dp7k.js → apl-BZnWYwl_.js} +1 -1
  11. package/client/dist/assets/astro-DSk134xP.js +1 -0
  12. package/client/dist/assets/{astro-B7st53oA.js → astro-TFwSJeev.js} +1 -1
  13. package/client/dist/assets/bash-BZ_E_HZa.js +1 -0
  14. package/client/dist/assets/{blade-hWl6posx.js → blade-5AFNzmCV.js} +1 -1
  15. package/client/dist/assets/bundle-web-XtEDcnTk.js +2 -0
  16. package/client/dist/assets/c-Blw65jlH.js +1 -0
  17. package/client/dist/assets/{cobol-IOjEjPmG.js → cobol-XL-wCgBL.js} +1 -1
  18. package/client/dist/assets/{coffee-B5TREocO.js → coffee-CC-CTfG5.js} +1 -1
  19. package/client/dist/assets/cpp-ClrH8BDm.js +1 -0
  20. package/client/dist/assets/{crystal-CgtjlE18.js → crystal-Dl4-x17T.js} +1 -1
  21. package/client/dist/assets/css-DnwUiiQU.js +1 -0
  22. package/client/dist/assets/css-oq4KMCBk.js +1 -0
  23. package/client/dist/assets/{dist-DvONdz5F.js → dist-CVX7hj0v.js} +1 -1
  24. package/client/dist/assets/dist-D2w1IKPT.js +12 -0
  25. package/client/dist/assets/{edge-CwSzunxI.js → edge-DEl7aijJ.js} +1 -1
  26. package/client/dist/assets/{elixir-CzgPtVDf.js → elixir-BlYHe8Un.js} +1 -1
  27. package/client/dist/assets/{elm-Cm7sFdI1.js → elm-BfHi1MFa.js} +1 -1
  28. package/client/dist/assets/{erb-p0q977En.js → erb-CLZwFRoF.js} +1 -1
  29. package/client/dist/assets/{git-rebase-D2tSwjJb.js → git-rebase-09-F-Xjy.js} +1 -1
  30. package/client/dist/assets/{glimmer-js-JMWzPMQ2.js → glimmer-js-Ckf0CfcS.js} +1 -1
  31. package/client/dist/assets/{glimmer-ts-DG5GCT78.js → glimmer-ts-DmrA1uPz.js} +1 -1
  32. package/client/dist/assets/glsl-CNFhMZ3o.js +1 -0
  33. package/client/dist/assets/graphql-Bs_icwQf.js +1 -0
  34. package/client/dist/assets/{hack-C4J_0T1S.js → hack-DDVusiAf.js} +1 -1
  35. package/client/dist/assets/haml-BffKgPjF.js +1 -0
  36. package/client/dist/assets/{handlebars-BU7OV8YS.js → handlebars-CnPxLQN8.js} +1 -1
  37. package/client/dist/assets/html-BBwwBXFu.js +1 -0
  38. package/client/dist/assets/html-CLUDcAUZ.js +1 -0
  39. package/client/dist/assets/html-derivative-DlCYEGeD.js +1 -0
  40. package/client/dist/assets/{http-HvMG3K54.js → http-D8fCFQUQ.js} +1 -1
  41. package/client/dist/assets/{hurl-CLh1t2ES.js → hurl-14JhHsIH.js} +1 -1
  42. package/client/dist/assets/index-BitdwoH0.css +2 -0
  43. package/client/dist/assets/index-CQz0f8M0.js +166 -0
  44. package/client/dist/assets/java-MBw7zHAA.js +1 -0
  45. package/client/dist/assets/javascript-BttINa8q.js +1 -0
  46. package/client/dist/assets/javascript-GqdpWK4X.js +1 -0
  47. package/client/dist/assets/{jinja-ISwn25cN.js → jinja-BB8I8LH4.js} +1 -1
  48. package/client/dist/assets/{jison-D9Fg2JgN.js → jison-DsrzMHSA.js} +1 -1
  49. package/client/dist/assets/json-BNRlFZ-5.js +1 -0
  50. package/client/dist/assets/json-D-W1nVm3.js +1 -0
  51. package/client/dist/assets/jsx-UEmBU27c.js +1 -0
  52. package/client/dist/assets/{julia-BRnC1exM.js → julia-BFXv4sM2.js} +1 -1
  53. package/client/dist/assets/{just-BWbKChh7.js → just-CPBBCI7q.js} +1 -1
  54. package/client/dist/assets/{latex-DoFV6f5B.js → latex-DRm4Enns.js} +1 -1
  55. package/client/dist/assets/{liquid-BGxpJKqJ.js → liquid-Cv-R79y_.js} +1 -1
  56. package/client/dist/assets/lua-Bc0cVuDM.js +1 -0
  57. package/client/dist/assets/{marko-E8KxKzjy.js → marko-Cydystb1.js} +1 -1
  58. package/client/dist/assets/{mdc-CVMbNqUi.js → mdc-F16vulAt.js} +1 -1
  59. package/client/dist/assets/{nginx-CgHaWcsO.js → nginx-BDAkFTs4.js} +1 -1
  60. package/client/dist/assets/{nim-xKCzf2o0.js → nim-Cr3LyLLK.js} +1 -1
  61. package/client/dist/assets/{perl-CAUsHq6V.js → perl-CIkRV9Rv.js} +1 -1
  62. package/client/dist/assets/{php-Cn4rjz2P.js → php-Lo_cJrZw.js} +1 -1
  63. package/client/dist/assets/postcss-9tdIZBLq.js +1 -0
  64. package/client/dist/assets/{pug-DD9HHTGS.js → pug-DIfIg5aG.js} +1 -1
  65. package/client/dist/assets/purify.es-DuRL7t6i.js +3 -0
  66. package/client/dist/assets/{qml-DcW_sT3t.js → qml-DGFlbsc_.js} +1 -1
  67. package/client/dist/assets/r-BrtO6otC.js +1 -0
  68. package/client/dist/assets/{razor-30Cugjh2.js → razor-DYw8eU8D.js} +1 -1
  69. package/client/dist/assets/react-9ZasmZpi.js +1 -0
  70. package/client/dist/assets/regexp-DNT4mv-6.js +1 -0
  71. package/client/dist/assets/rolldown-runtime-CNC7AqOf.js +1 -0
  72. package/client/dist/assets/{rst-wHa0wzHl.js → rst-Dk81JX5f.js} +1 -1
  73. package/client/dist/assets/{ruby-BA7kcl5p.js → ruby-CGbPXxQs.js} +1 -1
  74. package/client/dist/assets/{sas-BHVT2N5I.js → sas-DUYNvyuO.js} +1 -1
  75. package/client/dist/assets/scss-uCvqxuFc.js +1 -0
  76. package/client/dist/assets/shellscript-CoI_i11P.js +1 -0
  77. package/client/dist/assets/{shellsession-BmAC8SMF.js → shellsession-o4Zr-oXZ.js} +1 -1
  78. package/client/dist/assets/{soy-B5vCsGAN.js → soy-DviXHfWL.js} +1 -1
  79. package/client/dist/assets/sql-DsTevJ9n.js +1 -0
  80. package/client/dist/assets/{stata-h02h04e7.js → stata-BoeeGEJN.js} +1 -1
  81. package/client/dist/assets/{surrealql-DxccxuMd.js → surrealql-DZFWP0QQ.js} +1 -1
  82. package/client/dist/assets/{svelte-BFzQ4R1i.js → svelte-BKCyX1Uu.js} +1 -1
  83. package/client/dist/assets/svelte-CvMdTL-3.js +1 -0
  84. package/client/dist/assets/{templ-DmkwoHql.js → templ-DEr9KWft.js} +1 -1
  85. package/client/dist/assets/{tex-B0f_hYr8.js → tex-DtyfcXbs.js} +1 -1
  86. package/client/dist/assets/{ts-tags-CTs7_HT0.js → ts-tags-Dl7VxY0i.js} +1 -1
  87. package/client/dist/assets/tsx-DA9DE6wS.js +1 -0
  88. package/client/dist/assets/tsx-HeIVaWJk.js +1 -0
  89. package/client/dist/assets/{twig-DgtEA5Er.js → twig-TIwAW_ii.js} +1 -1
  90. package/client/dist/assets/typescript-544uMjEi.js +1 -0
  91. package/client/dist/assets/typescript-CKFhM_78.js +1 -0
  92. package/client/dist/assets/vue-D5hTo1Bd.js +1 -0
  93. package/client/dist/assets/{vue-C6J2sE8U.js → vue-DTJKJr7l.js} +1 -1
  94. package/client/dist/assets/{vue-html-DQch_7VQ.js → vue-html-Bcgt8jrn.js} +1 -1
  95. package/client/dist/assets/{vue-vine-MFjXkeBm.js → vue-vine-aDZLcOjt.js} +1 -1
  96. package/client/dist/assets/xml-BmD4dEuW.js +1 -0
  97. package/client/dist/assets/xml-Dt-VRNGg.js +1 -0
  98. package/client/dist/assets/{xsl-BFS2wyMt.js → xsl-Cfl5-n_a.js} +1 -1
  99. package/client/dist/assets/yaml-BFRNvut5.js +1 -0
  100. package/client/dist/assets/yaml-CFIusU1S.js +1 -0
  101. package/client/dist/index.html +4 -4
  102. package/package.json +32 -32
  103. package/server/dist/controllers/configuration.controller.cjs +0 -1
  104. package/server/dist/controllers/configuration.controller.cjs.map +1 -1
  105. package/server/dist/controllers/configuration.controller.d.ts +0 -1
  106. package/server/dist/controllers/configuration.controller.mjs.map +1 -1
  107. package/server/dist/controllers/dictionary.controller.cjs +2 -3
  108. package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
  109. package/server/dist/controllers/dictionary.controller.d.ts +1 -2
  110. package/server/dist/controllers/dictionary.controller.mjs +1 -1
  111. package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
  112. package/server/dist/index.cjs.map +1 -1
  113. package/server/dist/index.d.ts +1 -1
  114. package/server/dist/index.mjs.map +1 -1
  115. package/server/dist/routes/config.routes.cjs +0 -1
  116. package/server/dist/routes/config.routes.cjs.map +1 -1
  117. package/server/dist/routes/config.routes.d.ts +0 -1
  118. package/server/dist/routes/config.routes.mjs.map +1 -1
  119. package/server/dist/routes/dictionary.routes.cjs +0 -1
  120. package/server/dist/routes/dictionary.routes.cjs.map +1 -1
  121. package/server/dist/routes/dictionary.routes.d.ts +0 -1
  122. package/server/dist/routes/dictionary.routes.mjs.map +1 -1
  123. package/server/dist/utils/checkPortAvailability.cjs.map +1 -1
  124. package/server/dist/utils/checkPortAvailability.mjs.map +1 -1
  125. package/server/dist/utils/httpStatusCodes.cjs.map +1 -1
  126. package/server/dist/utils/httpStatusCodes.d.ts +18 -18
  127. package/server/dist/utils/httpStatusCodes.mjs.map +1 -1
  128. package/server/dist/utils/responseData.cjs.map +1 -1
  129. package/server/dist/utils/responseData.d.ts +4 -25
  130. package/server/dist/utils/responseData.mjs.map +1 -1
  131. package/client/dist/assets/CodeBlockShiki--PXbZ-0o.js +0 -2
  132. package/client/dist/assets/MarkDownRender-CyKq7p4V.js +0 -22
  133. package/client/dist/assets/MarkDownRender-anY1H-DK.js +0 -1
  134. package/client/dist/assets/MarkdownEditor-Cw-RD7xo.js +0 -474
  135. package/client/dist/assets/angular-html-DQnyiQ1V.js +0 -1
  136. package/client/dist/assets/angular-html-DrvEcI8G.js +0 -1
  137. package/client/dist/assets/angular-ts-DI75fV4o.js +0 -1
  138. package/client/dist/assets/astro-BMXikh6R.js +0 -1
  139. package/client/dist/assets/bash-YgR0LL5O.js +0 -1
  140. package/client/dist/assets/bundle-web-uEOWqvbZ.js +0 -2
  141. package/client/dist/assets/c-PpPxyn8g.js +0 -1
  142. package/client/dist/assets/chunk-Cyuzqnbw.js +0 -1
  143. package/client/dist/assets/cpp-C4ceAJBi.js +0 -1
  144. package/client/dist/assets/css-BKJqhAP6.js +0 -1
  145. package/client/dist/assets/css-Dflf0SUa.js +0 -1
  146. package/client/dist/assets/dist-DxhyXVYL.js +0 -12
  147. package/client/dist/assets/glsl-MPwHyiXQ.js +0 -1
  148. package/client/dist/assets/graphql-NW854Khs.js +0 -1
  149. package/client/dist/assets/haml-qGg_91I2.js +0 -1
  150. package/client/dist/assets/html-CPJoU0kz.js +0 -1
  151. package/client/dist/assets/html-derivative-BtLlF_VL.js +0 -1
  152. package/client/dist/assets/html-x4KE3xEi.js +0 -1
  153. package/client/dist/assets/index-D0Vd7gII.js +0 -166
  154. package/client/dist/assets/index-D6iMMAqj.css +0 -2
  155. package/client/dist/assets/java-Cst_eZTE.js +0 -1
  156. package/client/dist/assets/javascript-O8ryhYuI.js +0 -1
  157. package/client/dist/assets/javascript-i_rUTyCW.js +0 -1
  158. package/client/dist/assets/json-ByX1GTMJ.js +0 -1
  159. package/client/dist/assets/json-DS5j4FfK.js +0 -1
  160. package/client/dist/assets/jsx-CFyhNHav.js +0 -1
  161. package/client/dist/assets/lua-VoGSg0xb.js +0 -1
  162. package/client/dist/assets/postcss-DUGWwNEu.js +0 -1
  163. package/client/dist/assets/purify.es-DlxR2Lg_.js +0 -3
  164. package/client/dist/assets/r-D2d3McyU.js +0 -1
  165. package/client/dist/assets/react-Bi8cP4Js.js +0 -1
  166. package/client/dist/assets/regexp-Bu0flJgP.js +0 -1
  167. package/client/dist/assets/scss-DdIrFDxD.js +0 -1
  168. package/client/dist/assets/shellscript-BbTp1yjG.js +0 -1
  169. package/client/dist/assets/sql-DCFvu5RM.js +0 -1
  170. package/client/dist/assets/svelte-wfkLEEZ8.js +0 -1
  171. package/client/dist/assets/tsx-C2UVom5f.js +0 -1
  172. package/client/dist/assets/tsx-DFvk7AwW.js +0 -1
  173. package/client/dist/assets/typescript-DHTLvXzV.js +0 -1
  174. package/client/dist/assets/typescript-DRkjdym1.js +0 -1
  175. package/client/dist/assets/vue-CL5Rsh0f.js +0 -1
  176. package/client/dist/assets/xml-C33zriiW.js +0 -1
  177. package/client/dist/assets/xml-Cia02h9C.js +0 -1
  178. package/client/dist/assets/yaml-BDyUIXlV.js +0 -1
  179. package/client/dist/assets/yaml-w0rMsuN4.js +0 -1
@@ -1,474 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DrvEcI8G.js","assets/chunk-Cyuzqnbw.js","assets/html-x4KE3xEi.js","assets/css-Dflf0SUa.js","assets/javascript-i_rUTyCW.js","assets/angular-ts-D8CUV3s9.js","assets/scss-DdIrFDxD.js","assets/apl-PcM4Dp7k.js","assets/json-DS5j4FfK.js","assets/xml-C33zriiW.js","assets/java-Cst_eZTE.js","assets/astro-B7st53oA.js","assets/postcss-DUGWwNEu.js","assets/tsx-DFvk7AwW.js","assets/typescript-DHTLvXzV.js","assets/blade-hWl6posx.js","assets/html-derivative-BtLlF_VL.js","assets/sql-DCFvu5RM.js","assets/bsl-BkkzgIyY.js","assets/sdbl-bTVj8UrX.js","assets/c-PpPxyn8g.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/cobol-IOjEjPmG.js","assets/coffee-B5TREocO.js","assets/cpp-C4ceAJBi.js","assets/glsl-MPwHyiXQ.js","assets/regexp-Bu0flJgP.js","assets/crystal-CgtjlE18.js","assets/shellscript-BbTp1yjG.js","assets/edge-CwSzunxI.js","assets/elixir-CzgPtVDf.js","assets/elm-Cm7sFdI1.js","assets/erb-p0q977En.js","assets/ruby-BA7kcl5p.js","assets/graphql-NW854Khs.js","assets/jsx-CFyhNHav.js","assets/haml-qGg_91I2.js","assets/lua-VoGSg0xb.js","assets/yaml-w0rMsuN4.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-DEKoE2YW.js","assets/fortran-free-form-CYNrtFtB.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-C0sCabJj.js","assets/gdscript-Cp2uCuqX.js","assets/gdshader-CBce3t8t.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-D2tSwjJb.js","assets/glimmer-js-JMWzPMQ2.js","assets/glimmer-ts-DG5GCT78.js","assets/hack-C4J_0T1S.js","assets/handlebars-BU7OV8YS.js","assets/http-HvMG3K54.js","assets/hurl-CLh1t2ES.js","assets/csv-Dx-8-gkx.js","assets/hxml-B0Qn7Nwc.js","assets/haxe-OTjmBuCE.js","assets/jinja-ISwn25cN.js","assets/jison-D9Fg2JgN.js","assets/julia-BRnC1exM.js","assets/r-D2d3McyU.js","assets/just-BWbKChh7.js","assets/perl-CAUsHq6V.js","assets/latex-DoFV6f5B.js","assets/tex-B0f_hYr8.js","assets/liquid-BGxpJKqJ.js","assets/marko-E8KxKzjy.js","assets/less-DVTAwKKz.js","assets/mdc-CVMbNqUi.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-CgHaWcsO.js","assets/nim-xKCzf2o0.js","assets/php-Cn4rjz2P.js","assets/pug-DD9HHTGS.js","assets/qml-DcW_sT3t.js","assets/razor-30Cugjh2.js","assets/csharp-oqKa8noW.js","assets/rst-wHa0wzHl.js","assets/cmake-Bj61d0ZC.js","assets/sas-BHVT2N5I.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-BmAC8SMF.js","assets/soy-B5vCsGAN.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-h02h04e7.js","assets/surrealql-DxccxuMd.js","assets/svelte-BFzQ4R1i.js","assets/templ-DmkwoHql.js","assets/go-rLFTqkRN.js","assets/ts-tags-CTs7_HT0.js","assets/twig-DgtEA5Er.js","assets/vue-C6J2sE8U.js","assets/vue-html-DQch_7VQ.js","assets/vue-vine-MFjXkeBm.js","assets/stylus-B6D30XZt.js","assets/xsl-BFS2wyMt.js"])))=>i.map(i=>d[i]);
2
- import{a as e,r as t,t as n}from"./chunk-Cyuzqnbw.js";import{t as r}from"./react-Bi8cP4Js.js";import{t as i}from"./MarkDownRender-CyKq7p4V.js";import{A as a,B as o,C as s,E as c,F as l,G as u,H as d,I as f,K as p,M as m,N as h,P as g,R as _,S as v,T as y,U as b,V as x,W as S,b as C,d as w,f as T,h as E,j as D,m as O,p as k,v as A,w as j,x as M,y as N,z as ee}from"./index-D0Vd7gII.js";import{N as P,a as F,c as te,j as I,n as ne}from"./dist-DxhyXVYL.js";var re=f(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),ie=f(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ae=f(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),oe=f(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),se=f(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),ce=f(`heading-1`,[[`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`}]]),L=f(`heading-2`,[[`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`}]]),le=f(`heading-3`,[[`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`}]]),ue=f(`image`,[[`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`}]]),de=f(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),fe=f(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),pe=f(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),me=f(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),he=f(`refresh-ccw-dot`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ge=f(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),_e=f(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),ve=f(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),ye=f(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),be=f(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),xe=f(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),Se=f(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),Ce=f(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]);function we(e){this.content=e}we.prototype={constructor:we,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new we(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new we(n)},addToStart:function(e,t){return new we([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new we(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new we(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=we.from(e),e.size?new we(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=we.from(e),e.size?new we(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=we.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},we.from=function(e){if(e instanceof we)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new we(t)};function Te(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Oe(e.charCodeAt(r-1))&&De(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Te(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ee(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Oe(e.charCodeAt(i-1))&&De(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ee(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function De(e){return e>=56320&&e<57344}function Oe(e){return e>=55296&&e<56320}var R=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Te(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ee(this,e,t,n)}findIndex(e){if(e==0)return Ae(0,e);if(e==this.size)return Ae(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ae(t+1,i):Ae(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};R.empty=new R([],0);var ke={index:0,offset:0};function Ae(e,t){return ke.index=e,ke.offset=t,ke}function je(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!je(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!je(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Me=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&je(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Me.none=[];var Ne=class extends Error{},z=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Fe(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Pe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(R.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};z.empty=new z(R.empty,0,0);function Pe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Pe(a.content,t-i-1,n-i-1)))}function Fe(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Fe(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Ie(e,t,n){if(n.openStart>e.depth)throw new Ne(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ne(`Inconsistent open depths`);return Le(e,t,n,0)}function Le(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Le(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return He(a,We(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return He(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ge(n,e);return He(a,Ue(e,i,o,t,r))}}function Re(e,t){if(!t.type.compatibleContent(e.type))throw new Ne(`Cannot join `+t.type.name+` onto `+e.type.name)}function ze(e,t,n){let r=e.node(n);return Re(r,t.node(n)),r}function Be(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ve(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Be(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Be(i.child(e),r);t&&t.depth==n&&t.textOffset&&Be(t.nodeBefore,r)}function He(e,t){if(!e.type.validContent(t))throw new Ne(`Invalid content for node `+e.type.name);return e.copy(t)}function Ue(e,t,n,r,i){let a=e.depth>i&&ze(e,t,i+1),o=r.depth>i&&ze(n,r,i+1),s=[];return Ve(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Re(a,o),Be(He(a,Ue(e,t,n,r,i+1)),s)):(a&&Be(He(a,We(e,t,i+1)),s),Ve(t,n,i,s),o&&Be(He(o,We(n,r,i+1)),s)),Ve(r,null,i,s),new R(s)}function We(e,t,n){let r=[];return Ve(null,e,n,r),e.depth>n&&Be(He(ze(e,t,n+1),We(e,t,n+1)),r),Ve(t,null,n,r),new R(r)}function Ge(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(R.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ke=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Me.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Xe(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Ye.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Ye.set(t,r=new qe);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Je,i}},qe=class{constructor(){this.elts=[],this.i=0}},Je=12,Ye=new WeakMap,Xe=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Ze=Object.create(null),Qe=class e{constructor(e,t,n,r=Me.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||R.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&je(this.attrs,t||e.defaultAttrs||Ze)&&Me.sameSet(this.marks,n||Me.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return z.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new z(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Ie(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ke.resolveCached(this,e)}resolveNoCache(e){return Ke.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),et(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=R.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Me.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Me.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=R.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Qe.prototype.text=void 0;var $e=class e extends Qe{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):et(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function et(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var tt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new nt(t,n);if(r.next==null)return e.empty;let i=rt(r);r.next&&r.err(`Unexpected trailing text`);let a=pt(ut(i));return mt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return R.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
3
- `)}};tt.empty=new tt(!0);var nt=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function rt(e){let t=[];do t.push(it(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function it(e){let t=[];do t.push(at(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function at(e){let t=lt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=st(e,t);else break;return t}function ot(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function st(e,t){let n=ot(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ot(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ct(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function lt(e){if(e.eat(`(`)){let t=rt(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=ct(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function ut(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function dt(e,t){return t-e}function ft(e,t){let n=[];return r(t),n.sort(dt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function pt(e){let t=Object.create(null);return n(ft(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);ft(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new tt(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(dt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function mt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function ht(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function gt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function _t(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function vt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new xt(e,r,t[r]);return n}var yt=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=vt(e,n.attrs),this.defaultAttrs=ht(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==tt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:gt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Qe(this,this.computeAttrs(e),R.from(t),Me.setFrom(n))}createChecked(e=null,t,n){return t=R.from(t),this.checkContent(t),new Qe(this,this.computeAttrs(e),t,Me.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=R.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(R.empty,!0);return i?new Qe(this,e,t.append(i),Me.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){_t(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Me.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function bt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var xt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?bt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},St=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=vt(e,r.attrs),this.excluded=null;let i=ht(this.attrs);this.instance=i?new Me(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Me(this,gt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){_t(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ct=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=we.from(e.nodes),t.marks=we.from(e.marks||{}),this.nodes=yt.compile(this.spec.nodes,this),this.marks=St.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=tt.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?wt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:wt(this,n.split(` `))}this.nodeFromJSON=e=>Qe.fromJSON(this,e),this.markFromJSON=e=>Me.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof yt))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new $e(n,n.defaultAttrs,e,Me.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function wt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Tt(e){return e.tag!=null}function Et(e){return e.style!=null}var Dt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Tt(e))this.tags.push(e);else if(Et(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new It(this,t,!1);return n.addAll(e,Me.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new It(this,t,!0);return n.addAll(e,Me.none,t.from,t.to),z.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Rt(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=zt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=zt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Ot={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},At={ol:!0,ul:!0},jt=1,Mt=2,Nt=4;function Pt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?jt:0)|(t===`full`?Mt:0)}var Ft=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=Me.none,this.match=i||(a&Nt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(R.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&jt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=R.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(R.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ot.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},It=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Pt(null,t.preserveWhitespace,0)|(n?Nt:0);i=r?new Ft(r.type,r.attrs,Me.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ft(null,null,Me.none,!0,null,a):new Ft(e.schema.topNodeType,null,Me.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Mt?`full`:this.localPreserveWS||(r.options&jt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
4
- `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;At.hasOwnProperty(a)&&this.parser.normalizeLists&&Lt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:kt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Ot.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
5
- `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=Me.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Bt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Pt(e,i,a.options);a.options&Nt&&a.content.length==0&&(o|=Nt);let s=Me.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Bt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Ft(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=jt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Lt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&At.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Rt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function zt(e){let t={};for(let n in e)t[n]=e[n];return t}function Bt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Vt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ut(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Ut(t).createTextNode(e.text);let{dom:n,contentDOM:r}=qt(Ut(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&qt(Ut(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:qt(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Ht(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Ht(e.marks)}};function Ht(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ut(e){return e.document||window.document}var Wt=new WeakMap;function Gt(e){let t=Wt.get(e);return t===void 0&&Wt.set(e,t=Kt(e)),t}function Kt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function qt(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Gt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=qt(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Jt=65535,Yt=2**16;function Xt(e,t){return e+t*Yt}function Zt(e){return e&Jt}function Qt(e){return(e-(e&Jt))/Yt}var $t=1,en=2,tn=4,nn=8,rn=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&nn)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&tn)>0}},an=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Zt(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Qt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Xt(o/3,e-s),f=e==s?en:e==u?$t:tn;return(t<0?e!=s:e!=u)&&(f|=nn),new rn(a,f,d)}r+=l-c}return n?e+r:new rn(e+r,0,null)}touches(e,t){let n=0,r=Zt(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};an.empty=new an([]);var on=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new rn(e,r,null)}},sn=Object.create(null),cn=class{getMap(){return an.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=sn[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sn)throw RangeError(`Duplicate use of step JSON ID `+e);return sn[e]=t,t.prototype.jsonID=e,t}},ln=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ne)return e.fail(t.message);throw t}}};function un(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(un(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return R.fromArray(r)}var dn=class e extends cn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new z(un(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return ln.fromReplace(e,this.from,this.to,i)}invert(){return new fn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};cn.jsonID(`addMark`,dn);var fn=class e extends cn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new z(un(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ln.fromReplace(e,this.from,this.to,n)}invert(){return new dn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};cn.jsonID(`removeMark`,fn);var pn=class e extends cn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ln.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ln.fromReplace(e,this.pos,this.pos+1,new z(R.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new mn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};cn.jsonID(`addNodeMark`,pn);var mn=class e extends cn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ln.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ln.fromReplace(e,this.pos,this.pos+1,new z(R.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new pn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};cn.jsonID(`removeNodeMark`,mn);var hn=class e extends cn{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&_n(e,this.from,this.to)?ln.fail(`Structure replace would overwrite content`):ln.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new an([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?z.empty:new z(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?z.empty:new z(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,z.fromJSON(t,n.slice),!!n.structure)}};hn.MAP_BIAS=1,cn.jsonID(`replace`,hn);var gn=class e extends cn{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(_n(e,this.from,this.gapFrom)||_n(e,this.gapTo,this.to)))return ln.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ln.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?ln.fromReplace(e,this.from,this.to,n):ln.fail(`Content does not fit in gap`)}getMap(){return new an([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,z.fromJSON(t,n.slice),n.insert,!!n.structure)}};cn.jsonID(`replaceAround`,gn);function _n(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function vn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new fn(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new dn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function yn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof St){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new fn(t.from,t.to,t.style)))}function bn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new hn(s,l,z.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new fn(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new z(R.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new hn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(R.empty,!0);e.replace(s,s,new z(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function xn(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Sn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!xn(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Cn(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=R.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=R.from(r.node(e).copy(u)),d++):c--;let f=R.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=R.from(i.node(e).copy(f)),p++):l++;e.step(new gn(c,l,o,s,new z(u.append(f),d,p),u.size-d,!0))}function wn(e,t,n=null,r=e){let i=En(e,t),a=i&&Dn(r,t);return a?i.map(Tn).concat({type:t,attrs:n}).concat(a.map(Tn)):null}function Tn(e){return{type:e,attrs:null}}function En(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Dn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function On(e,t,n){let r=R.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=R.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new gn(i,a,i,a,new z(r,0,0),n.length,!0))}function kn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Mn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&jn(e,t,n,a),bn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new gn(c,l,c+1,l-1,new z(R.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&An(e,t,n,a),!1}})}function An(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function jn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
6
- `))}})}function Mn(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Nn(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new gn(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new z(R.from(o),0,0),1,!0))}function Pn(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Fn(e,t,n=1,r){let i=e.doc.resolve(t),a=R.empty,o=R.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=R.from(i.node(e).copy(a));let t=r&&r[s];o=R.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new hn(t,t,new z(a.append(o),n,n),!0))}function In(e,t){let n=e.resolve(t),r=n.index();return Rn(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ln(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Rn(e,t){return!!(e&&t&&!e.isLeaf&&Ln(e,t))}function zn(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Rn(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Bn(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);jn(e,r.node(),r.before(),s)}o.inlineContent&&bn(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new hn(l,c.map(t+n,-1),z.empty,!0)),r===!0){let t=e.doc.resolve(l);An(e,t.node(),t.before(),e.steps.length)}return e}function Vn(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Hn(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Un(e,t,n=t,r=z.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Wn(i,a,r)?new hn(t,n,r):new Gn(i,a,r).fit()}function Wn(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Gn=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=R.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=R.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new z(i,a,o);return e>-1?new gn(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new hn(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Jn(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(R.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Jn(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new z(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Jn(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new z(Kn(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new z(Kn(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Yn(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=qn(this.placed,t,R.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?z.empty:new z(Kn(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new z(Kn(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Xn(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Xn(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Xn(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qn(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=qn(this.placed,this.depth,R.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(R.empty,!0);e.childCount&&(this.placed=qn(this.placed,this.frontier.length,e))}};function Kn(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Kn(e.firstChild.content,t-1,n)))}function qn(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qn(e.lastChild.content,t-1,n)))}function Jn(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Yn(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Yn(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(R.empty,!0)))),e.copy(r)}function Xn(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Zn(n,a.content,o)?s:null}function Zn(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Qn(e){return e.spec.defining||e.spec.definingForContent}function $n(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Wn(i,a,r))return e.step(new hn(t,n,r));let o=rr(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Qn(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new z(er(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function er(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(er(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(R.empty,!0))}return e}function tr(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Vn(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new z(R.from(r),0,0))}function nr(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=rr(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function rr(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var ir=class e extends cn{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return ln.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ln.fromReplace(e,this.pos,this.pos+1,new z(R.from(r),0,+!t.isLeaf))}getMap(){return an.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};cn.jsonID(`attr`,ir);var ar=class e extends cn{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ln.ok(n)}getMap(){return an.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};cn.jsonID(`docAttr`,ar);var or=class extends Error{};or=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},or.prototype=Object.create(Error.prototype),or.prototype.constructor=or,or.prototype.name=`TransformError`;var sr=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new on}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new or(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=z.empty){let r=Un(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new z(R.from(n),0,0))}delete(e,t){return this.replace(e,t,z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return $n(this,e,t,n),this}replaceRangeWith(e,t,n){return tr(this,e,t,n),this}deleteRange(e,t){return nr(this,e,t),this}lift(e,t){return Cn(this,e,t),this}join(e,t=1){return Bn(this,e,t),this}wrap(e,t){return On(this,e,t),this}setBlockType(e,t=e,n,r=null){return kn(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Nn(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new ir(e,t,n)),this}setDocAttribute(e,t){return this.step(new ar(e,t)),this}addNodeMark(e,t){return this.step(new pn(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof Me)t.isInSet(n.marks)&&this.step(new mn(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new mn(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Fn(this,e,t,n),this}addMark(e,t,n){return vn(this,e,t,n),this}removeMark(e,t,n){return yn(this,e,t,n),this}clearIncompatible(e,t,n){return bn(this,e,t,n),this}},cr=Object.create(null),B=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new lr(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=z.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?z.empty:t),o==0&&_r(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),_r(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new V(e):gr(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?gr(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):gr(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new mr(e.node(0))}static atStart(e){return gr(e,e,0,0,1)||new mr(e)}static atEnd(e){return gr(e,e,e.content.size,e.childCount,-1)||new mr(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=cr[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in cr)throw RangeError(`Duplicate use of selection JSON ID `+e);return cr[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}};B.prototype.visible=!0;var lr=class{constructor(e,t){this.$from=e,this.$to=t}},ur=!1;function dr(e){!ur&&!e.parent.inlineContent&&(ur=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var V=class e extends B{constructor(e,t=e){dr(e),dr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=z.empty){if(super.replace(e,t),t==z.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new fr(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=B.findFrom(n,r,!0)||B.findFrom(n,-r,!0);if(e)n=e.$head;else return B.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(B.findFrom(t,-r,!0)||B.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};B.jsonID(`text`,V);var fr=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}},H=class e extends B{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?B.near(a):new e(a)}content(){return new z(R.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new pr(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};H.prototype.visible=!1,B.jsonID(`node`,H);var pr=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new fr(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&H.isSelectable(n)?new H(t):B.near(t)}},mr=class e extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=z.empty){if(t==z.empty){e.delete(0,e.doc.content.size);let t=B.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return hr}};B.jsonID(`all`,mr);var hr={map(){return this},resolve(e){return new mr(e)}};function gr(e,t,n,r,i,a=!1){if(t.inlineContent)return V.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=gr(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&H.isSelectable(r))return H.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function _r(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof hn||i instanceof gn))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(B.near(e.doc.resolve(o),n))}var vr=1,yr=2,br=4,xr=class extends sr{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vr)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&vr)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yr,this}ensureMarks(e){return Me.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yr)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Me.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=br,this}get scrolledIntoView(){return(this.updated&br)>0}};function Sr(e,t){return!t||!e?e:e.bind(t)}var Cr=class{constructor(e,t,n){this.name=e,this.init=Sr(t.init,n),this.apply=Sr(t.apply,n)}},wr=[new Cr(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Cr(`selection`,{init(e,t){return e.selection||B.atStart(t.doc)},apply(e){return e.selection}}),new Cr(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Cr(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Tr=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wr.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Cr(e.key,e.spec.state,e))})}},Er=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new xr(this)}static create(t){let n=new Tr(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Tr(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Tr(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Qe.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=B.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Dr(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Dr(i,t,{})),n[r]=i}return n}var Or=class{constructor(e){this.spec=e,this.props={},e.props&&Dr(e.props,this,this.props),this.key=e.key?e.key.key:Ar(`plugin`)}getState(e){return e[this.key]}},kr=Object.create(null);function Ar(e){return e in kr?e+`$`+ ++kr[e]:(kr[e]=0,e+`$`)}var jr=class{constructor(e=`key`){this.key=Ar(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Mr=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Nr=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Pr=null,Fr=function(e,t,n){let r=Pr||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Ir=function(){Pr=null},Lr=function(e,t,n,r){return n&&(zr(e,t,n,r,-1)||zr(e,t,n,r,1))},Rr=/^(img|br|input|textarea|hr)$/i;function zr(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Br(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Wr(e)||Rr.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Mr(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Br(e):0}else return!1}}function Br(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Vr(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Br(e)}else if(e.parentNode&&!Wr(e))t=Mr(e),e=e.parentNode;else return null}}function Hr(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Wr(e))t=Mr(e)+1,e=e.parentNode;else return null}}function Ur(e,t,n){for(let r=t==0,i=t==Br(e);r||i;){if(e==n)return!0;let t=Mr(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Br(e)}}function Wr(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Gr=function(e){return e.focusNode&&Lr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Kr(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function qr(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Jr(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}var Yr=typeof navigator<`u`?navigator:null,Xr=typeof document<`u`?document:null,Zr=Yr&&Yr.userAgent||``,Qr=/Edge\/(\d+)/.exec(Zr),$r=/MSIE \d/.exec(Zr),ei=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zr),ti=!!($r||ei||Qr),ni=$r?document.documentMode:ei?+ei[1]:Qr?+Qr[1]:0,ri=!ti&&/gecko\/(\d+)/i.test(Zr);ri&&+(/Firefox\/(\d+)/.exec(Zr)||[0,0])[1];var ii=!ti&&/Chrome\/(\d+)/.exec(Zr),ai=!!ii,oi=ii?+ii[1]:0,si=!ti&&!!Yr&&/Apple Computer/.test(Yr.vendor),ci=si&&(/Mobile\/\w+/.test(Zr)||!!Yr&&Yr.maxTouchPoints>2),li=ci||(Yr?/Mac/.test(Yr.platform):!1),ui=Yr?/Win/.test(Yr.platform):!1,di=/Android \d/.test(Zr),fi=!!Xr&&`webkitFontSmoothing`in Xr.documentElement.style,pi=fi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mi(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function hi(e,t){return typeof e==`number`?e:e[t]}function gi(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function _i(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Nr(o);continue}let e=o,n=e==a.body,s=n?mi(a):gi(e),c=0,l=0;if(t.top<s.top+hi(r,`top`)?l=-(s.top-t.top+hi(i,`top`)):t.bottom>s.bottom-hi(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+hi(i,`top`)-s.top:t.bottom-s.bottom+hi(i,`bottom`)),t.left<s.left+hi(r,`left`)?c=-(s.left-t.left+hi(i,`left`)):t.right>s.right-hi(r,`right`)&&(c=t.right-s.right+hi(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Nr(o)}}function vi(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:yi(e.dom)}}function yi(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Nr(r));return t}function bi({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;xi(n,r==0?0:r-t)}function xi(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Si=null;function Ci(e){if(e.setActive)return e.setActive();if(Si)return e.focus(Si);let t=yi(e);e.focus(Si==null?{get preventScroll(){return Si={preventScroll:!0},!0}}:void 0),Si||(Si=!1,xi(t,0))}function wi(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=Fr(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Ti(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:wi(n,i)}function Ti(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Ni(r,1);if(n.top!=n.bottom&&Ei(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Ei(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Di(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Oi(e,t,n){let{node:r,offset:i}=wi(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function ki(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Ai(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Ei(t,i))return Ai(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function ji(e,t){let n=e.dom.ownerDocument,r,i=0,a=Jr(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!Ei(t,n)||(o=Ai(e.dom,t,n),!o))return null}if(si)for(let e=o;r&&e;e=Nr(e))e.draggable&&(r=void 0);if(o=Di(o,t),r){if(ri&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;fi&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=ki(e,r,i,t))}s??=Oi(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Mi(e){return e.top<e.bottom||e.left<e.right}function Ni(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Mi(e))return e}return Array.prototype.find.call(n,Mi)||e.getBoundingClientRect()}var Pi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Fi(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=fi||ri;if(r.nodeType==3)if(o&&(Pi.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Ni(Fr(r,i,i),n);if(ri&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Ni(Fr(r,i-1,i-1),-1);if(t.top==e.top){let n=Ni(Fr(r,i,i+1),-1);if(n.top!=e.top)return Ii(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Ii(Ni(Fr(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Br(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Li(e.getBoundingClientRect(),!1)}if(a==null&&i<Br(r)){let e=r.childNodes[i];if(e.nodeType==1)return Li(e.getBoundingClientRect(),!0)}return Li(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Br(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Fr(e,Br(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ii(Ni(t,1),!1)}if(a==null&&i<Br(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?Fr(e,0,+!o):e.nodeType==1?e:null:null;if(t)return Ii(Ni(t,-1),!0)}return Ii(Ni(r.nodeType==3?Fr(r):r,-n),n>=0)}function Ii(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Li(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ri(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function zi(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Ri(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Fi(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Fr(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Bi=/[\u0590-\u08ac]/;function Vi(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Bi.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Ri(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Hi=null,Ui=null,Wi=!1;function Gi(e,t,n){return Hi==t&&Ui==n?Wi:(Hi=t,Ui=n,Wi=n==`up`||n==`down`?zi(e,t,n):Vi(e,t,n))}var Ki=0,qi=1,Ji=2,Yi=3,Xi=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Ki,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Mr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof ra){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Zi&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Mr(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Mr(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Mr(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Mr(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((ri||si)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
7
- `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Mr(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(ri&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&si)&&Lr(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Lr(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&ri)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Ji:qi,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Yi:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ji:Yi}n=a}this.dirty=Ji}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ji:qi;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Zi=class extends Xi{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Ki&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Qi=class extends Xi{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},$i=class e extends Xi{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Vt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Yi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yi&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ki){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Ki}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=ba(a,n,o,r)),t>0&&(a=ba(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},ea=class e extends Xi{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Vt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=da(u,r,n),l?c=new ia(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new na(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>R.empty)}return e}matchesNode(e,t,n){return this.dirty==Ki&&e.eq(this.node)&&fa(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new ma(this,a&&a.node,e);_a(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Me.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Ji)&&(a&&this.protectLocalComposition(e,a),aa(this.contentDOM,this.children,e),ci&&va(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof V)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=ya(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Qi(this,i,t,r);e.input.compositionNodes.push(a),this.children=ba(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Yi||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Ki}updateOuterDeco(e){if(fa(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=la(this.dom,this.nodeDOM,ca(this.outerDeco,this.node,t),ca(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function ta(e,t,n,r,i){da(r,t,e);let a=new ea(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var na=class e extends ea{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Yi||this.dirty!=Ki&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ki||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Ki,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yi)}get domAtom(){return!1}isText(e){return this.node.text==e}},ra=class extends Xi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ki&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},ia=class extends ea{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Yi)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function aa(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=pa(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof $i){let t=r?r.previousSibling:e.lastChild;aa(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=pa(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var oa=function(e){e&&(this.nodeName=e)};oa.prototype=Object.create(null);var sa=[new oa];function ca(e,t,n){if(e.length==0)return sa;let r=n?sa[0]:new oa,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new oa(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new oa(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function la(e,t,n,r){if(n==sa&&r==sa)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=sa[0],i=t)}ua(i,o||sa[0],a)}return i}function ua(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function da(e,t,n){return la(e,e,sa,ca(t,n,e.nodeType!=1))}function fa(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function pa(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ma=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ha(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Ki,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=$i.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Yi&&a.dom==a.contentDOM&&(a.dirty=Ji),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof ea){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Yi&&fa(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ji,u.updateChildren(r,a+1),u.dirty=Ki),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!fa(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=ea.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=ea.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Zi(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof $i;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof na)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((si||ai)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new ra(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function ha(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof $i)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function ga(e,t){return e.type.side-t.type.side}function _a(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(ga);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function va(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function ya(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function ba(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function xa(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Gr(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&H.isSelectable(e)&&i.parent&&!(e.isInline&&Ur(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new H(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=Ma(e,u,s,n)}return l}function Sa(e){return e.editable?e.hasFocus():Pa(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ca(e,t=!1){let n=e.state.selection;if(Aa(e,n),!Sa(e))return;let r=e.input.mouseDown;if(!t&&ai&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Lr(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)ka(e);else{let{anchor:r,head:i}=n,a,o;wa&&!(n instanceof V)&&(n.$from.parent.inlineContent||(a=Ta(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Ta(e,n.to))),e.docView.setSelection(r,i,e,t),wa&&(a&&Da(a),o&&Da(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Oa(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var wa=si||ai&&oi<63;function Ta(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(si&&i&&i.contentEditable==`false`)return Ea(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Ea(i);if(a)return Ea(a)}}function Ea(e){return e.contentEditable=`true`,si&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Da(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Oa(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!Sa(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function ka(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Mr(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ti&&ni<=11&&(n.disabled=!0,n.disabled=!1)}function Aa(e,t){if(t instanceof H){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(ja(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else ja(e)}function ja(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Ma(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||V.between(t,n,r)}function Na(e){return e.editable&&!e.hasFocus()?!1:Pa(e)}function Pa(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Fa(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Lr(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ia(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&B.findFrom(a,t)}function La(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ra(e,t,n){let r=e.state.selection;if(r instanceof V){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return La(e,new V(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Ia(e.state,t);return n&&n instanceof H?La(e,n):!1}else if(!(li&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?H.isSelectable(i)?La(e,new H(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):fi?La(e,new V(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof H&&r.node.isInline)return La(e,new V(t>0?r.$to:r.$from));else{let n=Ia(e.state,t);return n?La(e,n):!1}}function za(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ba(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Va(e,t){return t<0?Ha(e):Ua(e)}function Ha(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(ri&&n.nodeType==1&&r<za(n)&&Ba(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Ba(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(Wa(n))break;else{let t=n.previousSibling;for(;t&&Ba(t,-1);)i=n.parentNode,a=Mr(t),t=t.previousSibling;if(t)n=t,r=za(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?qa(e,n,r):i&&qa(e,i,a)}function Ua(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=za(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(Ba(e,1))a=n,o=++r;else break}else if(Wa(n))break;else{let t=n.nextSibling;for(;t&&Ba(t,1);)a=t.parentNode,o=Mr(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=za(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&qa(e,a,o)}function Wa(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ga(e,t){for(;e&&t==e.childNodes.length&&!Wr(e);)t=Mr(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Ka(e,t){for(;e&&!t&&!Wr(e);)t=Mr(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function qa(e,t,n){if(t.nodeType!=3){let e,r;(r=Ga(t,n))?(t=r,n=0):(e=Ka(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Gr(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&Ca(e)},50)}function Ja(e,t){let n=e.state.doc.resolve(t);if(!(ai||ui)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Ya(e,t,n){let r=e.state.selection;if(r instanceof V&&!r.empty||n.indexOf(`s`)>-1||li&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Ia(e.state,t);if(n&&n instanceof H)return La(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof mr?B.near(n,t):B.findFrom(n,t);return o?La(e,o):!1}return!1}function Xa(e,t){if(!(e.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Za(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Qa(e){if(!si||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Za(e,n,`true`),setTimeout(()=>Za(e,n,`false`),20)}return!1}function $a(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function eo(e,t){let n=t.keyCode,r=$a(t);if(n==8||li&&n==72&&r==`c`)return Xa(e,-1)||Va(e,-1);if(n==46&&!t.shiftKey||li&&n==68&&r==`c`)return Xa(e,1)||Va(e,1);if(n==13||n==27)return!0;if(n==37||li&&n==66&&r==`c`){let t=n==37?Ja(e,e.state.selection.from)==`ltr`?-1:1:-1;return Ra(e,t,r)||Va(e,t)}else if(n==39||li&&n==70&&r==`c`){let t=n==39?Ja(e,e.state.selection.from)==`ltr`?1:-1:1;return Ra(e,t,r)||Va(e,t)}else if(n==38||li&&n==80&&r==`c`)return Ya(e,-1,r)||Va(e,-1);else if(n==40||li&&n==78&&r==`c`)return Qa(e)||Ya(e,1,r)||Va(e,1);else if(r==(li?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function to(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Vt.fromSchema(e.state.schema),s=po(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=uo[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
8
-
9
- `),slice:t}}function no(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new z(R.from(e.state.schema.text(t.replace(/\r\n?/g,`
10
- `))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Vt.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=go(n),fi&&_o(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Dt.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!ro.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=vo(lo(s,+u[1],+u[2]),u[4]);else if(s=z.maxOpen(io(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=lo(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var ro=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function io(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&oo(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=so(a[a.length-1],i.length));let n=ao(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return R.from(a)}return e}function ao(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,R.from(e));return e}function oo(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=oo(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(R.from(ao(n,e,i+1))))}}function so(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,so(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(R.empty,!0);return e.copy(n.append(r))}function co(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=co(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(R.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function lo(e,t,n){return t<e.openStart&&(e=new z(co(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new z(co(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var uo={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},fo=null;function po(){return fo||=document.implementation.createHTMLDocument(`title`)}var mo=null;function ho(e){let t=window.trustedTypes;return t?(mo||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),mo.createHTML(e)):e}function go(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=po().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&uo[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=ho(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function _o(e){let t=e.querySelectorAll(ai?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function vo(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=R.from(t.create(r[e+1],i)),a++,o++}return new z(i,a,o)}var yo={},bo={},xo={touchstart:!0,touchmove:!0},So=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Co(e){for(let t in yo){let n=yo[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Oo(e,t)&&!Do(e,t)&&(e.editable||!(t.type in bo))&&n(e,t)},xo[t]?{passive:!0}:void 0)}si&&e.dom.addEventListener(`input`,()=>null),Eo(e)}function wo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function To(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Eo(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Do(e,t))})}function Do(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Oo(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function ko(e,t){!Do(e,t)&&yo[t.type]&&(e.editable||!(t.type in bo))&&yo[t.type](e,t)}bo.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Ko(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(di&&ai&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),ci&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Kr(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||eo(e,n)?n.preventDefault():wo(e,`key`)},bo.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},bo.keypress=(e,t)=>{let n=t;if(Ko(e)||!n.charCode||n.ctrlKey&&!n.altKey||li&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Ao(e){return{left:e.clientX,top:e.clientY}}function jo(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Mo(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function No(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Po(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&H.isSelectable(r)?(No(e,new H(n),`pointer`),!0):!1}function Fo(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof H&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(H.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(No(e,H.create(e.state.doc,i),`pointer`),!0)}function Io(e,t,n,r,i){return Mo(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Fo(e,n):Po(e,n))}function Lo(e,t,n,r){return Mo(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Ro(e,t,n,r){return Mo(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||zo(e,n,r)}function zo(e,t,n){if(n.button!=0)return!1;let r=Bo(e,t,!0),i=e.state.doc;return r?(No(e,r,`pointer`),r instanceof V&&i.eq(e.state.doc)&&(e.input.mouseDown=new Go(e,r)),!0):!1}function Bo(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?V.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return V.create(r,a+1,a+1+t.content.size);if(n&&H.isSelectable(t))return H.create(r,a)}return null}function Vo(e){return Qo(e)}var Ho=li?`metaKey`:`ctrlKey`;yo.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Vo(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&jo(n,e.input.lastClick)&&!n[Ho]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Ao(n));o&&(a==`singleClick`?e.input.mouseDown=new Wo(e,o,n,!!r):(a==`doubleClick`?Lo:Ro)(e,o.pos,o.inside,n)?n.preventDefault():wo(e,`pointer`))};var Uo=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},Wo=class extends Uo{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Ho],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof H&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ri&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),wo(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Ca(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ao(e))),this.updateAllowDefault(e),this.allowDefault||!t?wo(this.view,`pointer`):Io(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||si&&this.mightDrag&&!this.mightDrag.node.isAtom||ai&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(No(this.view,B.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):wo(this.view,`pointer`)}move(e){this.updateAllowDefault(e),wo(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},Go=class extends Uo{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),wo(this.view,`pointer`);let t=this.view.posAtCoords(Ao(e)),n=t&&Bo(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];No(this.view,V.create(r,a,o),`pointer`)}};yo.touchstart=e=>{e.input.lastTouch=Date.now(),Vo(e),wo(e,`pointer`)},yo.touchmove=e=>{e.input.lastTouch=Date.now(),wo(e,`pointer`)},yo.contextmenu=e=>Vo(e);function Ko(e,t){return e.composing?!0:si&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var qo=di?5e3:-1;bo.compositionstart=bo.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof V&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||ai&&ui&&Jo(e)))e.markCursor=e.state.storedMarks||n.marks(),Qo(e,!0),e.markCursor=null;else if(Qo(e,!t.selection.empty),ri&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Yo(e,qo)};function Jo(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}bo.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Yo(e,20))};function Yo(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Qo(e),t))}function Xo(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Zo(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Vr(t.focusNode,t.focusOffset),r=Hr(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Qo(e,t=!1){if(!(di&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Xo(e),t||e.docView&&e.docView.dirty){let n=xa(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function $o(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var es=ti&&ni<15||ci&&pi<604;yo.copy=bo.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=es?null:n.clipboardData,{dom:o,text:s}=to(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):$o(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function ts(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function ns(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?rs(e,r.value,null,i,t):rs(e,r.textContent,r.innerHTML,i,t)},50)}function rs(e,t,n,r,i){let a=no(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||z.empty)))return!0;if(!a)return!1;let o=ts(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function is(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}bo.paste=(e,t)=>{let n=t;if(e.composing&&!di)return;let r=es?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&rs(e,is(r),r.getData(`text/html`),i,n)?n.preventDefault():ns(e,n)};var as=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},ss=li?`altKey`:`ctrlKey`;function cs(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[ss]:!n}yo.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Ao(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof H?i.to-1:i.to))){if(r&&r.mightDrag)o=H.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=H.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=to(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!ai||oi>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(es?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,es||n.dataTransfer.setData(`text/plain`,c),e.dragging=new as(l,cs(e,n),o)},yo.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},bo.dragover=bo.dragenter=(e,t)=>t.preventDefault(),bo.drop=(e,t)=>{try{ls(e,t,e.dragging)}finally{e.dragging=null}};function ls(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ao(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=no(e,is(t.dataTransfer),es?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&cs(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||z.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Hn(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&H.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new H(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(Ma(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}yo.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ca(e)},20))},yo.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},yo.beforeinput=(e,t)=>{if(ai&&di&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Kr(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in bo)yo[e]=bo[e];function us(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var ds=class e{constructor(e,t){this.toDOM=e,this.spec=t||gs,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new ms(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&us(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},fs=class e{constructor(e,t){this.attrs=e,this.spec=t||gs}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new ms(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&us(this.attrs,t.attrs)&&us(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},ps=class e{constructor(e,t){this.attrs=e,this.spec=t||gs}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new ms(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&us(this.attrs,t.attrs)&&us(this.spec,t.spec)}destroy(){}},ms=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new ds(n,r))}static inline(t,n,r,i){return new e(t,n,new fs(r,i))}static node(t,n,r,i){return new e(t,n,new ps(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof fs}get widget(){return this.type instanceof ds}},hs=[],gs={},_s=class e{constructor(e,t){this.local=e.length?e:hs,this.children=t.length?t:hs}static create(e,t){return t.length?Ts(t,e,0,gs):vs}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==vs||e.maps.length==0?this:this.mapInner(e,t,0,0,n||gs)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?bs(this.children,o||[],t,n,r,i,a):o?new e(o.sort(Es),hs):vs}add(t,n){return n.length?this==vs?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=Cs(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Ts(s,e,o+1,gs)),a+=3}});let o=xs(a?ws(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(Es):this.local,i||this.children)}remove(e){return e.length==0||this==vs?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==vs?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):vs}forChild(t,n){if(this==vs)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof fs){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(Es),hs);return r?new ys([t,r]):t}return r||vs}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return Ds(this.localsInner(e))}localsInner(e){if(this==vs)return hs;if(e.inlineContent||!this.local.some(fs.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof fs||t.push(this.local[e]);return t}forEachSet(e){e(this)}};_s.empty=new _s([],[]),_s.removeOverlap=Ds;var vs=_s.empty,ys=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,gs));return e.from(r)}forChild(t,n){if(n.isLeaf)return _s.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=vs&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?Ds(n?t:t.sort(Es)):hs}static from(t){switch(t.length){case 0:return vs;case 1:return t[0];default:return new e(t.every(e=>e instanceof _s)?t:t.reduce((e,t)=>e.concat(t instanceof _s?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function bs(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==vs?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Ts(Ss(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new _s(t.sort(Es),s)}function xs(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ms(i.from+t,i.to+t,i.type))}return n}function Ss(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Cs(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function ws(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Ts(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Cs(e,t,o+n);if(s){a=!0;let e=Ts(s,t,n+o+1,r);e!=vs&&i.push(o,o+t.nodeSize,e)}});let o=xs(a?ws(e):e,-n).sort(Es);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new _s(o,i):vs}function Es(e,t){return e.from-t.from||e.to-t.to}function Ds(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),Os(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),Os(t,i,r.copy(a.from,r.to)));break}}}return t}function Os(e,t,n){for(;t<e.length&&Es(n,e[t])>0;)t++;e.splice(t,0,n)}function ks(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=vs&&t.push(r)}),e.cursorWrapper&&t.push(_s.create(e.state.doc,[e.cursorWrapper.deco])),ys.from(t)}var As={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},js=ti&&ni<=11,Ms=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Ns=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ms,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);ti&&ni<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():si&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),js&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,As)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Na(this.view)){if(this.suppressingSelectionUpdates)return Ca(this.view);if(ti&&ni<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Lr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Nr(n))t.add(n);for(let r=e.anchorNode;r;r=Nr(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Na(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ai&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(ri&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||zs(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gr(n)&&(c=xa(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ca(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Is(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Bs(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Ca(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ti&&ni<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Mr(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Mr(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},Ps=new WeakMap,Fs=!1;function Is(e){if(!Ps.has(e)&&(Ps.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=ri,Fs)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Fs=!0}}function Ls(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Lr(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Rs(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ls(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Ls(e,n):null}function zs(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Bs(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Vs(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Gr(c)||l.push({node:c.focusNode,offset:c.focusOffset})),ai&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Dt.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:Hs,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function Hs(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(si&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||si&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var Us=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ws(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=xa(e,t);if(n&&!e.state.selection.eq(n)){if(ai&&di&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Kr(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Vs(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Ys(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(ci&&e.input.lastIOSEnter>Date.now()-225||di)&&i.some(e=>e.nodeType==1&&!Us.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Kr(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof V&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Gs(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof V&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ti&&ni<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((ci&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Kr(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&qs(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Kr(8,`Backspace`)))){di&&ai&&e.domObserver.suppressSelectionUpdates();return}ai&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),di&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Kr(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Gs(e,n.doc,l.sel);t&&!(ai&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||ti&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){ti&&ni<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ca(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Ks(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Gs(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ma(e,t.resolve(n.anchor),t.resolve(n.head))}function Ks(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(R.from(l).eq(e))return{mark:s,type:o}}function qs(e,t,n,r,i){if(n-t<=i.pos-r.pos||Js(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Js(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Js(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Js(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Ys(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Xs=no,Zs=Qo,Qs=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new So,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ac),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=tc(this),ec(this),this.nodeViews=rc(this),this.docView=ta(this.state.doc,$s(this),ks(this),this.dom,this),this.domObserver=new Ns(this,(e,t,n,r)=>Ws(this,e,t,n,r)),this.domObserver.start(),Co(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Eo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ac),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Xo(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rc(this);ic(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Eo(this),this.editable=tc(this),ec(this);let o=ks(this),s=$s(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&vi(this);if(i){this.domObserver.stop();let t=l&&(ti||ai)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&nc(n.selection,e.selection);if(l){let n=ai?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Zo(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=ta(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Fa(this)&&i.delaySelUpdate())?Ca(this,t):(Aa(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&bi(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof H){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&_i(this,t.getBoundingClientRect(),e)}else _i(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new as(e.slice,e.move,r<0?void 0:H.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(ti){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ci(this.dom),Ca(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ji(this,e)}coordsAtPos(e,t=1){return Fi(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Gi(this,t||this.state,e)}pasteHTML(e,t){return rs(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return rs(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return to(this,e)}destroy(){this.docView&&(To(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ks(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ir())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ko(this,e)}domSelectionRange(){let e=this.domSelection();return e?si&&this.root.nodeType===11&&qr(this.dom.ownerDocument)==this.dom&&Rs(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Qs.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function $s(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[ms.node(0,e.state.doc.content.size,t)]}function ec(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:ms.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function tc(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function nc(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function rc(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function ic(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function ac(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var oc=t({Decoration:()=>ms,DecorationSet:()=>_s,EditorView:()=>Qs,__endComposition:()=>Zs,__parseFromClipboard:()=>Xs}),sc=new jr(`upload-image`),cc=({imageClass:e})=>new Or({key:sc,state:{init(){return _s.empty},apply(t,n){n=n.map(t.mapping,t.doc);let r=t.getMeta(this);if(r?.add){let{id:i,pos:a,src:o}=r.add,s=document.createElement(`div`);s.setAttribute(`class`,`img-placeholder`);let c=document.createElement(`img`);c.setAttribute(`class`,e),c.src=o,s.appendChild(c);let l=ms.widget(a+1,s,{id:i});n=n.add(t.doc,[l])}else r?.remove&&(n=n.remove(n.find(void 0,void 0,e=>e.id===r.remove.id)));return n}},props:{decorations(e){return this.getState(e)}}});function lc(e,t){let n=sc.getState(e).find(void 0,void 0,e=>e.id===t);return n.length?n[0]?.from:null}var uc=({validateFn:e,onUpload:t})=>(n,r,i)=>{if(!e?.(n))return;let a={},o=r.state.tr;o.selection.empty||o.deleteSelection();let s=new FileReader;s.readAsDataURL(n),s.onload=()=>{o.setMeta(sc,{add:{id:a,pos:i,src:s.result}}),r.dispatch(o)},t(n).then(e=>{let{schema:t}=r.state,n=lc(r.state,a);if(n==null)return;let i=typeof e==`object`?s.result:e,o=t.nodes.image?.create({src:i});if(!o)return;let c=r.state.tr.replaceWith(n,n,o).setMeta(sc,{remove:{id:a}});r.dispatch(c)},()=>{let e=r.state.tr.delete(i,i).setMeta(sc,{remove:{id:a}});r.dispatch(e)})},dc=(e,t,n)=>{if(t.clipboardData?.files.length){t.preventDefault();let[r]=Array.from(t.clipboardData.files),i=e.state.selection.from;return r&&n(r,e,i),!0}return!1},fc=(e,t,n,r)=>{if(!n&&t.dataTransfer?.files.length){t.preventDefault();let[n]=Array.from(t.dataTransfer.files),i=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&r(n,e,i?.pos??-1),!0}return!1},pc=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Read failed`)),r.readAsDataURL(e)}),mc=e=>new Promise(t=>{let n=new Image;n.src=e,n.onload=()=>t(e),n.onerror=()=>t(e)}),hc=({uploadImage:e,onError:t,maxSizeMb:n=20}={})=>uc({onUpload:async t=>mc(e?await e(t):await pc(t)),validateFn:e=>e.type.includes(`image/`)?e.size/1024/1024>n?(t?.(Error(`File size too big (max ${n}MB).`)),!1):!0:(t?.(Error(`File type not supported.`)),!1)}),gc=u(),U=e(r(),1),_c=e=>{let t=e,n=new Set;return{getSnapshot:()=>t,setValue:e=>{if(!Object.is(e,t)){t=e;for(let e of n)e()}},subscribe:e=>(n.add(e),()=>{n.delete(e)})}},vc=_c(``),yc=_c(null),bc=()=>(0,U.useSyncExternalStore)(vc.subscribe,vc.getSnapshot,vc.getSnapshot),xc=()=>(0,U.useSyncExternalStore)(yc.subscribe,yc.getSnapshot,yc.getSnapshot),W=S(),Sc=(0,U.createContext)({}),Cc=e=>{let t=(0,gc.c)(8),{query:n,range:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>{vc.setValue(n)},a=[n],t[0]=n,t[1]=i,t[2]=a),(0,U.useEffect)(i,a);let o,s;t[3]===r?(o=t[4],s=t[5]):(o=()=>{yc.setValue(r)},s=[r],t[3]=r,t[4]=o,t[5]=s),(0,U.useEffect)(o,s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[6]=c):c=t[6],(0,U.useEffect)(Ec,c);let l;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsx)(Sc.Consumer,{children:Dc}),t[7]=l):l=t[7],l},wc=({children:e,className:t,ref:n,...r})=>{let i=bc();return(0,W.jsx)(Sc.Consumer,{children:a=>(0,W.jsx)(a.In,{children:(0,W.jsxs)(O,{ref:n,onKeyDown:e=>{e.stopPropagation()},id:`slash-command`,className:t,...r,children:[(0,W.jsx)(O.Input,{value:i,onValueChange:vc.setValue,style:{display:`none`}}),e]})})})},Tc=O.List;function Ec(){let e=[`ArrowUp`,`ArrowDown`,`Enter`],t=t=>{if(e.includes(t.key)){t.preventDefault();let e=document.querySelector(`#slash-command`);return e&&e.dispatchEvent(new KeyboardEvent(`keydown`,{key:t.key,cancelable:!0,bubbles:!0})),!1}};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}}function Dc(e){return(0,W.jsx)(e.Out,{})}var Oc=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),kc=n(((e,t)=>{t.exports=Oc()})),Ac=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function jc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Mc=(e,t,n)=>{let r=jc(e,n);if(!r)return!1;let i=Rc(r);if(!i){let n=r.blockRange(),i=n&&Sn(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(nl(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ic(a,`end`)||H.isSelectable(a)))for(let n=r.depth;;n--){let o=Un(e.doc,r.before(n),r.after(n),z.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Ic(a,`end`)?B.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):H.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Nc=(e,t,n)=>{let r=jc(e,n);if(!r)return!1;let i=Rc(r);return i?Fc(e,i,t):!1},Pc=(e,t,n)=>{let r=zc(e,n);if(!r)return!1;let i=Hc(r);return i?Fc(e,i,t):!1};function Fc(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Un(e.doc,i,o,z.empty);if(!s||s.from!=i||s instanceof hn&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(V.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Ic(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Lc=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Rc(r)}let o=a&&a.nodeBefore;return!o||!H.isSelectable(o)?!1:(t&&t(e.tr.setSelection(H.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Rc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function zc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Bc=(e,t,n)=>{let r=zc(e,n);if(!r)return!1;let i=Hc(r);if(!i)return!1;let a=i.nodeAfter;if(nl(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ic(a,`start`)||H.isSelectable(a))){let n=Un(e.doc,r.before(),r.after(),z.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ic(a,`start`)?B.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):H.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Vc=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Hc(r)}let o=a&&a.nodeAfter;return!o||!H.isSelectable(o)?!1:(t&&t(e.tr.setSelection(H.create(e.doc,a.pos)).scrollIntoView()),!0)};function Hc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Uc=(e,t)=>{let n=e.selection,r=n instanceof H,i;if(r){if(n.node.isTextblock||!In(e.doc,n.from))return!1;i=n.from}else if(i=zn(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(H.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Wc=(e,t)=>{let n=e.selection,r;if(n instanceof H){if(n.node.isTextblock||!In(e.doc,n.to))return!1;r=n.to}else if(r=zn(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Gc=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Sn(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Kc=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
11
- `).scrollIntoView()),!0)};function qc(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Jc=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=qc(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(B.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Yc=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof mr||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=qc(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(V.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},Xc=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Pn(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Sn(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Zc(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof H&&t.selection.node.isBlock)return!r.parentOffset||!Pn(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=qc(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof V||t.selection instanceof mr)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Pn(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,Pn(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var Qc=Zc(),$c=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(H.create(e.doc,i))),!0)},el=(e,t)=>(t&&t(e.tr.setSelection(new mr(e.doc))),!0);function tl(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||In(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function nl(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&tl(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=R.empty;for(let e=o.length-1;e>=0;e--)s=R.from(o[e].create(null,s));s=R.from(i.copy(s));let c=e.tr.step(new gn(t.pos-1,r,t.pos,r,new z(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&In(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:B.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Sn(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Ic(a,`start`,!0)&&Ic(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=R.empty;for(let e=o.length-1;e>=0;e--)r=R.from(o[e].copy(r));n(e.tr.step(new gn(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new z(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function rl(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(V.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var il=rl(-1),al=rl(1);function ol(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&wn(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function sl(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function cl(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var ll=cl(Ac,Mc,Lc),ul=cl(Ac,Bc,Vc),dl={Enter:cl(Kc,Yc,Xc,Qc),"Mod-Enter":Jc,Backspace:ll,"Mod-Backspace":ll,"Shift-Backspace":ll,Delete:ul,"Mod-Delete":ul,"Mod-a":el},fl={"Ctrl-h":dl.Backspace,"Alt-Backspace":dl[`Mod-Backspace`],"Ctrl-d":dl.Delete,"Ctrl-Alt-Backspace":dl[`Mod-Delete`],"Alt-Delete":dl[`Mod-Delete`],"Alt-d":dl[`Mod-Delete`],"Ctrl-a":il,"Ctrl-e":al};for(let e in dl)fl[e]=dl[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function pl(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return ml(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function ml(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new Xe(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Xe(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=wn(a,n,r,t);return s?(e&&hl(e,t,s,i,n),!0):!1}function hl(e,t,n,r,i){let a=R.empty;for(let e=n.length-1;e>=0;e--)a=R.from(n[e].type.create(n[e].attrs,a));e.step(new gn(t.start-(r?2:0),t.end,t.start,t.end,new z(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Pn(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function gl(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?_l(t,n,e,a):vl(t,n,a):!0:!1}}function _l(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new gn(a-1,o,a,o,new z(R.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Xe(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Sn(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return In(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function vl(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?R.empty:R.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new gn(d-+!!s,f+ +!!c,d+1,f-1,new z((s?R.empty:R.from(i.copy(R.empty))).append(c?R.empty:R.from(i.copy(R.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function yl(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=R.from(r?e.create():null),o=new z(R.from(e.create(null,R.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new gn(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}for(var bl=e(p(),1),xl=kc(),Sl={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},Cl={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},wl=typeof navigator<`u`&&/Mac/.test(navigator.platform),Tl=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),El=0;El<10;El++)Sl[48+El]=Sl[96+El]=String(El);for(var El=1;El<=24;El++)Sl[El+111]=`F`+El;for(var El=65;El<=90;El++)Sl[El]=String.fromCharCode(El+32),Cl[El]=String.fromCharCode(El);for(var Dl in Sl)Cl.hasOwnProperty(Dl)||(Cl[Dl]=Sl[Dl]);function Ol(e){var t=!(wl&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Tl&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Cl:Sl)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var kl=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Al=typeof navigator<`u`&&/Win/.test(navigator.platform);function jl(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))kl?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function Ml(e){let t=Object.create(null);for(let n in e)t[jl(n)]=e[n];return t}function Nl(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function Pl(e){return new Or({props:{handleKeyDown:Fl(e)}})}function Fl(e){let t=Ml(e);return function(e,n){let r=Ol(n),i,a=t[Nl(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[Nl(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Al&&n.ctrlKey&&n.altKey)&&(i=Sl[n.keyCode])&&i!=r){let r=t[Nl(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var Il=Object.defineProperty,Ll=(e,t)=>{for(var n in t)Il(e,n,{get:t[n],enumerable:!0})};function Rl(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var zl=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Rl({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Bl={};Ll(Bl,{blur:()=>Vl,clearContent:()=>Hl,clearNodes:()=>Ul,command:()=>Wl,createParagraphNear:()=>Gl,cut:()=>Kl,deleteCurrentNode:()=>ql,deleteNode:()=>Yl,deleteRange:()=>Xl,deleteSelection:()=>eu,enter:()=>tu,exitCode:()=>nu,extendMarkRange:()=>lu,first:()=>uu,focus:()=>_u,forEach:()=>vu,insertContent:()=>yu,insertContentAt:()=>Tu,joinBackward:()=>Ou,joinDown:()=>Du,joinForward:()=>ku,joinItemBackward:()=>Au,joinItemForward:()=>ju,joinTextblockBackward:()=>Mu,joinTextblockForward:()=>Nu,joinUp:()=>Eu,keyboardShortcut:()=>Iu,lift:()=>Ru,liftEmptyBlock:()=>zu,liftListItem:()=>Bu,newlineInCode:()=>Vu,resetAttributes:()=>Wu,scrollIntoView:()=>Gu,selectAll:()=>Ku,selectNodeBackward:()=>qu,selectNodeForward:()=>Ju,selectParentNode:()=>Yu,selectTextblockEnd:()=>Xu,selectTextblockStart:()=>Zu,setContent:()=>$u,setMark:()=>Qd,setMeta:()=>$d,setNode:()=>ef,setNodeSelection:()=>tf,setTextDirection:()=>nf,setTextSelection:()=>rf,sinkListItem:()=>af,splitBlock:()=>sf,splitListItem:()=>cf,toggleList:()=>ff,toggleMark:()=>pf,toggleNode:()=>mf,toggleWrap:()=>hf,undoInputRule:()=>gf,unsetAllMarks:()=>_f,unsetMark:()=>vf,unsetTextDirection:()=>yf,updateAttributes:()=>bf,wrapIn:()=>xf,wrapInList:()=>Sf});var Vl=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),Hl=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Ul=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Sn(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Wl=e=>t=>e(t),Gl=()=>({state:e,dispatch:t})=>Yc(e,t),Kl=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new V(r.doc.resolve(Math.max(o-1,0)))),!0},ql=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function Jl(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Yl=e=>({tr:t,state:n,dispatch:r})=>{let i=Jl(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Xl=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},Zl=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Ql=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return Zl(r)?n===`left`?e.start()-1:e.end()+1:e.pos},$l=(e,t,n)=>({from:Ql(e,n,`left`),to:Ql(t,n,`right`)}),eu=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=$l(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},tu=()=>({commands:e})=>e.keyboardShortcut(`Enter`),nu=()=>({state:e,dispatch:t})=>Jc(e,t);function ru(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function iu(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:ru(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function au(e,t,n={}){return e.find(e=>e.type===t&&iu(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ou(e,t,n={}){return!!au(e,t,n)}function su(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!au([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&ou([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&ou([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function cu(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var lu=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=cu(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=su(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=V.create(o,e.from,e.to);n.setSelection(t)}}return!0},uu=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function du(e){return e instanceof V}function fu(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function pu(e,t=null){if(!t)return null;let n=B.atStart(e),r=B.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?V.create(e,fu(0,i,a),fu(e.content.size,i,a)):V.create(e,fu(t,i,a),fu(t,i,a))}function mu(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function hu(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function gu(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var _u=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(hu()||mu())&&r.dom.focus(),gu()&&!hu()&&!mu()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!du(n.state.selection))return o(),!0;let s=pu(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vu=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),yu=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),bu=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&bu(r)}return e};function xu(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return bu(n)}function Su(e,t,n){if(e instanceof Qe||e instanceof R)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return R.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),Su(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Ct({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Dt.fromSchema(a).parseSlice(xu(e),n.parseOptions):Dt.fromSchema(a).parse(xu(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Dt.fromSchema(t);return n.slice?r.parseSlice(xu(e),n.parseOptions).content:r.parse(xu(e),n.parseOptions)}return Su(``,t,n)}function Cu(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof hn||i instanceof gn))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(B.near(e.doc.resolve(o),n))}var wu=e=>!(`type`in e),Tu=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Su(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=Su(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((wu(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof R){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Cu(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},Eu=()=>({state:e,dispatch:t})=>Uc(e,t),Du=()=>({state:e,dispatch:t})=>Wc(e,t),Ou=()=>({state:e,dispatch:t})=>Mc(e,t),ku=()=>({state:e,dispatch:t})=>Bc(e,t),Au=()=>({state:e,dispatch:t,tr:n})=>{try{let r=zn(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ju=()=>({state:e,dispatch:t,tr:n})=>{try{let r=zn(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Mu=()=>({state:e,dispatch:t})=>Nc(e,t),Nu=()=>({state:e,dispatch:t})=>Pc(e,t);function Pu(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function Fu(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))hu()||Pu()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Iu=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Fu(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Lu(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?Jl(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>iu(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Ru=(e,t={})=>({state:n,dispatch:r})=>Lu(n,Jl(e,n.schema),t)?Gc(n,r):!1,zu=()=>({state:e,dispatch:t})=>Xc(e,t),Bu=e=>({state:t,dispatch:n})=>gl(Jl(e,t.schema))(t,n),Vu=()=>({state:e,dispatch:t})=>Kc(e,t);function Hu(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Uu(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Wu=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Hu(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=Jl(e,r.schema)),s===`mark`&&(o=cu(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Uu(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Uu(a.attrs,t))))})})}),c},Gu=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Ku=()=>({tr:e,dispatch:t})=>{if(t){let t=new mr(e.doc);e.setSelection(t)}return!0},qu=()=>({state:e,dispatch:t})=>Lc(e,t),Ju=()=>({state:e,dispatch:t})=>Vc(e,t),Yu=()=>({state:e,dispatch:t})=>$c(e,t),Xu=()=>({state:e,dispatch:t})=>al(e,t),Zu=()=>({state:e,dispatch:t})=>il(e,t);function Qu(e,t,n={},r={}){return Su(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $u=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Qu(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function ed(e,t){let n=cu(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function td(e,t){let n=new sr(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function nd(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function rd(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function id(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function ad(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function od(e){return t=>ad(t.$from,e)}function G(e,t,n){return e.config[t]===void 0&&e.parent?G(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?G(e.parent,t,n):null}):e.config[t]}function sd(e){return e.map(e=>{let t=G(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...sd(t())]:e}).flat(10)}function cd(e,t){let n=Vt.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function ld(e){return typeof e==`function`}function ud(e,t=void 0,...n){return ld(e)?t?e.bind(t)(...n):e(...n):e}function dd(e={}){return Object.keys(e).length===0&&e.constructor===Object}function fd(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function pd(e){let t=[],{nodeExtensions:n,markExtensions:r}=fd(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=G(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=G(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function md(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function hd(e){let t=[],n=md(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function gd(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...hd(n[e]),...hd(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function _d(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>gd(e,t),{})}function vd(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function yd(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):vd(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function bd(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&dd(t)?!1:t!=null))}function xd(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Sd(e,t){let n=pd(e),{nodeExtensions:r,markExtensions:i}=fd(e);return new Ct({topNode:r.find(e=>G(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bd({...e.reduce((e,t)=>{let n=G(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:ud(G(r,`content`,a)),marks:ud(G(r,`marks`,a)),group:ud(G(r,`group`,a)),inline:ud(G(r,`inline`,a)),atom:ud(G(r,`atom`,a)),selectable:ud(G(r,`selectable`,a)),draggable:ud(G(r,`draggable`,a)),code:ud(G(r,`code`,a)),whitespace:ud(G(r,`whitespace`,a)),linebreakReplacement:ud(G(r,`linebreakReplacement`,a)),defining:ud(G(r,`defining`,a)),isolating:ud(G(r,`isolating`,a)),attrs:Object.fromEntries(i.map(xd))}),s=ud(G(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yd(e,i)));let c=G(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:_d(e,i)}));let l=G(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bd({...e.reduce((e,t)=>{let n=G(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:ud(G(r,`inclusive`,a)),excludes:ud(G(r,`excludes`,a)),group:ud(G(r,`group`,a)),spanning:ud(G(r,`spanning`,a)),code:ud(G(r,`code`,a)),attrs:Object.fromEntries(i.map(xd))}),s=ud(G(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yd(e,i)));let c=G(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:_d(e,i)})),[r.name,o]}))})}function Cd(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function wd(e){return e.sort((e,t)=>{let n=G(e,`priority`)||100,r=G(t,`priority`)||100;return n>r?-1:+(n<r)})}function Td(e){let t=wd(sd(e)),n=Cd(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Ed(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
12
-
13
- `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Dd(e,t){return Ed(e,{from:0,to:e.content.size},t)}function Od(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function kd(e,t){let n=Jl(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function Ad(e,t){let n=Hu(typeof t==`string`?t:t.name,e.schema);return n===`node`?kd(e,t):n===`mark`?ed(e,t):{}}function jd(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Md(e){let t=jd(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Nd(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Md(r)}function Pd(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=su(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var Fd=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function Id(e,t){return t.nodes[e]||t.marks[e]||null}function Ld(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var Rd=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function zd(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?cu(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>iu(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>iu(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Bd(e,t,n={}){if(!t)return Lu(e,null,n)||zd(e,null,n);let r=Hu(t,e.schema);return r===`node`?Lu(e,t,n):r===`mark`?zd(e,t,n):!1}var Vd=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=od(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Hd=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Ud(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Wd(e,t){let{nodeExtensions:n}=fd(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=ud(G(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function Gd(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Gd(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Kd(e){return e instanceof H}var qd=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Jd(e,t){let n=t.mapping.mapResult(e.position);return{position:new qd(n.pos),mapResult:n}}function Yd(e){return new qd(e)}function Xd(e,t,n){let r=e.state.doc.content.size,i=fu(t,0,r),a=fu(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function Zd(e,t,n){let{selection:r}=t,i=null;if(du(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Qd=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=cu(e,r.schema);if(i)if(o){let e=ed(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Zd(r,n,c)},$d=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),ef=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=Jl(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>sl(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>sl(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},tf=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=fu(e,0,n.content.size),i=H.create(n,r);t.setSelection(i)}return!0},nf=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},rf=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=V.atStart(n).from,o=V.atEnd(n).to,s=fu(r,a,o),c=fu(i,a,o),l=V.create(n,s,c);t.setSelection(l)}return!0},af=e=>({state:t,dispatch:n})=>yl(Jl(e,t.schema))(t,n);function of(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var sf=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Ld(l,s.node().type.name,s.node().attrs);if(a instanceof H&&a.node.isBlock)return!s.parentOffset||!Pn(o,s.pos)?!1:(r&&(e&&of(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:nd(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Pn(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Pn(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof V&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&of(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},cf=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=Jl(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=R.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=R.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Ld(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(R.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new z(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(V.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Ld(d,u.type.name,u.attrs),...t},m={...Ld(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Pn(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},lf=(e,t)=>{let n=od(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&In(e.doc,n.pos)&&e.join(n.pos),!0},uf=(e,t)=>{let n=od(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&In(e.doc,r)&&e.join(r),!0};function df(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return V.between(r,i)}var ff=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=Jl(e,o.schema),m=Jl(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=od(e=>Wd(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&Wd(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=df(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Wd(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>lf(a,p)).command(()=>uf(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>lf(a,p)).command(()=>uf(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>lf(a,p)).command(()=>uf(a,p)).run()},pf=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=cu(e,r.schema);return zd(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},mf=(e,t,n={})=>({state:r,commands:i})=>{let a=Jl(e,r.schema),o=Jl(t,r.schema),s=Lu(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},hf=(e,t={})=>({state:n,commands:r})=>{let i=Jl(e,n.schema);return Lu(n,i,t)?r.lift(i):r.wrapIn(i,t)},gf=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},_f=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},vf=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=cu(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=su(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},yf=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},bf=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Hu(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=Jl(e,r.schema)),s===`mark`&&(o=cu(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},xf=(e,t={})=>({state:n,dispatch:r})=>ol(Jl(e,n.schema),t)(n,r),Sf=(e,t={})=>({state:n,dispatch:r})=>pl(Jl(e,n.schema),t)(n,r),Cf=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},wf=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Tf=(e,t)=>{if(ru(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Ef(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=Rd(c)+i;return a.forEach(e=>{if(l)return;let a=Tf(u,e.find);if(!a)return;let c=s.state.tr,d=Rl({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new zl({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function Df(e){let{editor:t,rules:n}=e,r=new Or({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:cd(R.from(e),a.schema);let{from:i}=s;Ef({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Ef({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Ef({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Ef({editor:t,from:a.pos,to:a.pos,text:`
14
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Of(e){return Object.prototype.toString.call(e).slice(8,-1)}function kf(e){return Of(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function Af(e,t){let n={...e};return kf(e)&&kf(t)&&Object.keys(t).forEach(r=>{kf(t[r])&&kf(e[r])?n[r]=Af(e[r],t[r]):n[r]=t[r]}),n}var jf=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ud(G(this,`addOptions`,{name:this.name}))}}get storage(){return{...ud(G(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Af(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},Mf=class e extends jf{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function Nf(e){return typeof e==`number`}var Pf=class{constructor(e){this.find=e.find,this.handler=e.handler}},Ff=(e,t,n)=>{if(ru(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function If(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new zl({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||Ff(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var Lf=null,Rf=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function zf(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!If({editor:t,state:Rl({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new Or({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Lf=t)},i=()=>{Lf&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Lf;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:cd(R.from(t),r.schema);let{from:n}=d,i=n+t.length,a=Rf(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Nf(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var Bf=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Td(e),this.schema=Sd(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=G(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Id(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return wd([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Id(t.name,this.schema)},r=[],i=G(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&G(t,`exitable`,n)&&(a.ArrowRight=()=>Mf.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=Pl(a);r.push(o);let s=G(t,`addInputRules`,n);if(Ud(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Df({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=G(t,`addPasteRules`,n);if(Ud(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=zf({editor:e,rules:t});r.push(...n)}}let l=G(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return pd(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=fd(this.extensions);return Object.fromEntries(t.filter(e=>!!G(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=G(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Jl(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:_d(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return wd([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Id(n.name,this.schema)},i=G(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return wd([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Id(n.name,this.schema)},i=G(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=fd(this.extensions);return Object.fromEntries(t.filter(e=>!!G(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=G(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cu(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=_d(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Sp(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Id(e.name,this.schema)};e.type===`mark`&&((ud(G(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(ud(G(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=G(e,`onBeforeCreate`,t),r=G(e,`onCreate`,t),i=G(e,`onUpdate`,t),a=G(e,`onSelectionUpdate`,t),o=G(e,`onTransaction`,t),s=G(e,`onFocus`,t),c=G(e,`onBlur`,t),l=G(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};Bf.resolve=Td,Bf.sort=wd,Bf.flatten=sd;var Vf={};Ll(Vf,{ClipboardTextSerializer:()=>Uf,Commands:()=>Wf,Delete:()=>Gf,Drop:()=>Kf,Editable:()=>qf,FocusEvents:()=>Yf,Keymap:()=>Xf,Paste:()=>Zf,Tabindex:()=>Qf,TextDirection:()=>$f,focusEventsPluginKey:()=>Jf});var Hf=class e extends jf{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Uf=Hf.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Or({key:new jr(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=Od(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>Ed(r,{from:e.pos,to:t.pos},s)).join(o??`
15
-
16
- `)}}})]}}),Wf=Hf.create({name:`commands`,addCommands(){return{...Bl}}}),Gf=Hf.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=td(e.before,[e,...t]);Nd(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof fn){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),Kf=Hf.create({name:`drop`,addProseMirrorPlugins(){return[new Or({key:new jr(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),qf=Hf.create({name:`editable`,addProseMirrorPlugins(){return[new Or({key:new jr(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Jf=new jr(`focusEvents`),Yf=Hf.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new Or({key:Jf,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Xf=Hf.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:B.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return hu()||Pu()?i:r},addProseMirrorPlugins(){return[new Or({key:new jr(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=B.atStart(t.doc).from,l=B.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!Gd(n.doc))return;let u=n.tr,d=Rl({state:n,transaction:u}),{commands:f}=new zl({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),Zf=Hf.create({name:`paste`,addProseMirrorPlugins(){return[new Or({key:new jr(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Qf=Hf.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Or({key:new jr(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),$f=Hf.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=fd(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Or({key:new jr(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),ep=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},tp=`.ProseMirror {
17
- position: relative;
18
- }
19
-
20
- .ProseMirror {
21
- word-wrap: break-word;
22
- white-space: pre-wrap;
23
- white-space: break-spaces;
24
- -webkit-font-variant-ligatures: none;
25
- font-variant-ligatures: none;
26
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
27
- }
28
-
29
- .ProseMirror [contenteditable="false"] {
30
- white-space: normal;
31
- }
32
-
33
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
34
- white-space: pre-wrap;
35
- }
36
-
37
- .ProseMirror pre {
38
- white-space: pre-wrap;
39
- }
40
-
41
- img.ProseMirror-separator {
42
- display: inline !important;
43
- border: none !important;
44
- margin: 0 !important;
45
- width: 0 !important;
46
- height: 0 !important;
47
- }
48
-
49
- .ProseMirror-gapcursor {
50
- display: none;
51
- pointer-events: none;
52
- position: absolute;
53
- margin: 0;
54
- }
55
-
56
- .ProseMirror-gapcursor:after {
57
- content: "";
58
- display: block;
59
- position: absolute;
60
- top: -2px;
61
- width: 20px;
62
- border-top: 1px solid black;
63
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
64
- }
65
-
66
- @keyframes ProseMirror-cursor-blink {
67
- to {
68
- visibility: hidden;
69
- }
70
- }
71
-
72
- .ProseMirror-hideselection *::selection {
73
- background: transparent;
74
- }
75
-
76
- .ProseMirror-hideselection *::-moz-selection {
77
- background: transparent;
78
- }
79
-
80
- .ProseMirror-hideselection * {
81
- caret-color: transparent;
82
- }
83
-
84
- .ProseMirror-focused .ProseMirror-gapcursor {
85
- display: block;
86
- }`;function np(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var rp=class extends Cf{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Jd,createMappablePosition:Yd},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=pu(t,this.options.autofocus);this.editorState=Er.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=np(tp,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=ld(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[qf,Uf.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),Wf,Yf,Xf,Qf.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),Kf,Zf,Gf,$f.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new Bf(e,this)}createCommandManager(){this.commandManager=new zl({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Qu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=Qu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new Qs(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Ad(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Bd(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cd(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
87
-
88
- `,textSerializers:n={}}=e||{};return Dd(this.state.doc,{blockSeparator:t,textSerializers:{...Od(this.schema),...n}})}get isEmpty(){return Gd(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new ep(t,this,!1,n)}get $doc(){return this.$pos(0)}};function ip(e){return new wf({find:e.find,handler:({state:t,range:n,match:r})=>{let i=ud(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Pd(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function ap(e){return new wf({find:e.find,handler:({state:t,range:n,match:r})=>{let i=ud(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function op(e){return new wf({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=ud(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function sp(e){return new wf({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=ud(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&wn(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&In(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var cp=e=>`touches`in e,lp=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,cp(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function up(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof H){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function dp(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function fp(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}Ll({},{createAtomBlockMarkdownSpec:()=>hp,createBlockMarkdownSpec:()=>gp,createInlineMarkdownSpec:()=>yp,parseAttributes:()=>pp,parseIndentedBlocks:()=>bp,renderNestedMarkdownContent:()=>xp,serializeAttributes:()=>mp});function pp(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function mp(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function hp(e){let{nodeName:t,name:n,parseAttributes:r=pp,serializeAttributes:i=mp,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function gp(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=pp,serializeAttributes:a=mp,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
89
-
90
- ${t.renderChildren(e.content||[],`
91
-
92
- `)}
93
-
94
- :::`}}}function _p(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function vp(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function yp(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=_p,serializeAttributes:a=vp,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function bp(e,t,n){let r=e.split(`
95
- `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
96
- `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
97
- `;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
98
- `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
99
- `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
100
- `);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function xp(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
101
- `).map(e=>e?t.indent(e):t.indent(``)).join(`
102
- `);s+=e.type===`paragraph`?`
103
-
104
- ${n}`:`
105
- ${n}`}}),s}function Sp(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Cp=class e extends jf{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function wp(e){return new Pf({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=ud(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Pd(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}function Tp(e){return new Pf({find:e.find,handler({match:t,chain:n,range:r,pasteEvent:i}){let a=ud(e.getAttributes,void 0,t,i),o=ud(e.getContent,void 0,a);if(a===!1||a===null)return null;let s={type:e.type.name,attrs:a};o&&(s.content=o),t.input&&n().deleteRange(r).insertContentAt(r.from,s)}})}var{getOwnPropertyNames:Ep,getOwnPropertySymbols:Dp}=Object,{hasOwnProperty:Op}=Object.prototype;function kp(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Ap(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function jp(e){return e?.[Symbol.toStringTag]}function Mp(e){return Ep(e).concat(Dp(e))}var Np=Object.hasOwn||((e,t)=>Op.call(e,t));function Pp(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Fp=`__v`,Ip=`__o`,Lp=`_owner`,{getOwnPropertyDescriptor:Rp,keys:zp}=Object;function Bp(e,t){return e.byteLength===t.byteLength&&$p(new Uint8Array(e),new Uint8Array(t))}function Vp(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Hp(e,t){return e.byteLength===t.byteLength&&$p(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Up(e,t){return Pp(e.getTime(),t.getTime())}function Wp(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Gp(e,t){return e===t}function Kp(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var qp=Pp;function Jp(e,t,n){let r=zp(e),i=r.length;if(zp(t).length!==i)return!1;for(;i-- >0;)if(!tm(e,t,n,r[i]))return!1;return!0}function Yp(e,t,n){let r=Mp(e),i=r.length;if(Mp(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!tm(e,t,n,a)||(o=Rp(e,a),s=Rp(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Xp(e,t){return Pp(e.valueOf(),t.valueOf())}function Zp(e,t){return e.source===t.source&&e.flags===t.flags}function Qp(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function $p(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function em(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function tm(e,t,n,r){return(r===Lp||r===Ip||r===Fp)&&(e.$$typeof||t.$$typeof)?!0:Np(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var nm=`[object ArrayBuffer]`,rm=`[object Arguments]`,im=`[object Boolean]`,am=`[object DataView]`,om=`[object Date]`,sm=`[object Error]`,cm=`[object Map]`,lm=`[object Number]`,um=`[object Object]`,dm=`[object RegExp]`,fm=`[object Set]`,pm=`[object String]`,mm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},hm=`[object URL]`,gm=Object.prototype.toString;function _m({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=gm.call(h);if(b===om)return r(h,g,_);if(b===dm)return u(h,g,_);if(b===cm)return o(h,g,_);if(b===fm)return d(h,g,_);if(b===um)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===hm)return p(h,g,_);if(b===sm)return i(h,g,_);if(b===rm)return c(h,g,_);if(mm[b])return f(h,g,_);if(b===nm)return e(h,g,_);if(b===am)return n(h,g,_);if(b===im||b===lm||b===pm)return l(h,g,_);if(m){let e=m[b];if(!e){let t=jp(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function vm({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Bp,areArraysEqual:n?Yp:Vp,areDataViewsEqual:Hp,areDatesEqual:Up,areErrorsEqual:Wp,areFunctionsEqual:Gp,areMapsEqual:n?kp(Kp,Yp):Kp,areNumbersEqual:qp,areObjectsEqual:n?Yp:Jp,arePrimitiveWrappersEqual:Xp,areRegExpsEqual:Zp,areSetsEqual:n?kp(Qp,Yp):Qp,areTypedArraysEqual:n?kp($p,Yp):$p,areUrlsEqual:em,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Ap(r.areArraysEqual),t=Ap(r.areMapsEqual),n=Ap(r.areObjectsEqual),i=Ap(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function ym(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function bm({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var xm=Sm();Sm({strict:!0}),Sm({circular:!0}),Sm({circular:!0,strict:!0}),Sm({createInternalComparator:()=>Pp}),Sm({strict:!0,createInternalComparator:()=>Pp}),Sm({circular:!0,createInternalComparator:()=>Pp}),Sm({circular:!0,createInternalComparator:()=>Pp,strict:!0});function Sm(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=_m(vm(e));return bm({circular:t,comparator:a,createState:r,equals:n?n(a):ym(a),strict:i})}var Cm=n((e=>{var t=r(),n=kc();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),wm=e(n(((e,t)=>{t.exports=Cm()}))(),1),Tm=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Em=({contentComponent:e})=>{let t=(0,xl.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,W.jsx)(W.Fragment,{children:Object.values(t)})};function Dm(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:bl.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Om=class extends U.Component{constructor(e){super(e),this.editorContentRef=U.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Dm(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:Tm(t,this.editorContentRef),...n}),e?.contentComponent&&(0,W.jsx)(Em,{contentComponent:e.contentComponent})]})}},km=(0,U.forwardRef)((e,t)=>{let n=U.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return U.createElement(Om,{key:n,innerRef:t,...e})}),Am=U.memo(km),jm=typeof window<`u`?U.useLayoutEffect:U.useEffect,Mm=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function Nm(e){let[t]=(0,U.useState)(()=>new Mm(e.editor)),n=(0,wm.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??xm);return jm(()=>t.watch(e.editor),[e.editor,t]),(0,U.useDebugValue)(n),n}var Pm=!1,Fm=typeof window>`u`,Im=Fm||!!(typeof window<`u`&&window.next),Lm=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return Fm?(t&&Pm&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):Im&&e===void 0&&(t=!1,Pm&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new rp({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Rm(e={},t=[]){let n=(0,U.useRef)(e);n.current=e;let[r]=(0,U.useState)(()=>new Lm(n)),i=(0,xl.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,U.useDebugValue)(i),(0,U.useEffect)(r.onRender(t)),Nm({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var zm=(0,U.createContext)({editor:null}),Bm=zm.Consumer,Vm=()=>(0,U.useContext)(zm);function Hm({children:e,slotAfter:t,slotBefore:n,editorContainerProps:r={},...i}){let a=Rm(i),o=(0,U.useMemo)(()=>({editor:a}),[a]);return a?(0,W.jsxs)(zm.Provider,{value:o,children:[n,(0,W.jsx)(Bm,{children:({editor:e})=>(0,W.jsx)(Am,{editor:e,...r})}),e,t]}):null}var Um=(0,U.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Wm=()=>(0,U.useContext)(Um);U.forwardRef((e,t)=>{let{onDragStart:n}=Wm();return(0,W.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function Gm(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function Km(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function qm(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Jm(e){if(Gm(e)||Km(e))return!0;if(qm(e)){let t=e.type;if(t)return Gm(t)||Km(t)}return!1}function Ym(){try{if(U.version)return parseInt(U.version.split(`.`)[0],10)>=19}catch{}return!1}var Xm=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,bl.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=Ym(),a=Jm(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,W.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};U.createContext({markViewContentRef:()=>{}});var Zm=(0,U.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Zm.displayName=`TiptapContext`;var Qm=()=>(0,U.useContext)(Zm);function $m({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,U.useMemo)(()=>({editor:r}),[r]),a=(0,U.useMemo)(()=>({editor:r}),[r]);return(0,W.jsx)(zm.Provider,{value:a,children:(0,W.jsx)(Zm.Provider,{value:i,children:n})})}$m.displayName=`Tiptap`;function eh({...e}){let{editor:t}=Qm();return(0,W.jsx)(Am,{editor:t,...e})}eh.displayName=`Tiptap.Content`,Object.assign($m,{Content:eh});var th=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},nh=e=>e?th(e):th,{useDebugValue:rh}=U.default,{useSyncExternalStoreWithSelector:ih}=wm.default,ah=e=>e;function oh(e,t=ah,n){let r=ih(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rh(r),r}var sh=e=>{let t=typeof e==`function`?nh(e):e,n=(e,n)=>oh(t,e,n);return Object.assign(n,t),n},ch=e=>e?sh(e):sh,lh,uh=typeof window<`u`&&((lh=window.document)!=null&&lh.createElement||window.navigator?.product===`ReactNative`)?U.useLayoutEffect:U.useEffect;function dh(){let e=ch(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return uh(()=>{n(e=>({version:e.version+1}))},[]),uh(()=>(n(({current:e})=>({current:[...e,t]})),()=>n(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,r]),null},Out:()=>{let t=e(e=>e.current);return U.createElement(U.Fragment,null,t)}}}var fh=({children:e})=>{let t=(0,U.useRef)(dh()).current;return(0,W.jsx)(Sc.Provider,{value:t,children:e})},ph=({className:e,children:t,initialContent:n,ref:r,...i})=>(0,W.jsx)(`div`,{ref:r,className:e,children:(0,W.jsx)(Hm,{...i,content:n,children:t})}),mh,hh;if(typeof WeakMap<`u`){let e=new WeakMap;mh=t=>e.get(t),hh=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;mh=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},hh=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var gh=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return mh(e)||hh(e,_h(e))}};function _h(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=vh(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new gh(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&yh(s,o,e),s}function vh(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function yh(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=bh(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function bh(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function xh(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new jr(`selectingCells`);function Sh(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Ch(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function wh(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Sh(t.$head)||Th(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function Th(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function Eh(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function Dh(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Oh(e,t,n){let r=e.node(-1),i=gh.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function kh(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var Ah=class e extends B{constructor(e,t=e){let n=e.node(-1),r=gh.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new lr(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(Eh(r)&&Eh(i)&&Dh(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return V.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=gh.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=kh(e,0,l)),u>0&&(e=kh(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(R.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new z(R.from(o),1,1)}replace(e,t=z.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?z.empty:t)}let i=B.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new z(R.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=gh.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=gh.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new jh(this.$anchorCell.pos,this.$headCell.pos)}};Ah.prototype.visible=!1,B.jsonID(`cell`,Ah);var jh=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&Dh(t,n)?new Ah(t,n):B.near(n,1)}};new jr(`fix-tables`);function Mh(e){let t=e.selection,n=wh(e),r=n.node(-1),i=n.start(-1),a=gh.get(r);return{...t instanceof Ah?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function Nh(e){return function(t,n){if(!Ch(t))return!1;if(n){let r=xh(t.schema),i=Mh(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Ph(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Fh(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Nh(e):function(t,n){if(!Ch(t))return!1;if(n){let r=xh(t.schema),i=Mh(t),a=t.tr,o=Ph(`row`,i,r),s=Ph(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Fh(`row`,{useDeprecatedLogic:!0}),Fh(`column`,{useDeprecatedLogic:!0}),Fh(`cell`,{useDeprecatedLogic:!0});function Ih(e,t){let n=e.selection;if(!(n instanceof Ah))return!1;if(t){let r=e.tr,i=xh(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new z(i,0,0))}),r.docChanged&&t(r)}return!0}Fl({ArrowLeft:Rh(`horiz`,-1),ArrowRight:Rh(`horiz`,1),ArrowUp:Rh(`vert`,-1),ArrowDown:Rh(`vert`,1),"Shift-ArrowLeft":zh(`horiz`,-1),"Shift-ArrowRight":zh(`horiz`,1),"Shift-ArrowUp":zh(`vert`,-1),"Shift-ArrowDown":zh(`vert`,1),Backspace:Ih,"Mod-Backspace":Ih,Delete:Ih,"Mod-Delete":Ih});function Lh(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Rh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof Ah)return Lh(n,r,B.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Bh(i,e,t);if(o==null)return!1;if(e==`horiz`)return Lh(n,r,B.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=Oh(i,e,t),s;return s=a?B.near(a,1):t<0?B.near(n.doc.resolve(i.before(-1)),-1):B.near(n.doc.resolve(i.after(-1)),1),Lh(n,r,s)}}}function zh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof Ah)o=a;else{let r=Bh(i,e,t);if(r==null)return!1;o=new Ah(n.doc.resolve(r))}let s=Oh(o.$headCell,e,t);return s?Lh(n,r,new Ah(o.$anchorCell,s)):!1}}function Bh(e,t,n){if(!(e.state.selection instanceof V))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new jr(`tableColumnResizing`);function Vh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Hh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&du(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(M(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(y(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(j(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(A(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(c(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(N(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(v(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Xd(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof H){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof Ah){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Vh(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&C(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Uh=e=>new Or({key:typeof e.pluginKey==`string`?new jr(e.pluginKey):e.pluginKey,view:t=>new Hh({view:t,...e})});Hf.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Uh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Wh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Dd(e,{textSerializers:Od(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(M(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(y(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(j(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(A(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(c(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(N(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(v(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Xd(this.view,e.from,e.to);C({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Gh=e=>new Or({key:typeof e.pluginKey==`string`?new jr(e.pluginKey):e.pluginKey,view:t=>new Wh({view:t,...e})});Hf.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[Gh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Kh(e,t){return e??new jr(t)}var qh=typeof window<`u`?U.useLayoutEffect:U.useEffect,Jh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Yh=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Xh=new Set([`children`,`className`,`style`]),Zh=new Set([`tabIndex`]),Qh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),$h={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function eg(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function tg(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function ng(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Qh.has(e)}function rg(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ig(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:$h[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ag(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function og(e){return Zh.has(e)}function sg(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function cg(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function lg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Yh.has(e)?String(t):`${t}px`}function ug(e,t){Jh.has(t)||e.style.removeProperty(rg(t))}function dg(e,t,n){Jh.has(t)||e.style.setProperty(rg(t),lg(t,n))}function fg(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Xh.has(r)||!ng(r)||eg(r,t[r])||eg(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=tg(r);if(a==null||a===!1){og(r)&&cg(e,r),e.removeAttribute(o);return}if(a===!0){og(r)&&sg(e,r,!0),e.setAttribute(o,``);return}if(og(r)){sg(e,r,a);return}e.setAttribute(o,String(a))})}function pg(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function mg(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){ug(e,t);return}dg(e,t,a)}})}function hg(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!eg(t,n))return;let{eventName:i,options:a}=ig(t),o=t=>{n(ag(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function gg(e,t){let n=(0,U.useRef)({}),r=(0,U.useRef)([]);qh(()=>{let i=n.current;return pg(e,i.className,t.className),mg(e,i.style,t.style),fg(e,i,t),r.current=hg(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var _g=U.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,U.useRef)(document.createElement(`div`)),f=(0,U.useRef)(Kh(e,`bubbleMenu`)).current;gg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Vm(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,U.useRef)(h);g.current=h;let[_,v]=(0,U.useState)(!1),y=(0,U.useRef)(!0);return(0,U.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Uh({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,U.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,bl.createPortal)(c,d.current)});U.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,U.useRef)(document.createElement(`div`)),d=(0,U.useRef)(Kh(e,`floatingMenu`)).current;gg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Vm(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,U.useRef)(m);h.current=m;let[g,_]=(0,U.useState)(!1),v=(0,U.useRef)(!0);return(0,U.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Gh({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,U.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,bl.createPortal)(s,u.current)});var vg=({children:e,options:t,ref:n,...r})=>{let{editor:i}=Vm();return i?(0,W.jsx)(`div`,{ref:n,children:(0,W.jsx)(_g,{editor:i,shouldShow:({editor:e,state:t})=>{let{selection:n}=t,{empty:r}=n;return!(!e.isEditable||e.isActive(`image`)||r||Kd(n))},options:{placement:`top`,...t},...r,children:e})}):null},yg=({children:e,onCommand:t,ref:n,...r})=>{let{editor:i}=Vm(),a=xc();return!i||!a?null:(0,W.jsx)(E,{ref:n,...r,onSelect:()=>t({editor:i,range:a}),children:e})},bg=k;function xg(e,t){for(var n=e.length,r=0;r<n;++r)if(t(e[r],r))return!0;return!1}function Sg(e,t){for(var n=e.length,r=0;r<n;++r)if(t(e[r],r))return e[r];return null}function Cg(e){var t=e;if(t===void 0){if(typeof navigator>`u`||!navigator)return``;t=navigator.userAgent||``}return t.toLowerCase()}function wg(e,t){try{return new RegExp(e,`g`).exec(t)}catch{return null}}function Tg(){if(typeof navigator>`u`||!navigator||!navigator.userAgentData)return!1;var e=navigator.userAgentData,t=e.brands||e.uaList;return!!(t&&t.length)}function Eg(e,t){var n=wg(`(`+e+`)((?:\\/|\\s|:)([0-9|\\.|_]+))`,t);return n?n[3]:``}function Dg(e){return e.replace(/_/g,`.`)}function Og(e,t){var n=null,r=`-1`;return xg(e,function(e){var i=wg(`(`+e.test+`)((?:\\/|\\s|:)([0-9|\\.|_]+))?`,t);return!i||e.brand?!1:(n=e,r=i[3]||`-1`,e.versionAlias?r=e.versionAlias:e.versionTest&&(r=Eg(e.versionTest.toLowerCase(),t)||r),r=Dg(r),!0)}),{preset:n,version:r}}function kg(e,t){var n={brand:``,version:`-1`};return xg(e,function(e){var r=Ag(t,e);return r?(n.brand=e.id,n.version=e.versionAlias||r.version,n.version!==`-1`):!1}),n}function Ag(e,t){return Sg(e,function(e){var n=e.brand;return wg(``+t.test,n.toLowerCase())})}var jg=[{test:`phantomjs`,id:`phantomjs`},{test:`whale`,id:`whale`},{test:`edgios|edge|edg`,id:`edge`},{test:`msie|trident|windows phone`,id:`ie`,versionTest:`iemobile|msie|rv`},{test:`miuibrowser`,id:`miui browser`},{test:`samsungbrowser`,id:`samsung internet`},{test:`samsung`,id:`samsung internet`,versionTest:`version`},{test:`chrome|crios`,id:`chrome`},{test:`firefox|fxios`,id:`firefox`},{test:`android`,id:`android browser`,versionTest:`version`},{test:`safari|iphone|ipad|ipod`,id:`safari`,versionTest:`version`}],Mg=[{test:`(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)`,id:`chrome`,versionTest:`chrome`},{test:`chromium`,id:`chrome`},{test:`whale`,id:`chrome`,versionAlias:`-1`,brand:!0}],Ng=[{test:`applewebkit`,id:`webkit`,versionTest:`applewebkit|safari`}],Pg=[{test:`(?=(iphone|ipad))(?!(.*version))`,id:`webview`},{test:`(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))`,id:`webview`},{test:`webview`,id:`webview`}],Fg=[{test:`windows phone`,id:`windows phone`},{test:`windows 2000`,id:`window`,versionAlias:`5.0`},{test:`windows nt`,id:`window`},{test:`win32|windows`,id:`window`},{test:`iphone|ipad|ipod`,id:`ios`,versionTest:`iphone os|cpu os`},{test:`macos|macintel|mac os x`,id:`mac`},{test:`android|linux armv81`,id:`android`},{test:`tizen`,id:`tizen`},{test:`webos|web0s`,id:`webos`}];function Ig(e){return!!Og(Pg,e).preset}function Lg(e){var t=Cg(e),n=!!/mobi/g.exec(t),r={name:`unknown`,version:`-1`,majorVersion:-1,webview:Ig(t),chromium:!1,chromiumVersion:`-1`,webkit:!1,webkitVersion:`-1`},i={name:`unknown`,version:`-1`,majorVersion:-1},a=Og(jg,t),o=a.preset,s=a.version,c=Og(Fg,t),l=c.preset,u=c.version,d=Og(Mg,t);if(r.chromium=!!d.preset,r.chromiumVersion=d.version,!r.chromium){var f=Og(Ng,t);r.webkit=!!f.preset,r.webkitVersion=f.version}return l&&(i.name=l.id,i.version=u,i.majorVersion=parseInt(u,10)),o&&(r.name=o.id,r.version=s,r.webview&&i.name===`ios`&&r.name!==`safari`&&(r.webview=!1)),r.majorVersion=parseInt(r.version,10),{browser:r,os:i,isMobile:n,isHints:!1}}function Rg(e){var t=navigator.userAgentData,n=(t.uaList||t.brands).slice(),r=e&&e.fullVersionList,i=t.mobile||!1,a=n[0],o=(e&&e.platform||t.platform||navigator.platform).toLowerCase(),s={name:a.brand,version:a.version,majorVersion:-1,webkit:!1,webkitVersion:`-1`,chromium:!1,chromiumVersion:`-1`,webview:!!kg(Pg,n).brand||Ig(Cg())},c={name:`unknown`,version:`-1`,majorVersion:-1};s.webkit=!s.chromium&&xg(Ng,function(e){return Ag(n,e)});var l=kg(Mg,n);if(s.chromium=!!l.brand,s.chromiumVersion=l.version||`-1`,!s.chromium){var u=kg(Ng,n);s.webkit=!!u.brand,s.webkitVersion=u.version||`-1`}var d=Sg(Fg,function(e){return RegExp(``+e.test,`g`).exec(o)});if(c.name=d?d.id:``,e&&(c.version=e.platformVersion||`-1`),r&&r.length){var f=kg(jg,r);s.name=f.brand||s.name,s.version=f.version||s.version}else{var p=kg(jg,n);s.name=p.brand||s.name,s.version=p.brand&&e?e.uaFullVersion:p.version}return s.webkit&&(c.name=i?`ios`:`mac`),c.name===`ios`&&s.webview&&(s.version=`-1`),c.version=Dg(c.version),s.version=Dg(s.version),c.majorVersion=parseInt(c.version,10),s.majorVersion=parseInt(s.version,10),{browser:s,os:c,isMobile:i,isHints:!0}}function zg(e){return e===void 0&&Tg()?Rg():Lg(e)}function Bg(e){return[...arguments].slice(1).map(function(t){return t.split(` `).map(function(t){return t?``+e+t:``}).join(` `)}).join(` `)}function Vg(e,t){return t.replace(/([^}{]*){/gm,function(t,n){return n.replace(/\.([^{,\s\d.]+)/g,`.`+e+`$1`)+`{`})}function Hg(e,t){return function(n){n&&(e[t]=n)}}function Ug(e,t,n){return function(r){r&&(e[t][n]=r)}}function Wg(e,t){return t===void 0&&(t={}),function(n,r){e.forEach(function(e){var i=t[e]||e;i in n||(n[i]=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=(t=this[r])[e].apply(t,n);return a===this[r]?this:a})})}}var Gg=`function`,Kg=`string`,qg=`number`,Jg=`undefined`,Yg=typeof window!==Jg,Xg=typeof document<`u`&&document,Zg=[{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`},{open:`\\"`,close:`\\"`},{open:`\\'`,close:`\\'`}],Qg=1e-7;1/Qg;var $g={cm:function(e){return e*96/2.54},mm:function(e){return e*96/254},in:function(e){return e*96},pt:function(e){return e*96/72},pc:function(e){return e*96/6},"%":function(e,t){return e*t/100},vw:function(e,t){return t===void 0&&(t=window.innerWidth),e/100*t},vh:function(e,t){return t===void 0&&(t=window.innerHeight),e/100*t},vmax:function(e,t){return t===void 0&&(t=Math.max(window.innerWidth,window.innerHeight)),e/100*t},vmin:function(e,t){return t===void 0&&(t=Math.min(window.innerWidth,window.innerHeight)),e/100*t}};function e_(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function t_(e,t,n,r){return(e*r+t*n)/(n+r)}function n_(e){return typeof e===Jg}function r_(e){return e&&typeof e==`object`}function i_(e){return Array.isArray(e)}function a_(e){return typeof e===Kg}function o_(e){return typeof e===qg}function s_(e){return typeof e===Gg}function c_(e,t){return(t===``||t==` `)&&(e===``||e==` `)||e===t}function l_(e,t,n,r,i){return u_(e,t,n)?n:d_(e,t,n+1,r,i)}function u_(e,t,n){if(!e.ignore)return null;var r=t.slice(Math.max(n-3,0),n+3).join(``);return new RegExp(e.ignore).exec(r)}function d_(e,t,n,r,i){for(var a=function(n){var a=t[n].trim();if(a===e.close&&!u_(e,t,n))return{value:n};var s=n,c=b_(i,function(e){return e.open===a});if(c&&(s=l_(c,t,n,r,i)),s===-1)return o=n,`break`;n=s,o=n},o,s=n;s<r;++s){var c=a(s);if(s=o,typeof c==`object`)return c.value;if(c===`break`)break}return-1}function f_(e,t){var n=a_(t)?{separator:t}:t,r=n.separator,i=r===void 0?`,`:r,a=n.isSeparateFirst,o=n.isSeparateOnlyOpenClose,s=n.isSeparateOpenClose,c=s===void 0?o:s,l=n.openCloseCharacters,u=l===void 0?Zg:l,d=u.map(function(e){var t=e.open,n=e.close;return t===n?t:t+`|`+n}).join(`|`),f=`(\\s*`+i+`\\s*|`+d+`|\\s+)`,p=new RegExp(f,`g`),m=e.split(p).filter(function(e){return e&&e!==`undefined`}),h=m.length,g=[],_=[];function v(){return _.length?(g.push(_.join(``)),_=[],!0):!1}for(var y=function(t){var n=m[t].trim(),r=t,s=b_(u,function(e){return e.open===n}),l=b_(u,function(e){return e.close===n});if(s){if(r=l_(s,m,t,h,u),r!==-1&&c)return v()&&a||(g.push(m.slice(t,r+1).join(``)),t=r,a)?(b=t,`break`):(b=t,`continue`)}else if(l&&!u_(l,m,t)){var d=e_(u);return d.splice(u.indexOf(l),1),{value:f_(e,{separator:i,isSeparateFirst:a,isSeparateOnlyOpenClose:o,isSeparateOpenClose:c,openCloseCharacters:d})}}else if(c_(n,i)&&!o)return v(),a?(b=t,`break`):(b=t,`continue`);r===-1&&(r=h-1),_.push(m.slice(t,r+1).join(``)),t=r,b=t},b,x=0;x<h;++x){var S=y(x);if(x=b,typeof S==`object`)return S.value;if(S===`break`)break}return _.length&&g.push(_.join(``)),g}function p_(e){return f_(e,``)}function m_(e){return f_(e,`,`)}function h_(e){var t=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(e);return!t||t.length<4?{}:{prefix:t[1],value:t[2],suffix:t[3]}}function g_(e){var t=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(e);if(!t)return{prefix:``,unit:``,value:NaN};var n=t[1],r=t[2];return{prefix:n,unit:t[3],value:parseFloat(r)}}function __(e,t){return t===void 0&&(t=`-`),e.replace(/([a-z])([A-Z])/g,function(e,n,r){return``+n+t+r.toLowerCase()})}function v_(){return Date.now?Date.now():new Date().getTime()}function y_(e,t,n){n===void 0&&(n=-1);for(var r=e.length,i=0;i<r;++i)if(t(e[i],i,e))return i;return n}function b_(e,t,n){var r=y_(e,t);return r>-1?e[r]:n}var x_=function(){var e=v_(),t=Yg&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return t?t.bind(window):function(t){var n=v_();return setTimeout(function(){t(n-e)},1e3/60)}}(),S_=function(){var e=Yg&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return e?e.bind(window):function(e){clearTimeout(e)}}();function C_(e){return Object.keys(e)}function w_(e,t){var n=g_(e),r=n.value,i=n.unit;if(r_(t)){var a=t[i];if(a){if(s_(a))return a(r);if($g[i])return $g[i](r,a)}}else if(i===`%`)return r*t/100;return $g[i]?$g[i](r):r}function T_(e,t,n){return Math.max(t,Math.min(e,n))}function E_(e,t,n,r){return r===void 0&&(r=e[0]/e[1]),[[P_(t[0],1e-7),P_(t[0]/r,1e-7)],[P_(t[1]*r,1e-7),P_(t[1],1e-7)]].filter(function(e){return e.every(function(e,r){var i=t[r],a=P_(i,1e-7);return n?e<=i||e<=a:e>=i||e>=a})})[0]||e}function D_(e,t,n,r){if(!r)return e.map(function(e,r){return T_(e,t[r],n[r])});var i=e[0],a=e[1],o=r===!0?i/a:r,s=E_(e,t,!1,o),c=s[0],l=s[1],u=E_(e,n,!0,o),d=u[0],f=u[1];return i<c||a<l?(i=c,a=l):(i>d||a>f)&&(i=d,a=f),[i,a]}function O_(e){for(var t=e.length,n=0,r=t-1;r>=0;--r)n+=e[r];return n}function k_(e){for(var t=e.length,n=0,r=t-1;r>=0;--r)n+=e[r];return t?n/t:0}function A_(e,t){var n=t[0]-e[0],r=t[1]-e[1],i=Math.atan2(r,n);return i>=0?i:i+Math.PI*2}function j_(e){return[0,1].map(function(t){return k_(e.map(function(e){return e[t]}))})}function M_(e){var t=j_(e),n=A_(t,e[0]),r=A_(t,e[1]);return n<r&&r-n<Math.PI||n>r&&r-n<-Math.PI?1:-1}function N_(e,t){return Math.sqrt(((t?t[0]:0)-e[0])**2+((t?t[1]:0)-e[1])**2)}function P_(e,t){if(!t)return e;var n=1/t;return Math.round(e/t)/n}function F_(e,t){return e.forEach(function(n,r){e[r]=P_(e[r],t)}),e}function I_(e){for(var t=[],n=0;n<e;++n)t.push(n);return t}function L_(e){return e.reduce(function(e,t){return e.concat(t)},[])}function R_(e,t){return e.classList?e.classList.contains(t):!!e.className.match(RegExp(`(\\s|^)`+t+`(\\s|$)`))}function z_(e,t){e.classList?e.classList.add(t):e.className+=` `+t}function B_(e,t){if(e.classList)e.classList.remove(t);else{var n=RegExp(`(\\s|^)`+t+`(\\s|$)`);e.className=e.className.replace(n,` `)}}function V_(e,t,n,r){e.addEventListener(t,n,r)}function H_(e,t,n,r){e.removeEventListener(t,n,r)}function U_(e){return e?.ownerDocument||Xg}function W_(e){return U_(e).documentElement}function G_(e){return U_(e).body}function K_(e){return e?.ownerDocument?.defaultView||window}function q_(e){return e&&`postMessage`in e&&`blur`in e&&`self`in e}function J_(e){return r_(e)&&e.nodeName&&e.nodeType&&`ownerDocument`in e}function Y_(e,t,n,r,i,a){for(var o=0;o<i;++o){var s=n+o*i,c=r+o*i;e[s]+=e[c]*a,t[s]+=t[c]*a}}function X_(e,t,n,r,i){for(var a=0;a<i;++a){var o=n+a*i,s=r+a*i,c=e[o],l=t[o];e[o]=e[s],e[s]=c,t[o]=t[s],t[s]=l}}function Z_(e,t,n,r,i){for(var a=0;a<r;++a){var o=n+a*r;e[o]/=i,t[o]/=i}}function Q_(e,t,n){n===void 0&&(n=Math.sqrt(e.length));for(var r=e.slice(),i=0;i<n;++i)r[i*n+t-1]=0,r[(t-1)*n+i]=0;return r[(t-1)*(n+1)]=1,r}function $_(e,t){t===void 0&&(t=Math.sqrt(e.length));for(var n=e.slice(),r=yv(t),i=0;i<t;++i){var a=t*i+i;if(!P_(n[a],1e-7)){for(var o=i+1;o<t;++o)if(n[t*i+o]){X_(n,r,i,o,t);break}}if(!P_(n[a],1e-7))return[];Z_(n,r,i,t,n[a]);for(var o=0;o<t;++o){var s=o,c=n[o+i*t];!P_(c,1e-7)||i===o||Y_(n,r,s,i,t,-c)}}return r}function ev(e,t){t===void 0&&(t=Math.sqrt(e.length));for(var n=[],r=0;r<t;++r)for(var i=0;i<t;++i)n[i*t+r]=e[t*r+i];return n}function tv(e,t){t===void 0&&(t=Math.sqrt(e.length));for(var n=[],r=e[t*t-1],i=0;i<t-1;++i)n[i]=e[t*(t-1)+i]/r;return n[t-1]=0,n}function nv(e,t){for(var n=yv(t),r=0;r<t-1;++r)n[t*(t-1)+r]=e[r]||0;return n}function rv(e,t){for(var n=e.slice(),r=e.length;r<t-1;++r)n[r]=0;return n[t-1]=1,n}function iv(e,t,n){if(t===void 0&&(t=Math.sqrt(e.length)),t===n)return e;for(var r=yv(n),i=Math.min(t,n),a=0;a<i-1;++a){for(var o=0;o<i-1;++o)r[a*n+o]=e[a*t+o];r[(a+1)*n-1]=e[(a+1)*t-1],r[(n-1)*n+a]=e[(t-1)*t+a]}return r[n*n-1]=e[t*t-1],r}function av(e){var t=[...arguments].slice(1),n=yv(e);return t.forEach(function(t){n=ov(n,t,e)}),n}function ov(e,t,n){n===void 0&&(n=Math.sqrt(e.length));var r=[],i=e.length/n,a=t.length/i;if(!i)return t;if(!a)return e;for(var o=0;o<n;++o)for(var s=0;s<a;++s){r[s*n+o]=0;for(var c=0;c<i;++c)r[s*n+o]+=e[c*n+o]*t[s*i+c]}return r}function sv(e,t){for(var n=Math.min(e.length,t.length),r=e.slice(),i=0;i<n;++i)r[i]=r[i]+t[i];return r}function K(e,t){for(var n=Math.min(e.length,t.length),r=e.slice(),i=0;i<n;++i)r[i]=r[i]-t[i];return r}function cv(e,t){return t===void 0&&(t=e.length===6),t?[e[0],e[1],0,e[2],e[3],0,e[4],e[5],1]:e}function lv(e,t){return t===void 0&&(t=e.length===9),t?[e[0],e[1],e[3],e[4],e[6],e[7]]:e}function uv(e,t,n){n===void 0&&(n=t.length);var r=ov(e,t,n),i=r[n-1];return r.map(function(e){return e/i})}function dv(e,t){return ov(e,[1,0,0,0,0,Math.cos(t),Math.sin(t),0,0,-Math.sin(t),Math.cos(t),0,0,0,0,1],4)}function fv(e,t){return ov(e,[Math.cos(t),0,-Math.sin(t),0,0,1,0,0,Math.sin(t),0,Math.cos(t),0,0,0,0,1],4)}function pv(e,t){return ov(e,vv(t,4))}function mv(e,t){var n=t[0],r=n===void 0?1:n,i=t[1],a=i===void 0?1:i,o=t[2];return ov(e,[r,0,0,0,0,a,0,0,0,0,o===void 0?1:o,0,0,0,0,1],4)}function hv(e,t){return uv(vv(t,3),rv(e,3))}function gv(e,t){var n=t[0],r=n===void 0?0:n,i=t[1],a=i===void 0?0:i,o=t[2];return ov(e,[1,0,0,0,0,1,0,0,0,0,1,0,r,a,o===void 0?0:o,1],4)}function _v(e,t){return ov(e,t,4)}function vv(e,t){var n=Math.cos(e),r=Math.sin(e),i=yv(t);return i[0]=n,i[1]=r,i[t]=-r,i[t+1]=n,i}function yv(e){for(var t=e*e,n=[],r=0;r<t;++r)n[r]=r%(e+1)?0:1;return n}function bv(e,t){for(var n=yv(t),r=Math.min(e.length,t-1),i=0;i<r;++i)n[(t+1)*i]=e[i];return n}function xv(e,t){for(var n=yv(t),r=Math.min(e.length,t-1),i=0;i<r;++i)n[t*(t-1)+i]=e[i];return n}function Sv(e,t,n,r,i,a,o,s){var c=e[0],l=e[1],u=t[0],d=t[1],f=n[0],p=n[1],m=r[0],h=r[1],g=i[0],_=i[1],v=a[0],y=a[1],b=o[0],x=o[1],S=s[0],C=s[1],w=$_([c,0,u,0,f,0,m,0,l,0,d,0,p,0,h,0,1,0,1,0,1,0,1,0,0,c,0,u,0,f,0,m,0,l,0,d,0,p,0,h,0,1,0,1,0,1,0,1,-g*c,-_*c,-v*u,-y*u,-b*f,-x*f,-S*m,-C*m,-g*l,-_*l,-v*d,-y*d,-b*p,-x*p,-S*h,-C*h],8);if(!w.length)return[];var T=ov(w,[g,_,v,y,b,x,S,C],8);return T[8]=1,iv(ev(T),3,4)}var Cv=function(){return Cv=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},Cv.apply(this,arguments)};function wv(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Tv(e,t){return t===void 0&&(t=0),Dv(Ov(e,t))}function Ev(e,t){var n=uv(e,[t[0],t[1]||0,t[2]||0,1],4),r=n[3]||1;return[n[0]/r,n[1]/r,n[2]/r]}function Dv(e){var t=wv();return e.forEach(function(e){var n=e.matrixFunction,r=e.functionValue;n&&(t=n(t,r))}),t}function Ov(e,t){return t===void 0&&(t=0),(i_(e)?e:p_(e)).map(function(e){var n=h_(e),r=n.prefix,i=n.value,a=null,o=r,s=``;if(r===`translate`||r===`translateX`||r===`translate3d`){var c=r_(t)?Cv(Cv({},t),{"o%":t[`%`]}):{"%":t,"o%":t},l=m_(i).map(function(e,n){return n===0&&`x%`in c?c[`%`]=t[`x%`]:n===1&&`y%`in c?c[`%`]=t[`y%`]:c[`%`]=t[`o%`],w_(e,c)}),u=l[0],d=l[1],f=d===void 0?0:d,p=l[2],m=p===void 0?0:p;a=gv,s=[u,f,m]}else if(r===`translateY`){var f=w_(i,r_(t)?Cv({"%":t[`y%`]},t):{"%":t});a=gv,s=[0,f,0]}else if(r===`translateZ`){var m=parseFloat(i);a=gv,s=[0,0,m]}else if(r===`scale`||r===`scale3d`){var h=m_(i).map(function(e){return parseFloat(e)}),g=h[0],_=h[1],v=_===void 0?g:_,y=h[2],b=y===void 0?1:y;a=mv,s=[g,v,b]}else if(r===`scaleX`){var g=parseFloat(i);a=mv,s=[g,1,1]}else if(r===`scaleY`){var v=parseFloat(i);a=mv,s=[1,v,1]}else if(r===`scaleZ`){var b=parseFloat(i);a=mv,s=[1,1,b]}else if(r===`rotate`||r===`rotateZ`||r===`rotateX`||r===`rotateY`){var x=g_(i),S=x.unit,C=x.value,w=S===`rad`?C:C*Math.PI/180;r===`rotate`||r===`rotateZ`?(o=`rotateZ`,a=pv):r===`rotateX`?a=dv:r===`rotateY`&&(a=fv),s=w}else if(r===`matrix3d`)a=_v,s=m_(i).map(function(e){return parseFloat(e)});else if(r===`matrix`){var T=m_(i).map(function(e){return parseFloat(e)});a=_v,s=[T[0],T[1],0,0,T[2],T[3],0,0,0,0,1,0,T[4],T[5],0,1]}else o=``;return{name:r,functionName:o,value:i,matrixFunction:a,functionValue:s}})}var kv=function(){function e(){this.keys=[],this.values=[]}var t=e.prototype;return t.get=function(e){return this.values[this.keys.indexOf(e)]},t.set=function(e,t){var n=this.keys,r=this.values,i=n.indexOf(e),a=i===-1?n.length:i;n[a]=e,r[a]=t},e}(),Av=function(){function e(){this.object={}}var t=e.prototype;return t.get=function(e){return this.object[e]},t.set=function(e,t){this.object[e]=t},e}(),jv=typeof Map==`function`,Mv=function(){function e(){}var t=e.prototype;return t.connect=function(e,t){this.prev=e,this.next=t,e&&(e.next=this),t&&(t.prev=this)},t.disconnect=function(){var e=this.prev,t=this.next;e&&(e.next=t),t&&(t.prev=e)},t.getIndex=function(){for(var e=this,t=-1;e;)e=e.prev,++t;return t},e}();function Nv(e,t){var n=[],r=[];return e.forEach(function(e){var t=e[0],i=e[1],a=new Mv;n[t]=a,r[i]=a}),n.forEach(function(e,t){e.connect(n[t-1])}),e.filter(function(e,n){return!t[n]}).map(function(e,t){var i=e[0],a=e[1];if(i===a)return[0,0];var o=n[i],s=r[a-1],c=o.getIndex();return o.disconnect(),s?o.connect(s,s.next):o.connect(void 0,n[0]),[c,o.getIndex()]})}var Pv=function(){function e(e,t,n,r,i,a,o,s){this.prevList=e,this.list=t,this.added=n,this.removed=r,this.changed=i,this.maintained=a,this.changedBeforeAdded=o,this.fixed=s}var t=e.prototype;return Object.defineProperty(t,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(t,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),t.caculateOrdered=function(){var e=Nv(this.changedBeforeAdded,this.fixed),t=this.changed,n=[];this.cacheOrdered=e.filter(function(e,r){var i=e[0],a=e[1],o=t[r],s=o[0],c=o[1];if(i!==a)return n.push([s,c]),!0}),this.cachePureChanged=n},e}();function Fv(e,t,n){var r=jv?Map:n?Av:kv,i=n||function(e){return e},a=[],o=[],s=[],c=e.map(i),l=t.map(i),u=new r,d=new r,f=[],p=[],m={},h=[],g=0,_=0;return c.forEach(function(e,t){u.set(e,t)}),l.forEach(function(e,t){d.set(e,t)}),c.forEach(function(e,t){var n=d.get(e);n===void 0?(++_,o.push(t)):m[n]=_}),l.forEach(function(e,t){var n=u.get(e);n===void 0?(a.push(t),++g):(s.push([n,t]),_=m[t]||0,f.push([n-_,t-g]),p.push(t===n),n!==t&&h.push([n,t]))}),o.reverse(),new Pv(e,t,a,o,h,s,f,p)}var Iv=function(){function e(e,t){e===void 0&&(e=[]),this.findKeyCallback=t,this.list=[].slice.call(e)}var t=e.prototype;return t.update=function(e){var t=[].slice.call(e),n=Fv(this.list,t,this.findKeyCallback);return this.list=t,n},e}(),Lv=function(e,t){return Lv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Lv(e,t)};function Rv(e,t){Lv(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var zv=typeof Map==`function`?void 0:function(){var e=0;return function(t){return t.__DIFF_KEY__||=++e}}(),Bv=function(e){Rv(t,e);function t(t){return t===void 0&&(t=[]),e.call(this,t,zv)||this}return t}(Iv);function Vv(e,t){return Fv(e,t,zv)}var Hv=function(){return Hv=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},Hv.apply(this,arguments)};function Uv(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}var Wv=function(){function e(){this._events={}}var t=e.prototype;return t.on=function(e,t){if(r_(e))for(var n in e)this.on(n,e[n]);else this._addEvent(e,t,{});return this},t.off=function(e,t){if(!e)this._events={};else if(r_(e))for(var n in e)this.off(n);else if(!t)this._events[e]=[];else{var r=this._events[e];if(r){var i=y_(r,function(e){return e.listener===t});i>-1&&r.splice(i,1)}}return this},t.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},t.emit=function(e,t){var n=this;t===void 0&&(t={});var r=this._events[e];if(!e||!r)return!0;var i=!1;return t.eventType=e,t.stop=function(){i=!0},t.currentTarget=this,Uv(r).forEach(function(r){r.listener(t),r.once&&n.off(e,r.listener)}),!i},t.trigger=function(e,t){return t===void 0&&(t={}),this.emit(e,t)},t._addEvent=function(e,t,n){var r=this._events;r[e]=r[e]||[],r[e].push(Hv({listener:t},n))},e}(),Gv=function(e,t){return Gv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Gv(e,t)};function Kv(e,t){Gv(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var qv=function(){return qv=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},qv.apply(this,arguments)};function Jv(e){var t=e.container;return t===document.body?[t.scrollLeft||document.documentElement.scrollLeft,t.scrollTop||document.documentElement.scrollTop]:[t.scrollLeft,t.scrollTop]}function Yv(e,t){return e.addEventListener(`scroll`,t),function(){e.removeEventListener(`scroll`,t)}}function Xv(e){if(!e)return null;if(a_(e))return document.querySelector(e);if(s_(e))return e();if(e instanceof Element)return e;if(`current`in e)return e.current;if(`value`in e)return e.value}var Zv=function(e){Kv(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._startRect=null,t._startPos=[],t._prevTime=0,t._timer=0,t._prevScrollPos=[0,0],t._isWait=!1,t._flag=!1,t._currentOptions=null,t._lock=!1,t._unregister=null,t._onScroll=function(){var e=t._currentOptions;t._lock||!e||t.emit(`scrollDrag`,{next:function(n){t.checkScroll({container:e.container,inputEvent:n})}})},t}var n=t.prototype;return n.dragStart=function(e,t){var n=Xv(t.container);if(!n){this._flag=!1;return}var r=0,i=0,a=0,o=0;if(n===document.body)a=window.innerWidth,o=window.innerHeight;else{var s=n.getBoundingClientRect();r=s.top,i=s.left,a=s.width,o=s.height}this._flag=!0,this._startPos=[e.clientX,e.clientY],this._startRect={top:r,left:i,width:a,height:o},this._prevScrollPos=this._getScrollPosition([0,0],t),this._currentOptions=t,this._registerScrollEvent(t)},n.drag=function(e,t){if(clearTimeout(this._timer),this._flag){var n=e.clientX,r=e.clientY,i=t.threshold,a=i===void 0?0:i,o=this,s=o._startRect,c=o._startPos;this._currentOptions=t;var l=[0,0];return s.top>r-a?(c[1]>s.top||r<c[1])&&(l[1]=-1):s.top+s.height<r+a&&(c[1]<s.top+s.height||r>c[1])&&(l[1]=1),s.left>n-a?(c[0]>s.left||n<c[0])&&(l[0]=-1):s.left+s.width<n+a&&(c[0]<s.left+s.width||n>c[0])&&(l[0]=1),!l[0]&&!l[1]?!1:this._continueDrag(qv(qv({},t),{direction:l,inputEvent:e,isDrag:!0}))}},n.checkScroll=function(e){var t=this;if(this._isWait)return!1;var n=e.prevScrollPos,r=n===void 0?this._prevScrollPos:n,i=e.direction,a=e.throttleTime,o=a===void 0?0:a,s=e.inputEvent,c=e.isDrag,l=this._getScrollPosition(i||[0,0],e),u=l[0]-r[0],d=l[1]-r[1],f=i||[u?Math.abs(u)/u:0,d?Math.abs(d)/d:0];return this._prevScrollPos=l,this._lock=!1,!u&&!d?!1:(this.emit(`move`,{offsetX:f[0]?u:0,offsetY:f[1]?d:0,inputEvent:s}),o&&c&&(clearTimeout(this._timer),this._timer=window.setTimeout(function(){t._continueDrag(e)},o)),!0)},n.dragEnd=function(){this._flag=!1,this._lock=!1,clearTimeout(this._timer),this._unregisterScrollEvent()},n._getScrollPosition=function(e,t){var n=t.container,r=t.getScrollPosition;return(r===void 0?Jv:r)({container:Xv(n),direction:e})},n._continueDrag=function(e){var t=this,n,r=e.container,i=e.direction,a=e.throttleTime,o=e.useScroll,s=e.isDrag,c=e.inputEvent;if(!(!this._flag||s&&this._isWait)){var l=v_(),u=Math.max(a+this._prevTime-l,0);if(u>0)return clearTimeout(this._timer),this._timer=window.setTimeout(function(){t._continueDrag(e)},u),!1;this._prevTime=l;var d=this._getScrollPosition(i,e);this._prevScrollPos=d,s&&(this._isWait=!0),o||(this._lock=!0);var f={container:Xv(r),direction:i,inputEvent:c};return(n=e.requestScroll)==null||n.call(e,f),this.emit(`scroll`,f),this._isWait=!1,o||this.checkScroll(qv(qv({},e),{prevScrollPos:d,direction:i,inputEvent:c}))}},n._registerScrollEvent=function(e){this._unregisterScrollEvent();var t=e.checkScrollEvent;if(t){var n=t===!0?Yv:t,r=Xv(e.container);t===!0&&(r===document.body||r===document.documentElement)?this._unregister=Yv(window,this._onScroll):this._unregister=n(r,this._onScroll)}},n._unregisterScrollEvent=function(){var e;(e=this._unregister)==null||e.call(this),this._unregister=null},t}(Wv);function Qv(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function $v(e){return P_(e,Qg)}function ey(e,t){return e.every(function(e,n){return $v(e-t[n])===0})}function ty(e,t){return!$v(e[0]-t[0])&&!$v(e[1]-t[1])}function ny(e){return e.length<3?0:Math.abs(O_(e.map(function(t,n){var r=e[n+1]||e[0];return t[0]*r[1]-r[0]*t[1]})))/2}function ry(e,t){var n=t.width,r=t.height,i=t.left,a=t.top,o=iy(e),s=o.minX,c=o.minY,l=o.maxX,u=o.maxY,d=n/(l-s),f=r/(u-c);return e.map(function(e){return[i+(e[0]-s)*d,a+(e[1]-c)*f]})}function iy(e){var t=e.map(function(e){return e[0]}),n=e.map(function(e){return e[1]});return{minX:Math.min.apply(Math,t),minY:Math.min.apply(Math,n),maxX:Math.max.apply(Math,t),maxY:Math.max.apply(Math,n)}}function ay(e,t,n){var r=e[0],i=e[1],a=iy(t),o=a.minX,s=a.maxX,c=[[o,i],[s,i]],l=oy(c[0],c[1]),u=ly(t),d=[];if(u.forEach(function(t){var n=oy(t[0],t[1]),r=t[0];ey(l,n)?d.push({pos:e,line:t,type:`line`}):cy(sy(l,n),[c,t]).forEach(function(e){t.some(function(t){return ty(t,e)})?d.push({pos:e,line:t,type:`point`}):$v(r[1]-i)!==0&&d.push({pos:e,line:t,type:`intersection`})})}),!n&&b_(d,function(e){return e[0]===r}))return!0;var f=0,p={};return d.forEach(function(e){var t=e.pos,n=e.type,a=e.line;if(!(t[0]>r)){if(n===`intersection`)++f;else if(n===`line`)return;else if(n===`point`){var o=b_(a,function(e){return e[1]!==i}),s=p[t[0]],c=o[1]>i?1:-1;s?s!==c&&++f:p[t[0]]=c}}}),f%2==1}function oy(e,t){var n=e[0],r=e[1],i=t[0],a=t[1],o=i-n,s=a-r;Math.abs(o)<1e-7&&(o=0),Math.abs(s)<1e-7&&(s=0);var c=0,l=0,u=0;return o?s?(c=-s/o,l=1,u=-c*n-r):(l=1,u=-r):s&&(c=-1,u=n),[c,l,u]}function sy(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],o=t[1],s=t[2],c=n===0&&a===0,l=r===0&&o===0,u=[];if(c&&l)return[];if(c){var d=-i/r;return d===-s/o?[[-1/0,d],[1/0,d]]:[]}else if(l){var f=-i/n;return f===-s/a?[[f,-1/0],[f,1/0]]:[]}else if(n===0){var p=-i/r,m=-(o*p+s)/a;u=[[m,p]]}else if(a===0){var p=-s/o,m=-(r*p+i)/n;u=[[m,p]]}else if(r===0){var m=-i/n,p=-(a*m+s)/o;u=[[m,p]]}else if(o===0){var m=-s/a,p=-(n*m+i)/r;u=[[m,p]]}else{var m=(r*s-o*i)/(o*n-r*a),p=-(n*m+i)/r;u=[[m,p]]}return u.map(function(e){return[e[0],e[1]]})}function cy(e,t){var n=t.map(function(e){return[0,1].map(function(t){return[Math.min(e[0][t],e[1][t]),Math.max(e[0][t],e[1][t])]})}),r=[];if(e.length===2){var i=e[0],a=i[0],o=i[1];if(!$v(a-e[1][0])){var s=Math.max.apply(Math,n.map(function(e){return e[1][0]})),c=Math.min.apply(Math,n.map(function(e){return e[1][1]}));if($v(s-c)>0)return[];r=[[a,s],[a,c]]}else if(!$v(o-e[1][1])){var l=Math.max.apply(Math,n.map(function(e){return e[0][0]})),u=Math.min.apply(Math,n.map(function(e){return e[0][1]}));if($v(l-u)>0)return[];r=[[l,o],[u,o]]}}return r.length||(r=e.filter(function(e){var t=e[0],r=e[1];return n.every(function(e){return 0<=$v(t-e[0][0])&&0<=$v(e[0][1]-t)&&0<=$v(r-e[1][0])&&0<=$v(e[1][1]-r)})})),r.map(function(e){return[$v(e[0]),$v(e[1])]})}function ly(e){return Qv(e.slice(1),[e[0]]).map(function(t,n){return[e[n],t]})}function uy(e,t){var n=e.slice(),r=t.slice();M_(n)===-1&&n.reverse(),M_(r)===-1&&r.reverse();var i=ly(n),a=ly(r),o=i.map(function(e){return oy(e[0],e[1])}),s=a.map(function(e){return oy(e[0],e[1])}),c=[];o.forEach(function(e,t){var n=i[t],o=[];s.forEach(function(r,i){var s=cy(sy(e,r),[n,a[i]]);o.push.apply(o,s.map(function(e){return{index1:t,index2:i,pos:e,type:`intersection`}}))}),o.sort(function(e,t){return N_(n[0],e.pos)-N_(n[0],t.pos)}),c.push.apply(c,o),ay(n[1],r)&&c.push({index1:t,index2:-1,pos:n[1],type:`inside`})}),a.forEach(function(e,t){if(ay(e[1],n)){var r=!1,i=y_(c,function(e){return e.index2===t?(r=!0,!1):!!r});i===-1&&(r=!1,i=y_(c,function(e){var n=e.index1,i=e.index2;return n===-1&&i+1===t?(r=!0,!1):!!r})),i===-1?c.push({index1:-1,index2:t,pos:e[1],type:`inside`}):c.splice(i,0,{index1:-1,index2:t,pos:e[1],type:`inside`})}});var l={};return c.filter(function(e){var t=e.pos,n=t[0]+`x`+t[1];return l[n]?!1:(l[n]=!0,!0)})}function dy(e,t){return uy(e,t).map(function(e){return e.pos})}function fy(e,t){return ny(dy(e,t))}var py=function(e,t){return py=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},py(e,t)};function my(e,t){py(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var hy=function(){return hy=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},hy.apply(this,arguments)};function gy(e,t){var n=t[0]-e[0],r=t[1]-e[1],i=Math.atan2(r,n);return i>=0?i:i+Math.PI*2}function _y(e){return gy([e[0].clientX,e[0].clientY],[e[1].clientX,e[1].clientY])/Math.PI*180}function vy(e){return e.touches&&e.touches.length>=2}function yy(e){return e?e.touches?Cy(e.touches):[wy(e)]:[]}function by(e){return e&&(e.type.indexOf(`mouse`)>-1||`button`in e)}function xy(e,t,n){var r=n.length,i=Ty(e,r),a=i.clientX,o=i.clientY,s=i.originalClientX,c=i.originalClientY,l=Ty(t,r),u=l.clientX,d=l.clientY,f=Ty(n,r),p=f.clientX,m=f.clientY;return{clientX:s,clientY:c,deltaX:a-u,deltaY:o-d,distX:a-p,distY:o-m}}function Sy(e){return Math.sqrt((e[0].clientX-e[1].clientX)**2+(e[0].clientY-e[1].clientY)**2)}function Cy(e){for(var t=Math.min(e.length,2),n=[],r=0;r<t;++r)n.push(wy(e[r]));return n}function wy(e){return{clientX:e.clientX,clientY:e.clientY}}function Ty(e,t){t===void 0&&(t=e.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=Math.min(e.length,t),i=0;i<r;++i){var a=e[i];n.originalClientX+=`originalClientX`in a?a.originalClientX:a.clientX,n.originalClientY+=`originalClientY`in a?a.originalClientY:a.clientY,n.clientX+=a.clientX,n.clientY+=a.clientY}return t?{clientX:n.clientX/t,clientY:n.clientY/t,originalClientX:n.originalClientX/t,originalClientY:n.originalClientY/t}:n}var Ey=function(){function e(e){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=e,this.prevClients=e,this.length=e.length}return e.prototype.getAngle=function(e){return e===void 0&&(e=this.prevClients),_y(e)},e.prototype.getRotation=function(e){return e===void 0&&(e=this.prevClients),_y(e)-_y(this.startClients)},e.prototype.getPosition=function(e,t){e===void 0&&(e=this.prevClients);var n=xy(e||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=e,n},e.prototype.getPositions=function(e){e===void 0&&(e=this.prevClients);for(var t=this.prevClients,n=this.startClients,r=Math.min(this.length,t.length),i=[],a=0;a<r;++a)i[a]=xy([e[a]],[t[a]],[n[a]]);return i},e.prototype.getMovement=function(e){var t=this.movement;if(!e)return t;var n=Ty(e,this.length),r=Ty(this.prevClients,this.length),i=n.clientX-r.clientX,a=n.clientY-r.clientY;return Math.sqrt(i*i+a*a)+t},e.prototype.getDistance=function(e){return e===void 0&&(e=this.prevClients),Sy(e)},e.prototype.getScale=function(e){return e===void 0&&(e=this.prevClients),Sy(e)/Sy(this.startClients)},e.prototype.move=function(e,t){this.startClients.forEach(function(n){n.clientX-=e,n.clientY-=t}),this.prevClients.forEach(function(n){n.clientX-=e,n.clientY-=t})},e}(),Dy=[`textarea`,`input`],Oy=function(e){my(t,e);function t(t,n){n===void 0&&(n={});var r=e.call(this)||this;r.options={},r.flag=!1,r.pinchFlag=!1,r.data={},r.isDrag=!1,r.isPinch=!1,r.clientStores=[],r.targets=[],r.prevTime=0,r.doubleFlag=!1,r._useMouse=!1,r._useTouch=!1,r._useDrag=!1,r._dragFlag=!1,r._isTrusted=!1,r._isMouseEvent=!1,r._isSecondaryButton=!1,r._preventMouseEvent=!1,r._prevInputEvent=null,r._isDragAPI=!1,r._isIdle=!0,r._preventMouseEventId=0,r._window=window,r.onDragStart=function(e,t){if(t===void 0&&(t=!0),!(!r.flag&&e.cancelable===!1)){var n=e.type.indexOf(`drag`)>=-1;if(!(r.flag&&n)){r._isDragAPI=!0;var i=r.options,a=i.container,o=i.pinchOutside,s=i.preventWheelClick,c=i.preventRightClick,l=i.preventDefault,u=i.checkInput,d=i.dragFocusedInput,f=i.preventClickEventOnDragStart,p=i.preventClickEventOnDrag,m=i.preventClickEventByCondition,h=r._useTouch,g=!r.flag;if(r._isSecondaryButton=e.which===3||e.button===2,s&&(e.which===2||e.button===1)||c&&(e.which===3||e.button===2))return r.stop(),!1;if(g){var _=r._window.document.activeElement,v=e.target;if(v){var y=v.tagName.toLowerCase(),b=Dy.indexOf(y)>-1,x=v.isContentEditable;if(b||x){if(u||!d&&_===v)return!1;if(_&&(_===v||x&&_.isContentEditable&&_.contains(v)))if(d)v.blur();else return!1}else if((l||e.type===`touchstart`)&&_){var S=_.tagName.toLowerCase();(_.isContentEditable||Dy.indexOf(S)>-1)&&_.blur()}(f||p||m)&&V_(r._window,`click`,r._onClick,!0)}r.clientStores=[new Ey(yy(e))],r._isIdle=!1,r.flag=!0,r.isDrag=!1,r._isTrusted=t,r._dragFlag=!0,r._prevInputEvent=e,r.data={},r.doubleFlag=v_()-r.prevTime<200,r._isMouseEvent=by(e),!r._isMouseEvent&&r._preventMouseEvent&&r._allowMouseEvent(),(r._preventMouseEvent||r.emit(`dragStart`,hy(hy({data:r.data,datas:r.data,inputEvent:e,isMouseEvent:r._isMouseEvent,isSecondaryButton:r._isSecondaryButton,isTrusted:t,isDouble:r.doubleFlag},r.getCurrentStore().getPosition()),{preventDefault:function(){e.preventDefault()},preventDrag:function(){r._dragFlag=!1}})))===!1&&r.stop(),r._isMouseEvent&&r.flag&&l&&e.preventDefault()}if(!r.flag)return!1;var C=0;if(g?(r._attchDragEvent(),h&&o&&(C=setTimeout(function(){V_(a,`touchstart`,r.onDragStart,{passive:!1})}))):h&&o&&H_(a,`touchstart`,r.onDragStart),r.flag&&vy(e)){if(clearTimeout(C),g&&e.touches.length!==e.changedTouches.length)return;r.pinchFlag||r.onPinchStart(e)}}}},r.onDrag=function(e,t){if(r.flag){var n=r.options.preventDefault;!r._isMouseEvent&&n&&e.preventDefault(),r._prevInputEvent=e;var i=yy(e),a=r.moveClients(i,e,!1);if(r._dragFlag){if((r.pinchFlag||a.deltaX||a.deltaY)&&(r._preventMouseEvent||r.emit(`drag`,hy(hy({},a),{isScroll:!!t,inputEvent:e})))===!1){r.stop();return}r.pinchFlag&&r.onPinch(e,i)}r.getCurrentStore().getPosition(i,!0)}},r.onDragEnd=function(e){if(r.flag){var t=r.options,n=t.pinchOutside,i=t.container,a=t.preventClickEventOnDrag,o=t.preventClickEventOnDragStart,s=t.preventClickEventByCondition,c=r.isDrag;(a||o||s)&&requestAnimationFrame(function(){r._allowClickEvent()}),!s&&!o&&a&&!c&&r._allowClickEvent(),r._useTouch&&n&&H_(i,`touchstart`,r.onDragStart),r.pinchFlag&&r.onPinchEnd(e);var l=e?.touches?yy(e):[];l.length===0||!r.options.keepDragging?r.flag=!1:r._addStore(new Ey(l));var u=r._getPosition(),d=v_(),f=!c&&r.doubleFlag;r._prevInputEvent=null,r.prevTime=c||f?0:d,r.flag||(r._dettachDragEvent(),r._preventMouseEvent||r.emit(`dragEnd`,hy({data:r.data,datas:r.data,isDouble:f,isDrag:c,isClick:!c,isMouseEvent:r._isMouseEvent,isSecondaryButton:r._isSecondaryButton,inputEvent:e,isTrusted:r._isTrusted},u)),r.clientStores=[],r._isMouseEvent||(r._preventMouseEvent=!0,clearTimeout(r._preventMouseEventId),r._preventMouseEventId=setTimeout(function(){r._preventMouseEvent=!1},200)),r._isIdle=!0)}},r.onBlur=function(){r.onDragEnd()},r._allowClickEvent=function(){H_(r._window,`click`,r._onClick,!0)},r._onClick=function(e){r._allowClickEvent(),r._allowMouseEvent();var t=r.options.preventClickEventByCondition;t?.(e)||(e.stopPropagation(),e.preventDefault())},r._onContextMenu=function(e){r.options.preventRightClick?r.onDragEnd(e):e.preventDefault()},r._passCallback=function(){};var i=[].concat(t),a=i[0];r._window=q_(a)?a:K_(a),r.options=hy({checkInput:!1,container:a&&!(`document`in a)?K_(a):a,preventRightClick:!0,preventWheelClick:!0,preventClickEventOnDragStart:!1,preventClickEventOnDrag:!1,preventClickEventByCondition:null,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:[`touch`,`mouse`]},n);var o=r.options,s=o.container,c=o.events,l=o.checkWindowBlur;if(r._useDrag=c.indexOf(`drag`)>-1,r._useTouch=c.indexOf(`touch`)>-1,r._useMouse=c.indexOf(`mouse`)>-1,r.targets=i,r._useDrag&&i.forEach(function(e){V_(e,`dragstart`,r.onDragStart)}),r._useMouse&&(i.forEach(function(e){V_(e,`mousedown`,r.onDragStart),V_(e,`mousemove`,r._passCallback)}),V_(s,`contextmenu`,r._onContextMenu)),l&&V_(K_(),`blur`,r.onBlur),r._useTouch){var u={passive:!1};i.forEach(function(e){V_(e,`touchstart`,r.onDragStart,u),V_(e,`touchmove`,r._passCallback,u)})}return r}return t.prototype.stop=function(){this.isDrag=!1,this.data={},this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1,this._isIdle=!0,this._allowClickEvent(),this._dettachDragEvent(),this._isDragAPI=!1},t.prototype.getMovement=function(e){return this.getCurrentStore().getMovement(e)+this.clientStores.slice(1).reduce(function(e,t){return e+t.movement},0)},t.prototype.isDragging=function(){return this.isDrag},t.prototype.isIdle=function(){return this._isIdle},t.prototype.isFlag=function(){return this.flag},t.prototype.isPinchFlag=function(){return this.pinchFlag},t.prototype.isDoubleFlag=function(){return this.doubleFlag},t.prototype.isPinching=function(){return this.isPinch},t.prototype.scrollBy=function(e,t,n,r){r===void 0&&(r=!0),this.flag&&(this.clientStores[0].move(e,t),r&&this.onDrag(n,!0))},t.prototype.move=function(e,t){var n=e[0],r=e[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map(function(e){var t=e.clientX,i=e.clientY;return{clientX:t+n,clientY:i+r,originalClientX:t,originalClientY:i}}),t,!0)},t.prototype.triggerDragStart=function(e){this.onDragStart(e,!1)},t.prototype.setEventData=function(e){var t=this.data;for(var n in e)t[n]=e[n];return this},t.prototype.setEventDatas=function(e){return this.setEventData(e)},t.prototype.getCurrentEvent=function(e){return e===void 0&&(e=this._prevInputEvent),hy(hy({data:this.data,datas:this.data},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},t.prototype.getEventData=function(){return this.data},t.prototype.getEventDatas=function(){return this.data},t.prototype.unset=function(){var e=this,t=this.targets,n=this.options.container;this.off(),H_(this._window,`blur`,this.onBlur),this._useDrag&&t.forEach(function(t){H_(t,`dragstart`,e.onDragStart)}),this._useMouse&&(t.forEach(function(t){H_(t,`mousedown`,e.onDragStart)}),H_(n,`contextmenu`,this._onContextMenu)),this._useTouch&&(t.forEach(function(t){H_(t,`touchstart`,e.onDragStart)}),H_(n,`touchstart`,this.onDragStart)),this._prevInputEvent=null,this._allowClickEvent(),this._dettachDragEvent()},t.prototype.onPinchStart=function(e){var t=this,n=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>n)){var r=new Ey(yy(e));this.pinchFlag=!0,this._addStore(r),this.emit(`pinchStart`,hy(hy({data:this.data,datas:this.data,angle:r.getAngle(),touches:this.getCurrentStore().getPositions()},r.getPosition()),{inputEvent:e,isTrusted:this._isTrusted,preventDefault:function(){e.preventDefault()},preventDrag:function(){t._dragFlag=!1}}))===!1&&(this.pinchFlag=!1)}},t.prototype.onPinch=function(e,t){if(!(!this.flag||!this.pinchFlag||t.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit(`pinch`,hy(hy({data:this.data,datas:this.data,movement:this.getMovement(t),angle:n.getAngle(t),rotation:n.getRotation(t),touches:n.getPositions(t),scale:n.getScale(t),distance:n.getDistance(t)},n.getPosition(t)),{inputEvent:e,isTrusted:this._isTrusted}))}},t.prototype.onPinchEnd=function(e){if(this.pinchFlag){var t=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit(`pinchEnd`,hy(hy({data:this.data,datas:this.data,isPinch:t,touches:n.getPositions()},n.getPosition()),{inputEvent:e}))}},t.prototype.getCurrentStore=function(){return this.clientStores[0]},t.prototype.moveClients=function(e,t,n){var r=this._getPosition(e,n),i=this.isDrag;(r.deltaX||r.deltaY)&&(this.isDrag=!0);var a=!1;return!i&&this.isDrag&&(a=!0),hy(hy({data:this.data,datas:this.data},r),{movement:this.getMovement(e),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,isMouseEvent:this._isMouseEvent,isSecondaryButton:this._isSecondaryButton,inputEvent:t,isTrusted:this._isTrusted,isFirstDrag:a})},t.prototype._addStore=function(e){this.clientStores.splice(0,0,e)},t.prototype._getPosition=function(e,t){var n=this.getCurrentStore().getPosition(e,t),r=this.clientStores.slice(1).reduce(function(e,t){var n=t.getPosition();return e.distX+=n.distX,e.distY+=n.distY,e},n),i=r.distX,a=r.distY;return hy(hy({},n),{distX:i,distY:a})},t.prototype._attchDragEvent=function(){var e=this._window,t=this.options.container,n={passive:!1};this._isDragAPI&&(V_(t,`dragover`,this.onDrag,n),V_(e,`dragend`,this.onDragEnd)),this._useMouse&&(V_(t,`mousemove`,this.onDrag),V_(e,`mouseup`,this.onDragEnd)),this._useTouch&&(V_(t,`touchmove`,this.onDrag,n),V_(e,`touchend`,this.onDragEnd,n),V_(e,`touchcancel`,this.onDragEnd,n))},t.prototype._dettachDragEvent=function(){var e=this._window,t=this.options.container;this._isDragAPI&&(H_(t,`dragover`,this.onDrag),H_(e,`dragend`,this.onDragEnd)),this._useMouse&&(H_(t,`mousemove`,this.onDrag),H_(e,`mouseup`,this.onDragEnd)),this._useTouch&&(H_(t,`touchstart`,this.onDragStart),H_(t,`touchmove`,this.onDrag),H_(e,`touchend`,this.onDragEnd),H_(e,`touchcancel`,this.onDragEnd))},t.prototype._allowMouseEvent=function(){this._preventMouseEvent=!1,clearTimeout(this._preventMouseEventId)},t}(Wv);function ky(e){for(var t=5381,n=e.length;n;)t=t*33^e.charCodeAt(--n);return t>>>0}var Ay=ky;function jy(e){return Ay(e).toString(36)}function My(e){if(e&&e.getRootNode){var t=e.getRootNode();if(t.nodeType===11)return t}}function Ny(e,t,n){return n.original?t:t.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(t,n){var r=n.trim();return(r?m_(r):[``]).map(function(t){var n=t.trim();return n.indexOf(`@`)===0?n:n.indexOf(`:global`)>-1?n.replace(/\:global/g,``):n.indexOf(`:host`)>-1?`${n.replace(/\:host/g,`.${e}`)}`:n?`.${e} ${n}`:`.${e}`}).join(`, `)+` {`})}function Py(e,t,n,r,i){var a=U_(r),o=a.createElement(`style`);return o.setAttribute(`type`,`text/css`),o.setAttribute(`data-styled-id`,e),o.setAttribute(`data-styled-count`,`1`),n.nonce&&o.setAttribute(`nonce`,n.nonce),o.innerHTML=Ny(e,t,n),(i||a.head||a.body).appendChild(o),o}function Fy(e){var t=`rCS`+jy(e);return{className:t,inject:function(n,r){r===void 0&&(r={});var i=My(n),a=(i||n.ownerDocument||document).querySelector(`style[data-styled-id="${t}"]`);if(!a)a=Py(t,e,r,n,i);else{var o=parseFloat(a.getAttribute(`data-styled-count`))||0;a.setAttribute(`data-styled-count`,`${o+1}`)}return{destroy:function(){var e,t=parseFloat(a.getAttribute(`data-styled-count`))||0;t<=1?(a.remove?a.remove():(e=a.parentNode)==null||e.removeChild(a),a=null):a.setAttribute(`data-styled-count`,`${t-1}`)}}}}}var Iy=function(){return Iy=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},Iy.apply(this,arguments)};function Ly(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 Ry(e,t){var n=Fy(t),r=n.className;return(0,U.forwardRef)(function(t,i){var a=t.className,o=a===void 0?``:a;t.cspNonce;var s=Ly(t,[`className`,`cspNonce`]),c=(0,U.useRef)();return(0,U.useImperativeHandle)(i,function(){return c.current},[]),(0,U.useEffect)(function(){var e=n.inject(c.current,{nonce:t.cspNonce});return function(){e.destroy()}},[]),(0,U.createElement)(e,Iy({ref:c,"data-styled-id":r,className:`${o} ${r}`},s))})}var zy=function(e,t){return zy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},zy(e,t)};function By(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);zy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var q=function(){return q=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},q.apply(this,arguments)};function Vy(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 Hy(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Uy(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function J(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Y(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))}function Wy(e,t){return q({events:[],props:[],name:e},t)}var Gy=[`n`,`w`,`s`,`e`],Ky=[`n`,`w`,`s`,`e`,`nw`,`ne`,`sw`,`se`];function qy(e,t){return`data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="${32*e}px" height="${32*e}px" viewBox="0 0 32 32" ><path d="M 16,5 L 12,10 L 14.5,10 L 14.5,22 L 12,22 L 16,27 L 20,22 L 17.5,22 L 17.5,10 L 20, 10 L 16,5 Z" stroke-linejoin="round" stroke-width="1.2" fill="black" stroke="white" style="transform:rotate(${t}deg);transform-origin: 16px 16px"></path></svg>`}function Jy(e){var t=qy(1,e),n=Math.round(e/45)*45%180,r=`ns-resize`;return n===135?r=`nwse-resize`:n===45?r=`nesw-resize`:n===90&&(r=`ew-resize`),`cursor:${r};cursor: url('${t}') 16 16, ${r};`}var Yy=zg(),Xy=Yy.browser.webkit,Zy=Xy&&(function(){var e=typeof window>`u`?{userAgent:``}:window.navigator,t=/applewebkit\/([^\s]+)/g.exec(e.userAgent.toLowerCase());return t?parseFloat(t[1])<605:!1})(),Qy=Yy.browser.name,$y=parseInt(Yy.browser.version,10),eb=Qy===`chrome`,tb=Yy.browser.chromium,nb=parseInt(Yy.browser.chromiumVersion,10)||0,rb=eb&&$y>=109||tb&&nb>=109,ib=Qy===`firefox`,ab=parseInt(Yy.browser.webkitVersion,10)>=612||$y>=15,ob=`moveable-`,sb=`
106
- {
107
- position: absolute;
108
- width: 1px;
109
- height: 1px;
110
- left: 0;
111
- top: 0;
112
- z-index: 3000;
113
- --moveable-color: #4af;
114
- --zoom: 1;
115
- --zoompx: 1px;
116
- --moveable-line-padding: 0;
117
- --moveable-control-padding: 0;
118
- will-change: transform;
119
- outline: 1px solid transparent;
120
- }
121
- .control-box {
122
- z-index: 0;
123
- }
124
- .line, .control {
125
- position: absolute;
126
- left: 0;
127
- top: 0;
128
- will-change: transform;
129
- }
130
- .control {
131
- width: 14px;
132
- height: 14px;
133
- border-radius: 50%;
134
- border: 2px solid #fff;
135
- box-sizing: border-box;
136
- background: #4af;
137
- background: var(--moveable-color);
138
- margin-top: -7px;
139
- margin-left: -7px;
140
- border: 2px solid #fff;
141
- z-index: 10;
142
- }
143
- .around-control {
144
- position: absolute;
145
- will-change: transform;
146
- width: calc(var(--moveable-control-padding, 20) * 1px);
147
- height: calc(var(--moveable-control-padding, 20) * 1px);
148
- left: calc(var(--moveable-control-padding, 20) * -0.5px);
149
- top: calc(var(--moveable-control-padding, 20) * -0.5px);
150
- box-sizing: border-box;
151
- background: transparent;
152
- z-index: 8;
153
- cursor: alias;
154
- transform-origin: center center;
155
- }
156
- ${Ky.map(function(e){var t=``,n=``,r=`center`,i=`center`,a=`calc(var(--moveable-control-padding, 20) * -1px)`;return e.indexOf(`n`)>-1&&(t=`top: ${a};`,i=`bottom`),e.indexOf(`s`)>-1&&(t=`top: 0px;`,i=`top`),e.indexOf(`w`)>-1&&(n=`left: ${a};`,r=`right`),e.indexOf(`e`)>-1&&(n=`left: 0px;`,r=`left`),`.around-control[data-direction*="${e}"] {
157
- ${n}${t}
158
- transform-origin: ${r} ${i};
159
- }`}).join(`
160
- `)}
161
- .padding {
162
- position: absolute;
163
- top: 0px;
164
- left: 0px;
165
- width: 100px;
166
- height: 100px;
167
- transform-origin: 0 0;
168
- }
169
- .line {
170
- width: 1px;
171
- height: 1px;
172
- background: #4af;
173
- background: var(--moveable-color);
174
- transform-origin: 0px 50%;
175
- }
176
- .line.edge {
177
- z-index: 1;
178
- background: transparent;
179
- }
180
- .line.dashed {
181
- box-sizing: border-box;
182
- background: transparent;
183
- }
184
- .line.dashed.horizontal {
185
- border-top: 1px dashed #4af;
186
- border-top-color: #4af;
187
- border-top-color: var(--moveable-color);
188
- }
189
- .line.dashed.vertical {
190
- border-left: 1px dashed #4af;
191
- border-left-color: #4af;
192
- border-left-color: var(--moveable-color);
193
- }
194
- .line.vertical {
195
- transform: translateX(-50%);
196
- }
197
- .line.horizontal {
198
- transform: translateY(-50%);
199
- }
200
- .line.vertical.bold {
201
- width: 2px;
202
- }
203
- .line.horizontal.bold {
204
- height: 2px;
205
- }
206
-
207
- .control.origin {
208
- border-color: #f55;
209
- background: #fff;
210
- width: 12px;
211
- height: 12px;
212
- margin-top: -6px;
213
- margin-left: -6px;
214
- pointer-events: none;
215
- }
216
- ${[0,15,30,45,60,75,90,105,120,135,150,165].map(function(e){return`
217
- .direction[data-rotation="${e}"], :global .view-control-rotation${e} {
218
- ${Jy(e)}
219
- }
220
- `}).join(`
221
- `)}
222
-
223
- .line.direction:before {
224
- content: "";
225
- position: absolute;
226
- width: 100%;
227
- height: calc(var(--moveable-line-padding, 0) * 1px);
228
- bottom: 0;
229
- left: 0;
230
- }
231
- .group {
232
- z-index: -1;
233
- }
234
- .area {
235
- position: absolute;
236
- }
237
- .area-pieces {
238
- position: absolute;
239
- top: 0;
240
- left: 0;
241
- display: none;
242
- }
243
- .area.avoid, .area.pass {
244
- pointer-events: none;
245
- }
246
- .area.avoid+.area-pieces {
247
- display: block;
248
- }
249
- .area-piece {
250
- position: absolute;
251
- }
252
-
253
- ${Zy?`:global svg *:before {
254
- content:"";
255
- transform-origin: inherit;
256
- }`:``}
257
- `,cb=[[0,1,2],[1,0,3],[2,0,3],[3,1,2]],lb=1e-4,ub=1e-7,db=1e-9,fb=10**10,pb=-fb,mb={n:[0,-1],e:[1,0],s:[0,1],w:[-1,0],nw:[-1,-1],ne:[1,-1],sw:[-1,1],se:[1,1]},hb={n:[0,1],e:[1,3],s:[3,2],w:[2,0],nw:[0],ne:[1],sw:[2],se:[3]},gb={n:0,s:180,w:270,e:90,nw:315,ne:45,sw:225,se:135},_b=[`isMoveableElement`,`updateRect`,`updateTarget`,`destroy`,`dragStart`,`isInside`,`hitTest`,`setState`,`getRect`,`request`,`isDragging`,`getManager`,`forceUpdate`,`waitToChangeTarget`,`updateSelectors`,`getTargets`,`stopDrag`,`getControlBoxElement`,`getMoveables`,`getDragElement`];function vb(e,t,n,r,i,a){a===void 0&&(a=`draggable`);var o=t.gestos[a]?.move(n,e.inputEvent)??{},s=o.originalDatas||o.datas,c=s[a]||(s[a]={});return q(q({},i?Ow(t,o):o),{isPinch:!!r,parentEvent:!0,datas:c,originalDatas:e.originalDatas})}var yb=function(){function e(e){var t;e===void 0&&(e=`draggable`),this.ableName=e,this.prevX=0,this.prevY=0,this.startX=0,this.startY=0,this.isDrag=!1,this.isFlag=!1,this.datas={draggable:{}},this.datas=(t={},t[e]={},t)}return e.prototype.dragStart=function(e,t){this.isDrag=!1,this.isFlag=!1;var n=t.originalDatas;return this.datas=n,n[this.ableName]||(n[this.ableName]={}),q(q({},this.move(e,t.inputEvent)),{type:`dragstart`})},e.prototype.drag=function(e,t){return this.move([e[0]-this.prevX,e[1]-this.prevY],t)},e.prototype.move=function(e,t){var n,r,i=!1;if(!this.isFlag)this.prevX=e[0],this.prevY=e[1],this.startX=e[0],this.startY=e[1],n=e[0],r=e[1],this.isFlag=!0;else{var a=this.isDrag;n=this.prevX+e[0],r=this.prevY+e[1],(e[0]||e[1])&&(this.isDrag=!0),!a&&this.isDrag&&(i=!0)}return this.prevX=n,this.prevY=r,{type:`drag`,clientX:n,clientY:r,inputEvent:t,isFirstDrag:i,isDrag:this.isDrag,distX:n-this.startX,distY:r-this.startY,deltaX:e[0],deltaY:e[1],datas:this.datas[this.ableName],originalDatas:this.datas,parentEvent:!0,parentGesto:this}},e}();function bb(e,t,n,r){var i=e.length===16?4:3,a=J(GC(e,n,r,i),4),o=J(a[0],2),s=o[0],c=o[1],l=J(a[1],2),u=l[0],d=l[1],f=J(a[2],2),p=f[0],m=f[1],h=J(a[3],2),g=h[0],_=h[1],v=J(WC(e,t,i),2),y=v[0],b=v[1],x=Math.min(s,u,p,g),S=Math.min(c,d,m,_),C=Math.max(s,u,p,g),w=Math.max(c,d,m,_);s=s-x||0,u=u-x||0,p=p-x||0,g=g-x||0,c=c-S||0,d=d-S||0,m=m-S||0,_=_-S||0,y=y-x||0,b=b-S||0;var T=e[0],E=e[i+1],D=qw(T*E);return{left:x,top:S,right:C,bottom:w,origin:[y,b],pos1:[s,c],pos2:[u,d],pos3:[p,m],pos4:[g,_],direction:D}}function xb(e,t){var n=t.clientX,r=t.clientY,i=t.datas,a=e.state,o=a.moveableClientRect,s=a.rootMatrix,c=a.is3d,l=a.pos1,u=o.left,d=o.top,f=c?4:3,p=J(K(Dw(s,[n-u,r-d],f),l),2),m=p[0],h=p[1],g=J(kb({datas:i,distX:m,distY:h}),2);return[g[0],g[1]]}function Sb(e,t){var n=t.datas,r=e.state,i=r.allMatrix,a=r.beforeMatrix,o=r.is3d,s=r.left,c=r.top,l=r.origin,u=r.offsetMatrix,d=r.targetMatrix,f=r.transformOrigin,p=o?4:3;n.is3d=o,n.matrix=i,n.targetMatrix=d,n.beforeMatrix=a,n.offsetMatrix=u,n.transformOrigin=f,n.inverseMatrix=$_(i,p),n.inverseBeforeMatrix=$_(a,p),n.absoluteOrigin=rv(sv([s,c],l),p),n.startDragBeforeDist=uv(n.inverseBeforeMatrix,n.absoluteOrigin,p),n.startDragDist=uv(n.inverseMatrix,n.absoluteOrigin,p)}function Cb(e){return bb(e.datas.beforeTransform,[50,50],100,100).direction}function wb(e,t,n){var r=t.datas,i=t.originalDatas.beforeRenderable,a=r.transformIndex,o=i.nextTransforms,s=o.length,c=i.nextTransformAppendedIndexes,l=-1;a===-1?(n===`translate`?l=0:n===`rotate`&&(l=y_(o,function(e){return e.match(/scale\(/g)})),l===-1&&(l=o.length),r.transformIndex=l):l=b_(c,function(e){return e.index===a&&e.functionName===n})?a:a+c.filter(function(e){return e.index<a}).length;var u=Pw(o,e.state,l),d=u.targetFunction,f=n===`rotate`?`rotateZ`:n;r.beforeFunctionTexts=u.beforeFunctionTexts,r.afterFunctionTexts=u.afterFunctionTexts,r.beforeTransform=u.beforeFunctionMatrix,r.beforeTransform2=u.beforeFunctionMatrix2,r.targetTansform=u.targetFunctionMatrix,r.afterTransform=u.afterFunctionMatrix,r.afterTransform2=u.afterFunctionMatrix2,r.targetAllTransform=u.allFunctionMatrix,d.functionName===f?(r.afterFunctionTexts.splice(0,1),r.isAppendTransform=!1):s>l&&(r.isAppendTransform=!0,i.nextTransformAppendedIndexes=Y(Y([],J(c),!1),[{functionName:n,index:l,isAppend:!0}],!1))}function Tb(e,t,n){return`${e.beforeFunctionTexts.join(` `)} ${e.isAppendTransform?n:t} ${e.afterFunctionTexts.join(` `)}`}function Eb(e){var t=e.datas,n=e.distX,r=e.distY,i=J(Ob({datas:t,distX:n,distY:r}),2),a=i[0],o=i[1];return uv(Db(t,nv([a,o],4)),rv([0,0,0],4),4)}function Db(e,t,n){var r=e.beforeTransform,i=e.afterTransform,a=e.beforeTransform2,o=e.afterTransform2,s=e.targetAllTransform,c=n?ov(s,t,4):ov(t,s,4);return ov(ov($_(n?a:r,4),c,4),$_(n?o:i,4),4)}function Ob(e){var t=e.datas,n=e.distX,r=e.distY,i=t.inverseBeforeMatrix,a=t.is3d,o=t.startDragBeforeDist,s=t.absoluteOrigin,c=a?4:3;return K(uv(i,sv(s,[n,r]),c),o)}function kb(e,t){var n=e.datas,r=e.distX,i=e.distY,a=n.inverseBeforeMatrix,o=n.inverseMatrix,s=n.is3d,c=n.startDragBeforeDist,l=n.startDragDist,u=n.absoluteOrigin,d=s?4:3;return K(uv(t?a:o,sv(u,[r,i]),d),t?c:l)}function Ab(e,t){var n=e.datas,r=e.distX,i=e.distY,a=n.beforeMatrix,o=n.matrix,s=n.is3d,c=n.startDragBeforeDist,l=n.startDragDist,u=n.absoluteOrigin,d=s?4:3;return K(uv(t?a:o,sv(t?c:l,[r,i]),d),u)}function jb(e,t,n,r,i,a){return r===void 0&&(r=t),i===void 0&&(i=n),a===void 0&&(a=[0,0]),e?e.map(function(e,o){var s=g_(e),c=s.value,l=s.unit,u=o?i:r,d=o?n:t;return e===`%`||isNaN(c)?d*(u?a[o]/u:0):l===`%`?d*c/100:c}):a}function Mb(e){var t=[];return e[1]>=0&&(e[0]>=0&&t.push(3),e[0]<=0&&t.push(2)),e[1]<=0&&(e[0]>=0&&t.push(1),e[0]<=0&&t.push(0)),t}function Nb(e,t){return Mb(t).map(function(t){return e[t]})}function Pb(e,t){var n=(t+1)/2;return[t_(e[0][0],e[1][0],n,1-n),t_(e[0][1],e[1][1],n,1-n)]}function Fb(e,t){return Pb([Pb([e[0],e[1]],t[0]),Pb([e[2],e[3]],t[0])],t[1])}function Ib(e,t,n,r,i,a){var o=Fb(GC(t,n,r,i),a);return[e[0]-o[0],e[1]-o[1]]}function Lb(e,t,n,r){return ov(e,kC(t,r,n),r)}function Rb(e,t,n,r){var i=e.transformOrigin,a=e.offsetMatrix,o=e.is3d?4:3,s;if(a_(n)){var c=t.beforeTransform,l=t.afterTransform;s=iv(r?Tv(n):ov(ov(c,Tv([n]),4),l,4),4,o)}else s=n;return Lb(a,s,i,o)}function zb(e,t){var n=e.transformOrigin,r=e.offsetMatrix,i=e.is3d,a=e.targetMatrix,o=e.targetAllTransform,s=i?4:3;return Lb(r,ov(o||a,bv(t,s),s),n,s)}function Bb(e,t){var n=Wb(t);return{setTransform:function(r,i){i===void 0&&(i=-1),n.startTransforms=i_(r)?r:p_(r),Hb(e,t,i)},setTransformIndex:function(n){Hb(e,t,n)}}}function Vb(e,t,n){var r=Wb(t).startTransforms;Hb(e,t,y_(r,function(e){return e.indexOf(`${n}(`)===0}))}function Hb(e,t,n){var r=Wb(t),i=t.datas;if(i.transformIndex=n,n!==-1){var a=r.startTransforms[n];if(a){var o=e.state;i.startValue=Ov([a],{"x%":function(e){return e/100*o.offsetWidth},"y%":function(e){return e/100*o.offsetHeight}})[0].functionValue}}}function Ub(e,t){var n=Wb(e);n.nextTransforms=p_(t)}function Wb(e){return e.originalDatas.beforeRenderable}function Gb(e){return e.originalDatas.beforeRenderable.nextTransforms}function Kb(e){return(Gb(e)||[]).join(` `)}function qb(e){return Wb(e).nextStyle}function Jb(e,t,n,r,i){Ub(i,t);var a=NS.drag(e,vb(i,e.state,n,r,!1)),o=a?a.transform:t;return q(q({transform:t,drag:a},mw({transform:o},i)),{afterTransform:o})}function Yb(e,t,n,r,i,a){return $b(e,n,r,Rb(e.state,i,t,a))}function Xb(e,t,n,r,i,a,o){var s=Yb(e,t,n,i,a,o),c=e.state,l=c.left,u=c.top,d=e.props.groupable,f=d?l:0,p=d?u:0;return K(K(r,s),[f,p])}function Zb(e,t,n,r,i,a,o){return Xb(e,t,n,r,i,a,o)}function Qb(e,t,n){return[t?-1+e[0]/(t/2):0,n?-1+e[1]/(n/2):0]}function $b(e,t,n,r){r===void 0&&(r=e.state.allMatrix);var i=e.state,a=i.width,o=i.height,s=i.is3d?4:3,c=[a/2*(1+t[0])+n[0],o/2*(1+t[1])+n[1]];return WC(r,c,s)}function ex(e,t,n){var r=n.fixedDirection,i=n.fixedPosition,a=n.fixedOffset;return Xb(e,`rotate(${t}deg)`,r,i,a,n)}function tx(e,t,n,r,i,a){var o=e.props.groupable,s=e.state,c=s.transformOrigin,l=s.offsetMatrix,u=s.is3d,d=s.width,f=s.height,p=s.left,m=s.top,h=a.fixedDirection,g=a.nextTargetMatrix||s.targetMatrix,_=u?4:3,v=jb(i,t,n,d,f,c),y=o?p:0,b=o?m:0;return K(Ib(r,Lb(l,g,v,_),t,n,_,h),[y,b])}function nx(e,t){return Fb(dw(e.state),t)}function rx(e,t){var n=e.targetGesto,r=e.controlGesto,i;return n?.isFlag()&&(i=n.getEventData()[t]),!i&&r?.isFlag()&&(i=r.getEventData()[t]),i||{}}function ix(e){if(e&&e.getRootNode){var t=e.getRootNode();if(t.nodeType===11)return t}}function ax(e){var t=e(`scale`),n=e(`rotate`),r=e(`translate`),i=[];return r&&r!==`0px`&&r!==`none`&&i.push(`translate(${r.split(/\s+/).join(`,`)})`),n&&n!==`1`&&n!==`none`&&i.push(`rotate(${n})`),t&&t!==`1`&&t!==`none`&&i.push(`scale(${t.split(/\s+/).join(`,`)})`),i}function ox(e,t,n){for(var r=e,i=[],a=W_(e)||G_(e),o=!n&&e===t||e===a,s=o,c=!1,l=3,u,d,f,p=!1,m=FC(t,t,!0).offsetParent,h=1;r&&!s;){s=o;var g=px(r),_=g(`position`),v=PC(r),y=_===`fixed`,b=ax(g),x=cv(OC(v)),S=void 0,C=!1,w=!1,T=0,E=0,D=0,O=0,k={hasTransform:!1,fixedContainer:null};y&&(p=!0,k=zC(r),m=k.fixedContainer);var A=x.length;!c&&(A===16||b.length)&&(c=!0,l=4,RC(i),f&&=iv(f,3,4)),c&&A===9&&(x=iv(x,3,4));var j=IC(r,e),M=j.tagName,N=j.hasOffset,ee=j.isSVG,P=j.origin,F=j.targetOrigin,te=j.offset,I=J(te,2),ne=I[0],re=I[1];M===`svg`&&!r.ownerSVGElement&&f&&(i.push({type:`target`,target:r,matrix:HC(r,l)}),i.push({type:`offset`,target:r,matrix:yv(l)}));var ie=parseFloat(g(`zoom`))||1;if(y)S=k.fixedContainer,C=!0;else{var ae=FC(r,t,!1,!0,g),oe=ae.offsetZoom;if(S=ae.offsetParent,C=ae.isEnd,w=ae.isStatic,h*=oe,(ae.isCustomElement||oe!==1)&&w)ne-=S.offsetLeft,re-=S.offsetTop;else if((ib||rb)&&ae.parentSlotElement){for(var se=S,ce=0,L=0;se&&ix(se);)ce+=se.offsetLeft,L+=se.offsetTop,se=se.offsetParent;ne-=ce,re-=L}}if(Xy&&!ab&&N&&!ee&&w&&(_===`relative`||_===`static`)&&(ne-=S.offsetLeft,re-=S.offsetTop,o||=C),y)N&&k.hasTransform&&(D=S.clientLeft,O=S.clientTop);else if(N&&m!==S&&(T=S.clientLeft,E=S.clientTop),N&&S===a){var le=LC(r,!1);ne+=le[0],re+=le[1]}if(i.push({type:`target`,target:r,matrix:kC(x,l,P)}),b.length&&(i.push({type:`offset`,target:r,matrix:yv(l)}),i.push({type:`target`,target:r,matrix:kC(Tv(b),l,P)})),N){var ue=r===e,de=ue?0:r.scrollLeft,fe=ue?0:r.scrollTop;i.push({type:`offset`,target:r,matrix:xv([ne-de+T-D,re-fe+E-O],l)})}else i.push({type:`offset`,target:r,origin:P});if(ie!==1&&i.push({type:`zoom`,target:r,matrix:kC(bv([ie,ie],l),l,[0,0])}),f||=x,u||=P,d||=F,s||y)break;r=S,o=C,(!n||r===a)&&(s=o)}return f||=yv(l),u||=[0,0],d||=[0,0],{zoom:h,offsetContainer:m,matrixes:i,targetMatrix:f,transformOrigin:u,targetOrigin:d,is3d:c,hasFixed:p}}var sx=null,cx=null,lx=null;function ux(e){e?(window.Map&&(sx=new Map,cx=new Map),lx=[]):(sx=null,lx=null,cx=null)}function dx(e){var t=cx?.get(e);if(t)return t;var n=ow(e,!0);return cx&&cx.set(e,n),n}function fx(e,t){if(lx){var n=b_(lx,function(n){return n[0][0]==e&&n[0][1]==t});if(n)return n[1]}var r=ox(e,t,!0);return lx&&lx.push([[e,t],r]),r}function px(e){var t=sx?.get(e);if(!t){var n=K_(e).getComputedStyle(e);if(!sx)return function(e){return n[e]};t={style:n,cached:{}},sx.set(e,t)}var r=t.cached,i=t.style;return function(e){return e in r||(r[e]=i[e]),r[e]}}function mx(e,t,n){var r=n.originalDatas;r.groupable=r.groupable||{};var i=r.groupable;i.childDatas=i.childDatas||[];var a=i.childDatas;return e.moveables.map(function(e,r){return a[r]=a[r]||{},a[r][t]=a[r][t]||{},q(q({},n),{isRequestChild:!0,datas:a[r][t],originalDatas:a[r]})})}function hx(e,t,n,r,i,a,o){var s=!!n.match(/Start$/g),c=!!n.match(/End$/g),l=i.isPinch,u=i.datas,d=mx(e,t.name,i),f=e.moveables,p=[],m=d.map(function(e,i){var d=f[i],m=d.state,h=m.gestos,g=e;if(s)g=new yb(o).dragStart(r,e),p.push(g);else{if(h[o]||(h[o]=u.childGestos[i]),!h[o])return;g=vb(e,m,r,l,a,o),p.push(g)}var _=t[n](d,q(q({},g),{parentFlag:!0}));return c&&(h[o]=null),_});return s&&(u.childGestos=f.map(function(e){return e.state.gestos[o]})),{eventParams:m,childEvents:p}}function gx(e,t,n,r,i,a){i===void 0&&(i=function(e,t){return t});var o=!!n.match(/End$/g),s=mx(e,t.name,r),c=e.moveables;return s.map(function(e,r){var s=c[r],l=e;l=i(s,e);var u=t[n](s,q(q({},l),{parentFlag:!0}));return u&&a&&a(s,e,u,r),o&&(s.state.gestos={}),u})}function _x(e,t,n,r){var i=n.fixedDirection,a=n.fixedPosition,o=Fb(r.datas.startPositions||dw(t.state),i),s=J(uv(vv(-e.rotation/180*Math.PI,3),[o[0]-a[0],o[1]-a[1],1],3),2),c=s[0],l=s[1];return r.datas.originalX=c,r.datas.originalY=l,r}function vx(e,t,n,r){var i=e.getState(),a=i.renderPoses,o=i.rotation,s=i.direction,c=ew(e.props,t).zoom,l=hC(o/Math.PI*180),u={},d=e.renderState;d.renderDirectionMap||={};var f=d.renderDirectionMap;n.forEach(function(e){var t=e.dir;u[t]=!0});var p=qw(s);return n.map(function(e){var n=e.data,i=e.classNames,s=e.dir,d=hb[s];if(!d||!u[s])return null;f[s]=!0;var m=(P_(l,15)+p*gb[s]+720)%180,h={};return C_(n).forEach(function(e){h[`data-${e}`]=n[e]}),r.createElement(`div`,q({className:X.apply(void 0,Y([`control`,`direction`,s,t],J(i),!1)),"data-rotation":m,"data-direction":s},h,{key:`direction-${s}`,style:$C.apply(void 0,Y([o,c],J(d.map(function(e){return a[e]})),!1))}))})}function yx(e,t,n,r){var i=ew(e.props,n),a=i.renderDirections,o=a===void 0?t:a,s=i.displayAroundControls;if(!o)return[];var c=o===!0?Ky:o;return Y(Y([],J(s?Tx(e,r,n,c):[]),!1),J(vx(e,n,c.map(function(e){return{data:{},classNames:[],dir:e}}),r)),!1)}function bx(e,t,n,r,i,a){var o=[...arguments].slice(6),s=A_(n,r),c=t?P_(s/Math.PI*180,15)%180:-1;return e.createElement(`div`,{key:`line-${a}`,className:X.apply(void 0,Y([`line`,`direction`,t?`edge`:``,t],J(o),!1)),"data-rotation":c,"data-line-key":a,"data-direction":t,style:QC(n,r,i,s)})}function xx(e,t,n,r,i){return(n===!0?Gy:n).map(function(n,a){var o=J(hb[n],2),s=o[0],c=o[1];if(c!=null)return bx(e,n,r[s],r[c],i,`${t}Edge${a}`,t)}).filter(Boolean)}function Sx(e){return function(t,n){var r=ew(t.props,e).edge;return r&&(r===!0||r.length)?Y(Y([],J(xx(n,e,r,t.getState().renderPoses,t.props.zoom)),!1),J(wx(t,e,n)),!1):Cx(t,e,n)}}function Cx(e,t,n){return yx(e,Ky,t,n)}function wx(e,t,n){return yx(e,[`nw`,`ne`,`sw`,`se`],t,n)}function Tx(e,t,n,r){var i=e.renderState;i.renderDirectionMap||={};var a=e.getState(),o=a.renderPoses,s=a.rotation,c=a.direction,l=i.renderDirectionMap,u=e.props.zoom,d=qw(c),f=s/Math.PI*180;return(r||C_(l)).map(function(e){var r=hb[e];if(!r)return null;var i=(P_(f,15)+d*gb[e]+720)%180,a=[`around-control`];return n&&a.push(`direction`,n),t.createElement(`div`,{className:X.apply(void 0,Y([],J(a),!1)),"data-rotation":i,"data-direction":e,key:`direction-around-${e}`,style:$C.apply(void 0,Y([s,u],J(r.map(function(e){return o[e]})),!1))})})}function Ex(e,t,n){var r=e||{},i=r.position,a=i===void 0?`client`:i,o=r.left,s=o===void 0?-1/0:o,c=r.top,l=c===void 0?-1/0:c,u=r.right,d=u===void 0?1/0:u,f=r.bottom,p={position:a,left:s,top:l,right:d,bottom:f===void 0?1/0:f};return{vertical:kx(p,t,!0),horizontal:kx(p,n,!1)}}function Dx(e,t){var n=e.state,r=n.containerClientRect,i=r.clientHeight,a=r.clientWidth,o=r.clientLeft,s=r.clientTop,c=n.snapOffset,l=c.left,u=c.top,d=c.right,f=c.bottom,p=t||e.props.bounds||{},m=(p.position||`client`)===`css`,h=p.left,g=h===void 0?-1/0:h,_=p.top,v=_===void 0?-1/0:_,y=p.right,b=y===void 0?m?-1/0:1/0:y,x=p.bottom,S=x===void 0?m?-1/0:1/0:x;return m&&(b=a+d-l-b,S=i+f-u-S),{left:g+l-o,right:b+l-o,top:v+u-s,bottom:S+u-s}}function Ox(e,t,n){var r=Dx(e),i=r.left,a=r.top,o=r.right,s=r.bottom,c=J(n,2),l=c[0],u=c[1],d=J(K(n,t),2),f=d[0],p=d[1];Q(f)<ub&&(f=0),Q(p)<ub&&(p=0);var m=p>0,h=f>0,g={isBound:!1,offset:0,pos:0},_={isBound:!1,offset:0,pos:0};if(f===0&&p===0)return{vertical:g,horizontal:_};if(f===0)m?s<u&&(_.pos=s,_.offset=u-s):a>u&&(_.pos=a,_.offset=u-a);else if(p===0)h?o<l&&(g.pos=o,g.offset=l-o):i>l&&(g.pos=i,g.offset=l-i);else{var v=p/f,y=n[1]-v*l,b=0,x=0,S=!1;h&&o<=l?(b=v*o+y,x=o,S=!0):!h&&l<=i&&(b=v*i+y,x=i,S=!0),S&&(b<a||b>s)&&(S=!1),S||(m&&s<=u?(b=s,x=(b-y)/v,S=!0):!m&&u<=a&&(b=a,x=(b-y)/v,S=!0)),S&&(g.isBound=!0,g.pos=x,g.offset=l-x,_.isBound=!0,_.pos=b,_.offset=u-b)}return{vertical:g,horizontal:_}}function kx(e,t,n){var r=e[n?`left`:`top`],i=e[n?`right`:`bottom`],a=Math.min.apply(Math,Y([],J(t),!1)),o=Math.max.apply(Math,Y([],J(t),!1)),s=[];return r+1>a&&s.push({direction:`start`,isBound:!0,offset:a-r,pos:r}),i-1<o&&s.push({direction:`end`,isBound:!0,offset:o-i,pos:i}),s.length||s.push({isBound:!1,offset:0,pos:0}),s.sort(function(e,t){return Q(t.offset)-Q(e.offset)})}function Ax(e,t,n){return(n?e.map(function(e){return hv(e,n)}):e).some(function(e){return e[0]<t.left&&Q(e[0]-t.left)>.1||e[0]>t.right&&Q(e[0]-t.right)>.1||e[1]<t.top&&Q(e[1]-t.top)>.1||e[1]>t.bottom&&Q(e[1]-t.bottom)>.1})}function jx(e,t,n){var r=XC(e),i=Math.sqrt(r*r-t*t)||0;return[i,-i].sort(function(t,r){return Q(t-e[+!n])-Q(r-e[+!n])}).map(function(e){return A_([0,0],n?[e,t]:[t,e])})}function Mx(e,t,n,r,i){if(!e.props.bounds)return[];var a=i*Math.PI/180,o=Dx(e),s=o.left,c=o.top,l=o.right,u=o.bottom,d=s-r[0],f=l-r[0],p=c-r[1],m=u-r[1],h={left:d,top:p,right:f,bottom:m};if(!Ax(n,h,0))return[];var g=[];return[[d,0],[f,0],[p,1],[m,1]].forEach(function(e){var r=J(e,2),i=r[0],o=r[1];n.forEach(function(e){var n=A_([0,0],e);g.push.apply(g,Y([],J(jx(e,i,o).map(function(e){return a+e-n}).filter(function(e){return!Ax(t,h,e)}).map(function(e){return P_(e*180/Math.PI,ub)})),!1))})}),g}var Nx=[`left`,`right`,`center`],Px=[`top`,`bottom`,`middle`],Fx={left:`start`,right:`end`,center:`center`,top:`start`,bottom:`end`,middle:`center`},Ix={start:`left`,end:`right`,center:`center`},Lx={start:`top`,end:`bottom`,center:`middle`};function Rx(){return{left:!1,top:!1,right:!1,bottom:!1}}function zx(e,t){var n=e.props,r=n.snappable,i=n.bounds,a=n.innerBounds,o=n.verticalGuidelines,s=n.horizontalGuidelines,c=n.snapGridWidth,l=n.snapGridHeight,u=e.state,d=u.guidelines,f=u.enableSnap;return!r||!f||t&&r!==!0&&r.indexOf(t)<0?!1:!!(c||l||i||a||d&&d.length||o&&o.length||s&&s.length)}function Bx(e){return e===!1?{}:e===!0||!e?{left:!0,right:!0,top:!0,bottom:!0}:e}function Vx(e,t){var n=Bx(e),r={};for(var i in n)i in t&&n[i]&&(r[i]=t[i]);return r}function Hx(e,t){var n=Vx(e,t),r=Px.filter(function(e){return e in n}),i=Nx.filter(function(e){return e in n});return{horizontalNames:r,verticalNames:i,horizontal:r.map(function(e){return n[e]}),vertical:i.map(function(e){return n[e]})}}function Ux(e,t,n){var r=WC(e,[t.clientLeft,t.clientTop],n);return[t.left+r[0],t.top+r[1]]}function Wx(e){var t=J(e,2),n=t[0],r=t[1],i=r[0]-n[0],a=r[1]-n[1];Math.abs(i)<1e-7&&(i=0),Math.abs(a)<1e-7&&(a=0);var o=0,s=0,c=0;return i?a?(o=-a/i,s=1,c=o*n[0]-n[1]):(s=1,c=-n[1]):(o=-1,c=n[0]),[o,s,c].map(function(e){return P_(e,Qg)})}var Gx=`snapRotationThreshold`,Kx=`snapRotationDegrees`,qx=`snapHorizontalThreshold`,Jx=`snapVerticalThreshold`;function Yx(e,t,n,r,i,a,o){r===void 0&&(r=[]),i===void 0&&(i=[]);var s=e.props,c=e.state.snapThresholdInfo?.multiples||[1,1],l=Sw(o,s[qx],5),u=Sw(a,s[Jx],5);return Xx(e.state.guidelines,t,n,r,i,l,u,c)}function Xx(e,t,n,r,i,a,o,s){return{vertical:tS(e,`vertical`,t,o*s[0],r),horizontal:tS(e,`horizontal`,n,a*s[1],i)}}function Zx(e,t,n){var r=J(n,2),i=r[0],a=r[1],o=J(t,2),s=o[0],c=o[1],l=J(K(n,t),2),u=l[0],d=l[1],f=d>0,p=u>0;u=jw(u),d=jw(d);var m={isSnap:!1,offset:0,pos:0},h={isSnap:!1,offset:0,pos:0};if(u===0&&d===0)return{vertical:m,horizontal:h};var g=Yx(e,u?[i]:[],d?[a]:[],[],[],void 0,void 0),_=g.vertical,v=g.horizontal;_.posInfos.filter(function(e){var t=e.pos;return p?t>=s:t<=s}),v.posInfos.filter(function(e){var t=e.pos;return f?t>=c:t<=c}),_.isSnap=_.posInfos.length>0,v.isSnap=v.posInfos.length>0;var y=eS(_),b=y.isSnap,x=y.guideline,S=eS(v),C=S.isSnap,w=S.guideline,T=C?w.pos[1]:0,E=b?x.pos[0]:0;if(u===0)C&&(h.isSnap=!0,h.pos=w.pos[1],h.offset=a-h.pos);else if(d===0)b&&(m.isSnap=!0,m.pos=E,m.offset=i-E);else{var D=d/u,O=n[1]-D*i,k=0,A=0,j=!1;b?(A=E,k=D*A+O,j=!0):C&&(k=T,A=(k-O)/D,j=!0),j&&(m.isSnap=!0,m.pos=A,m.offset=i-A,h.isSnap=!0,h.pos=k,h.offset=a-k)}return{vertical:m,horizontal:h}}function Qx(e){var t=``;return e===-1||e===`top`||e===`left`?t=`start`:e===0||e===`center`||e===`middle`?t=`center`:(e===1||e===`right`||e===`bottom`)&&(t=`end`),t}function $x(e,t,n,r){var i=Hx(e.props.snapDirections,t),a=Yx(e,i.vertical,i.horizontal,i.verticalNames.map(function(e){return Qx(e)}),i.horizontalNames.map(function(e){return Qx(e)}),n,r),o=Qx(i.horizontalNames[a.horizontal.index]),s=Qx(i.verticalNames[a.vertical.index]);return{vertical:q(q({},a.vertical),{direction:s}),horizontal:q(q({},a.horizontal),{direction:o})}}function eS(e){var t=e.isSnap;if(!t)return{isSnap:!1,offset:0,dist:-1,pos:0,guideline:null};var n=e.posInfos[0],r=n.guidelineInfos[0],i=r.offset,a=r.dist,o=r.guideline;return{isSnap:t,offset:i,dist:a,pos:n.pos,guideline:o}}function tS(e,t,n,r,i){if(i===void 0&&(i=[]),!e||!e.length)return{isSnap:!1,index:-1,direction:``,posInfos:[]};var a=t===`vertical`?0:1,o=n.map(function(n,o){var s=i[o]||``;return{pos:n,index:o,guidelineInfos:e.map(function(e){var t=n-e.pos[a];return{offset:t,dist:Q(t),guideline:e,direction:s}}).filter(function(e){var n=e.guideline,i=e.dist;return!(n.type!==t||i>r)}).sort(function(e,t){return e.dist-t.dist}),direction:s}}).filter(function(e){return e.guidelineInfos.length>0}).sort(function(e,t){return e.guidelineInfos[0].dist-t.guidelineInfos[0].dist}),s=o.length>0;return{isSnap:s,index:s?o[0].index:-1,direction:o[0]?.direction??``,posInfos:o}}function nS(e,t,n,r,i){var a=[];n[0]&&n[1]?a=[n,[-n[0],n[1]],[n[0],-n[1]]]:!n[0]&&!n[1]?[[-1,-1],[1,-1],[1,1],[-1,1]].forEach(function(e,t,n){var r=n[t+1]||n[0];a.push(e),a.push([(e[0]+r[0])/2,(e[1]+r[1])/2])}):e.props.keepRatio?a.push([-1,-1],[-1,1],[1,-1],[1,1],n):(a.push.apply(a,Y([],J(Nb([[-1,-1],[1,-1],[-1,-1],[1,1]],n)),!1)),a.length>1&&a.push([(a[0][0]+a[1][0])/2,(a[0][1]+a[1][1])/2]));var o=a.map(function(e){return Fb(t,e)}),s=Yx(e,o.map(function(e){return e[0]}),o.map(function(e){return e[1]}),a.map(function(e){return Qx(e[0])}),a.map(function(e){return Qx(e[1])}),r,i),c=Qx(a.map(function(e){return e[0]})[s.vertical.index]),l=Qx(a.map(function(e){return e[1]})[s.horizontal.index]);return{vertical:q(q({},s.vertical),{direction:c}),horizontal:q(q({},s.horizontal),{direction:l})}}function rS(e,t){var n=Q(e.offset),r=Q(t.offset);return e.isBound&&t.isBound?r-n:e.isBound?-1:t.isBound?1:e.isSnap&&t.isSnap?r-n:e.isSnap?-1:t.isSnap||n<ub?1:r<ub?-1:n-r}function iS(e,t){return e.slice().sort(function(e,n){var r=e.sign[t],i=n.sign[t],a=e.offset[t],o=n.offset[t];return r?i?rS({isBound:e.isBound,isSnap:e.isSnap,offset:a},{isBound:n.isBound,isSnap:n.isSnap,offset:o}):-1:1})[0]}function aS(e,t,n){var r=[];if(n)Q(t[0])!==1||Q(t[1])!==1?r.push([t,[-1,-1]],[t,[-1,1]],[t,[1,-1]],[t,[1,1]]):r.push([t,[e[0],-e[1]]],[t,[-e[0],e[1]]]),r.push([t,e]);else if(e[0]&&e[1]||!e[0]&&!e[1]){var i=e[0]?e:[1,1];[1,-1].forEach(function(e){[1,-1].forEach(function(n){var a=[e*i[0],n*i[1]];t[0]===a[0]&&t[1]===a[1]||r.push([t,a])})})}else if(e[0]){var a=Q(t[0])===1?[1]:[1,-1];a.forEach(function(n){r.push([[t[0],-1],[n*e[0],-1]],[[t[0],0],[n*e[0],0]],[[t[0],1],[n*e[0],1]])})}else if(e[1]){var a=Q(t[1])===1?[1]:[1,-1];a.forEach(function(n){r.push([[-1,t[1]],[-1,n*e[1]]],[[0,t[1]],[0,n*e[1]]],[[1,t[1]],[1,n*e[1]]])})}return r}function oS(e,t){var n=k_([t[0][0],t[1][0]]),r=k_([t[0][1],t[1][1]]);return{vertical:n<=e[0],horizontal:r<=e[1]}}function sS(e,t){var n=J(t,2),r=n[0],i=n[1],a=i[0]-r[0],o=i[1]-r[1];Q(a)<ub&&(a=0),Q(o)<ub&&(o=0);var s,c;return a?o?(s=o/a*(e[0]-r[0])+r[1],c=e[1]):(s=r[1],c=e[1]):(s=r[0],c=e[0]),s-c}function cS(e,t,n,r){return r===void 0&&(r=ub),e.every(function(e){var i=sS(e,t);return i<=0===n||Q(i)<=r})}function lS(e,t,n,r,i){return i===void 0&&(i=0),r&&t-i<=e||!r&&e<=n+i?{isBound:!0,offset:r?t-e:n-e}:{isBound:!1,offset:0}}function uS(e,t){var n=t.line,r=t.centerSign,i=t.verticalSign,a=t.horizontalSign,o=t.lineConstants,s=e.props.innerBounds;if(!s)return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var c=s.left,l=s.top,u=s.width,d=s.height,f=[[c,l],[c,l+d]],p=[[c,l],[c+u,l]],m=[[c+u,l],[c+u,l+d]],h=[[c,l+d],[c+u,l+d]];if(cS([[c,l],[c+u,l],[c,l+d],[c+u,l+d]],n,r))return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var g=dS(n,o,p,i),_=dS(n,o,h,i),v=dS(n,o,f,a),y=dS(n,o,m,a),b=g.isBound&&_.isBound,x=g.isBound||_.isBound,S=v.isBound&&y.isBound,C=v.isBound||y.isBound,w=Ew(g.offset,_.offset),T=Ew(v.offset,y.offset),E=[0,0],D=!1,O=!1;return Q(T)<Q(w)?(E=[w,0],D=x,O=b):(E=[0,T],D=C,O=S),{isAllBound:O,isVerticalBound:x,isHorizontalBound:C,isBound:D,offset:E}}function dS(e,t,n,r,i,a){var o=J(t,2),s=o[0],c=o[1],l=e[0],u=n[0],d=n[1],f=jw(d[1]-u[1]),p=jw(d[0]-u[0]),m=c,h=s,g=-s/c;if(!p){if(a&&!h)return{isBound:!1,offset:0};if(m)return lS(g*(u[0]-l[0])+l[1],u[1],d[1],r,i);var _=u[0]-l[0],v=Q(_)<=(i||0);return{isBound:v,offset:v?_:0}}else if(!f){if(a&&!m)return{isBound:!1,offset:0};if(h)return lS((u[1]-l[1])/g+l[0],u[0],d[0],r,i);var _=u[1]-l[1],v=Q(_)<=(i||0);return{isBound:v,offset:v?_:0}}return{isBound:!1,offset:0}}function fS(e,t,n){return t.map(function(t){var r=uS(e,t),i=r.isBound,a=r.offset,o=r.isVerticalBound,s=r.isHorizontalBound,c=t.multiple;return{sign:c,isBound:i,isVerticalBound:o,isHorizontalBound:s,isSnap:!1,offset:kb({datas:n,distX:a[0],distY:a[1]}).map(function(e,t){return e*(c[t]?2/c[t]:0)})}})}function pS(e,t,n){var r,i=fS(e,hS(e,t,[0,0],!1).map(function(e){return q(q({},e),{multiple:e.multiple.map(function(e){return Q(e)*2})})}),n),a=iS(i,0),o=iS(i,1),s=0,c=0,l=a.isVerticalBound||o.isVerticalBound,u=a.isHorizontalBound||o.isHorizontalBound;return(l||u)&&(r=J(Ab({datas:n,distX:-a.offset[0],distY:-o.offset[1]}),2),s=r[0],c=r[1]),{vertical:{isBound:l,offset:s},horizontal:{isBound:u,offset:c}}}function mS(e,t){var n=[],r=e[0],i=e[1];return r&&i?n.push([[0,i*2],e,[-r,i]],[[r*2,0],e,[r,-i]]):r?(n.push([[r*2,0],[r,1],[r,-1]]),t&&n.push([[0,-1],[r,-1],[-r,-1]],[[0,1],[r,1],[-r,1]])):i?(n.push([[0,i*2],[1,i],[-1,i]]),t&&n.push([[-1,0],[-1,i],[-1,-i]],[[1,0],[1,i],[1,-i]])):n.push([[-1,0],[-1,-1],[-1,1]],[[1,0],[1,-1],[1,1]],[[0,-1],[-1,-1],[1,-1]],[[0,1],[-1,1],[1,1]]),n}function hS(e,t,n,r){var i=e.state,a=i.allMatrix,o=i.is3d,s=GC(a,100,100,o?4:3),c=Fb(s,[0,0]);return mS(n,r).map(function(e){var n=J(e,3),r=n[0],i=n[1],a=n[2],o=[Fb(s,i),Fb(s,a)],l=Wx(o),u=oS(c,o),d=u.vertical,f=u.horizontal;return{multiple:r,centerSign:sS(c,o)<=0,verticalSign:d,horizontalSign:f,lineConstants:l,line:[Fb(t,i),Fb(t,a)]}})}function gS(e,t,n,r){var i=r?e.map(function(e){return hv(e,r)}):e;return[[i[0],i[1]],[i[1],i[3]],[i[3],i[2]],[i[2],i[0]]].some(function(e){return!cS(t,e,sS(n,e)<=0)})}function _S(e){var t=J(e,2),n=t[0],r=t[1],i=r[0]-n[0],a=r[1]-n[1];if(!i)return Q(n[0]);if(!a)return Q(n[1]);var o=a/i;return Q((-o*n[0]+n[1])/Math.sqrt(o**2+1))}function vS(e){var t=J(e,2),n=t[0],r=t[1],i=r[0]-n[0],a=r[1]-n[1];if(!i)return[n[0],0];if(!a)return[0,n[1]];var o=a/i,s=-o*n[0]+n[1];return[-s/(o+1/o),s/(o*o+1)]}function yS(e,t,n,r,i){var a=e.props.innerBounds,o=i*Math.PI/180;if(!a)return[];var s=a.left,c=a.top,l=a.width,u=a.height,d=s-r[0],f=s+l-r[0],p=c-r[1],m=c+u-r[1],h=[[d,p],[f,p],[d,m],[f,m]],g=Fb(n,[0,0]);if(!gS(n,h,g,0))return[];var _=[],v=h.map(function(e){return[XC(e),A_([0,0],e)]});return[[n[0],n[1]],[n[1],n[3]],[n[3],n[2]],[n[2],n[0]]].forEach(function(e){var n=A_([0,0],vS(e)),r=_S(e);_.push.apply(_,Y([],J(v.filter(function(e){var t=J(e,1)[0];return t&&r<=t}).map(function(e){var t=J(e,2),i=t[0],a=t[1],s=Math.acos(i?r/i:0),c=a+s,l=a-s;return[o+c-n,o+l-n]}).reduce(function(e,t){return e.push.apply(e,Y([],J(t),!1)),e},[]).filter(function(e){return!gS(t,h,g,e)}).map(function(e){return P_(e*180/Math.PI,ub)})),!1))}),_}function bS(e){var t=e.props.innerBounds,n=Rx();if(!t)return{boundMap:n,vertical:[],horizontal:[]};var r=e.getRect(),i=[r.pos1,r.pos2,r.pos3,r.pos4],a=Fb(i,[0,0]),o=t.left,s=t.top,c=t.width,l=t.height,u=[[o,s],[o,s+l]],d=[[o,s],[o+c,s]],f=[[o+c,s],[o+c,s+l]],p=[[o,s+l],[o+c,s+l]],m=hS(e,i,[0,0],!1),h=[],g=[];return m.forEach(function(e){var t=e.line,r=e.lineConstants,i=oS(a,t),m=i.horizontal,_=i.vertical,v=dS(t,r,d,_,1,!0),y=dS(t,r,p,_,1,!0),b=dS(t,r,u,m,1,!0),x=dS(t,r,f,m,1,!0);v.isBound&&!n.top&&(h.push(s),n.top=!0),y.isBound&&!n.bottom&&(h.push(s+l),n.bottom=!0),b.isBound&&!n.left&&(g.push(o),n.left=!0),x.isBound&&!n.right&&(g.push(o+c),n.right=!0)}),{boundMap:n,horizontal:h,vertical:g}}function xS(e,t,n,r){var i=t[0]-e[0],a=t[1]-e[1];if(Q(i)<1e-7&&(i=0),Q(a)<1e-7&&(a=0),!i)return r?[0,0]:[0,n];if(!a)return r?[n,0]:[0,0];var o=a/i,s=e[1]-o*e[0];return r?[n,o*(t[0]+n)+s-t[1]]:[(t[1]+n-s)/o-t[0],n]}function SS(e,t,n,r,i){var a=xS(e,t,n,r);if(!a)return{isOutside:!1,offset:[0,0]};var o=N_(e,t),s=N_(a,e),c=N_(a,t),l=s>o||c>o,u=J(kb({datas:i,distX:a[0],distY:a[1]}),2);return{offset:[u[0],u[1]],isOutside:l}}function CS(e,t){return e.isBound?e.offset:t.isSnap?eS(t).offset:0}function wS(e,t,n,r,i){var a=J(t,2),o=a[0],s=a[1],c=J(n,2),l=c[0],u=c[1],d=J(r,2),f=d[0],p=d[1],m=J(i,2),h=m[0],g=m[1],_=-h,v=-g;if(e&&o&&s){_=0,v=0;var y=[];if(l&&u?y.push([0,g],[h,0]):l?y.push([h,0]):u?y.push([0,g]):f&&p?y.push([0,g],[h,0]):f?y.push([h,0]):p&&y.push([0,g]),y.length){y.sort(function(e,t){return XC(K([o,s],e))-XC(K([o,s],t))});var b=y[0];if(b[0]&&Q(o)>1e-7)_=-b[0],v=s*Q(o+_)/Q(o)-s;else if(b[1]&&Q(s)>1e-7){var x=s;v=-b[1],_=o*Q(s+v)/Q(x)-o}if(e&&u&&l)if(Q(_)>1e-7&&Q(_)<Q(h)){var S=Q(h)/Q(_);_*=S,v*=S}else if(Q(v)>1e-7&&Q(v)<Q(g)){var S=Q(g)/Q(v);_*=S,v*=S}else _=Ew(-h,_),v=Ew(-g,v)}}else _=o||l?-h:0,v=s||u?-g:0;return[_,v]}function TS(e,t,n,r,i,a){if(!zx(e,`draggable`))return[{isSnap:!1,isBound:!1,offset:0},{isSnap:!1,isBound:!1,offset:0}];var o=uw(a.absolutePoses,[t,n]),s=KC(o),c=s.left,l=s.right,u=s.top,d=s.bottom,f={horizontal:o.map(function(e){return e[1]}),vertical:o.map(function(e){return e[0]})},p=ES(e,i,Hx(Bx(e.props.snapDirections),{left:c,right:l,top:u,bottom:d,center:(c+l)/2,middle:(u+d)/2}),f),m=p.vertical,h=p.horizontal,g=pS(e,o,a),_=g.vertical,v=g.horizontal,y=m.isSnap,b=h.isSnap,x=m.isBound||_.isBound,S=h.isBound||v.isBound,C=Ew(m.offset,_.offset),w=Ew(h.offset,v.offset),T=J(wS(r,[t,n],[x,S],[y,b],[C,w]),2),E=T[0],D=T[1];return[{isBound:x,isSnap:y,offset:E},{isBound:S,isSnap:b,offset:D}]}function ES(e,t,n,r){r===void 0&&(r=n);var i=Ex(Dx(e),r.vertical,r.horizontal),a=i.horizontal,o=i.vertical,s=t?{horizontal:{isSnap:!1,index:-1},vertical:{isSnap:!1,index:-1}}:Yx(e,n.vertical,n.horizontal,void 0,void 0,void 0,void 0),c=s.horizontal,l=s.vertical,u=CS(a[0],c),d=CS(o[0],l),f=Q(u),p=Q(d);return{horizontal:{isBound:a[0].isBound,isSnap:c.isSnap,snapIndex:c.index,offset:u,dist:f,bounds:a,snap:c},vertical:{isBound:o[0].isBound,isSnap:l.isSnap,snapIndex:l.index,offset:d,dist:p,bounds:o,snap:l}}}function DS(e,t,n,r,i,a,o){o===void 0&&(o=[1,1]);var s=Ex(t,n,r),c=s.horizontal,l=s.vertical,u=Xx(e,n,r,[],[],i,a,o),d=u.horizontal,f=u.vertical,p=CS(c[0],d),m=CS(l[0],f),h=Q(p),g=Q(m);return{horizontal:{isBound:c[0].isBound,isSnap:d.isSnap,snapIndex:d.index,offset:p,dist:h,bounds:c,snap:d},vertical:{isBound:l[0].isBound,isSnap:f.isSnap,snapIndex:f.index,offset:m,dist:g,bounds:l,snap:f}}}function OS(e,t,n,r){var i=A_(e,t)/Math.PI*180,a=n.vertical,o=a.isBound,s=a.isSnap,c=a.dist,l=n.horizontal,u=l.isBound,d=l.isSnap,f=l.dist,p=i%180,m=p<3||p>177,h=p>87&&p<93;return f<c&&(o||s&&!h&&(!r||!m))?`vertical`:u||d&&!m&&(!r||!h)?`horizontal`:``}function kS(e,t,n,r,i,a){return n.map(function(n){var o=J(n,2),s=o[0],c=o[1],l=Fb(t,s),u=Fb(t,c),d=r?jS(e,l,u,i):ES(e,i,{vertical:[u[0]],horizontal:[u[1]]}),f=d.horizontal,p=f.offset,m=f.isBound,h=f.isSnap,g=d.vertical,_=g.offset,v=g.isBound,y=g.isSnap,b=K(c,s);if(!_&&!p)return{isBound:v||m,isSnap:y||h,sign:b,offset:[0,0]};var x=OS(l,u,d,r);if(!x)return{sign:b,isBound:!1,isSnap:!1,offset:[0,0]};var S=x===`vertical`,C=[0,0];return C=!r&&Q(c[0])===1&&Q(c[1])===1&&s[0]!==c[0]&&s[1]!==c[1]?kb({datas:a,distX:-_,distY:-p}):SS(l,u,-(S?_:p),S,a).offset,C=C.map(function(e,t){return e*(b[t]?2/b[t]:0)}),{sign:b,isBound:S?v:m,isSnap:S?y:h,offset:C}})}function AS(e,t){return e.isBound?e.offset:t.isSnap?t.offset:0}function jS(e,t,n,r){var i=Ox(e,t,n),a=i.horizontal,o=i.vertical,s=r?{horizontal:{isSnap:!1},vertical:{isSnap:!1}}:Zx(e,t,n),c=s.horizontal,l=s.vertical,u=AS(a,c),d=AS(o,l),f=Q(u),p=Q(d);return{horizontal:{isBound:a.isBound,isSnap:c.isSnap,offset:u,dist:f},vertical:{isBound:o.isBound,isSnap:l.isSnap,offset:d,dist:p}}}function MS(e,t,n,r,i){var a=[-n[0],-n[1]],o=e.state,s=o.width,c=o.height,l=e.props.bounds,u=1/0,d=1/0;if(l){var f=[[n[0],-n[1]],[-n[0],n[1]]],p=l.left,m=p===void 0?-1/0:p,h=l.top,g=h===void 0?-1/0:h,_=l.right,v=_===void 0?1/0:_,y=l.bottom,b=y===void 0?1/0:y;f.forEach(function(e){var n=e[0]!==a[0],o=e[1]!==a[1],l=Fb(t,e),f=A_(r,l)*360/Math.PI;if(o){var p=l.slice();(Q(f-360)<2||Q(f-180)<2)&&(p[1]=r[1]);var h=SS(r,p,(r[1]<l[1]?b:g)-l[1],!1,i),_=J(h.offset,2)[1],y=h.isOutside;isNaN(_)||(d=c+(y?1:-1)*Q(_))}if(n){var p=l.slice();(Q(f-90)<2||Q(f-270)<2)&&(p[0]=r[0]);var x=SS(r,p,(r[0]<l[0]?v:m)-l[0],!0,i),S=J(x.offset,1)[0],C=x.isOutside;isNaN(S)||(u=s+(C?1:-1)*Q(S))}})}return{maxWidth:u,maxHeight:d}}var NS={name:`draggable`,props:[`draggable`,`throttleDrag`,`throttleDragRotate`,`hideThrottleDragRotateLine`,`startDragRotate`,`edgeDraggable`],events:[`dragStart`,`drag`,`dragEnd`,`dragGroupStart`,`dragGroup`,`dragGroupEnd`],requestStyle:function(){return[`left`,`top`,`right`,`bottom`]},requestChildStyle:function(){return[`left`,`top`,`right`,`bottom`]},render:function(e,t){var n=e.props,r=n.hideThrottleDragRotateLine,i=n.throttleDragRotate,a=n.zoom,o=e.getState(),s=o.dragInfo,c=o.beforeOrigin;if(r||!i||!s)return[];var l=s.dist;if(!l[0]&&!l[1])return[];var u=XC(l),d=A_(l,[0,0]);return[t.createElement(`div`,{className:X(`line`,`horizontal`,`dragline`,`dashed`),key:`dragRotateGuideline`,style:{width:`${u}px`,transform:`translate(${c[0]}px, ${c[1]}px) rotate(${d}rad) scaleY(${a})`}})]},dragStart:function(e,t){var n=t.datas,r=t.parentEvent,i=t.parentGesto,a=e.state,o=a.gestos,s=a.style;if(o.draggable)return!1;o.draggable=i||e.targetGesto,n.datas={},n.left=parseFloat(s.left||``)||0,n.top=parseFloat(s.top||``)||0,n.bottom=parseFloat(s.bottom||``)||0,n.right=parseFloat(s.right||``)||0,n.startValue=[0,0],Sb(e,t),Vb(e,t,`translate`),xC(e,n),n.prevDist=[0,0],n.prevBeforeDist=[0,0],n.isDrag=!1,n.deltaOffset=[0,0];var c=gw(e,t,q({set:function(e){n.startValue=e}},Bb(e,t)));return(r||Z(e,`onDragStart`,c))===!1?(o.draggable=null,n.isPinch=!1):(n.isDrag=!0,e.state.dragInfo={startRect:e.getRect(),dist:[0,0]}),n.isDrag?c:!1},drag:function(e,t){if(t){wb(e,t,`translate`);var n=t.datas,r=t.parentEvent,i=t.parentFlag,a=t.isPinch,o=t.deltaOffset,s=t.useSnap,c=t.isRequest,l=t.isGroup,u=t.parentThrottleDrag,d=t.distX,f=t.distY,p=n.isDrag,m=n.prevDist,h=n.prevBeforeDist,g=n.startValue;if(p){o&&(d+=o[0],f+=o[1]);var _=e.props,v=_.parentMoveable,y=l?0:_.throttleDrag||u||0,b=r?0:_.throttleDragRotate||0,x=0,S=!1,C=!1,w=!1,T=!1;if(!r&&b>0&&(d||f)){var E=_.startDragRotate||0,D=P_(E+A_([0,0],[d,f])*180/Math.PI,b)-E,O=f*Math.abs(Math.cos((D-90)/180*Math.PI)),k=XC([d*Math.abs(Math.cos(D/180*Math.PI)),O]);x=D*Math.PI/180,d=k*Math.cos(x),f=k*Math.sin(x)}if(!a&&!r&&!i){var A=J(TS(e,d,f,b,!s&&c||o,n),2),j=A[0],M=A[1];S=j.isSnap,C=j.isBound,w=M.isSnap,T=M.isBound;var N=j.offset,ee=M.offset;d+=N,f+=ee}var P=sv(Ob({datas:n,distX:d,distY:f}),g),F=sv(Eb({datas:n,distX:d,distY:f}),g);F_(F,ub),F_(P,ub),b||(!S&&!C&&(F[0]=P_(F[0],y),P[0]=P_(P[0],y)),!w&&!T&&(F[1]=P_(F[1],y),P[1]=P_(P[1],y)));var te=K(P,g),I=K(F,g),ne=K(I,m),re=K(te,h);n.prevDist=I,n.prevBeforeDist=te,n.passDelta=ne,n.passDist=I;var ie=n.left+te[0],ae=n.top+te[1],oe=n.right-te[0],se=n.bottom-te[1],ce=Tb(n,`translate(${F[0]}px, ${F[1]}px)`,`translate(${I[0]}px, ${I[1]}px)`);if(Ub(t,ce),e.state.dragInfo.dist=r?[0,0]:I,!(!r&&!v&&ne.every(function(e){return!e})&&re.some(function(e){return!e}))){var L=e.state,le=L.width,ue=L.height,de=gw(e,t,q({transform:ce,dist:I,delta:ne,translate:F,beforeDist:te,beforeDelta:re,beforeTranslate:P,left:ie,top:ae,right:oe,bottom:se,width:le,height:ue,isPinch:a},mw({transform:ce},t)));return!r&&Z(e,`onDrag`,de),de}}}},dragAfter:function(e,t){var n=t.datas,r=n.deltaOffset;return r[0]||r[1]?(n.deltaOffset=[0,0],this.drag(e,q(q({},t),{deltaOffset:r}))):!1},dragEnd:function(e,t){var n=t.parentEvent,r=t.datas;if(e.state.dragInfo=null,r.isDrag){r.isDrag=!1;var i=_w(e,t,{});return!n&&Z(e,`onDragEnd`,i),i}},dragGroupStart:function(e,t){var n=t.datas,r=t.clientX,i=t.clientY,a=this.dragStart(e,t);if(!a)return!1;var o=hx(e,this,`dragStart`,[r||0,i||0],t,!1,`draggable`),s=o.childEvents,c=o.eventParams;n.isDrag=Z(e,`onDragGroupStart`,q(q({},a),{targets:e.props.targets,events:c}))!==!1;var l=s[0]?.datas.startValue??[0,0];return n.throttleOffset=[l[0]%1,l[1]%1],n.isDrag?a:!1},dragGroup:function(e,t){if(t.datas.isDrag){var n=this.drag(e,q(q({},t),{parentThrottleDrag:e.props.throttleDrag})),r=t.datas.passDelta,i=hx(e,this,`drag`,r,t,!1,`draggable`).eventParams;if(n){var a=q({targets:e.props.targets,events:i},n);return Z(e,`onDragGroup`,a),a}}},dragGroupEnd:function(e,t){var n=t.isDrag;if(t.datas.isDrag){this.dragEnd(e,t);var r=hx(e,this,`dragEnd`,[0,0],t,!1,`draggable`).eventParams;return Z(e,`onDragGroupEnd`,_w(e,t,{targets:e.props.targets,events:r})),n}},request:function(e){var t={},n=e.getRect(),r=0,i=0,a=!1;return{isControl:!1,requestStart:function(e){return a=e.useSnap,{datas:t,useSnap:a}},request:function(e){return`x`in e?r=e.x-n.left:`deltaX`in e&&(r+=e.deltaX),`y`in e?i=e.y-n.top:`deltaY`in e&&(i+=e.deltaY),{datas:t,distX:r,distY:i,useSnap:a}},requestEnd:function(){return{datas:t,isDrag:!0,useSnap:a}}}},unset:function(e){e.state.gestos.draggable=null,e.state.dragInfo=null}};function PS(e,t){return{fixedPosition:Fb(e,t),fixedDirection:t,fixedOffset:[0,0]}}function FS(e,t){var n=e.allMatrix,r=e.is3d,i=e.width,a=e.height,o=r?4:3;return{fixedPosition:WC(n,[i/2*(1+t[0]),a/2*(1+t[1])],o),fixedDirection:t,fixedOffset:[0,0]}}function IS(e,t){var n=e.allMatrix,r=e.is3d,i=e.width,a=e.height,o=r?4:3,s=Qb(t,i,a);return{fixedPosition:WC(n,t,o),fixedDirection:s,fixedOffset:[i?0:t[0],a?0:t[1]]}}var LS=Nw(`resizable`),RS={name:`resizable`,ableGroup:`size`,canPinch:!0,props:[`resizable`,`throttleResize`,`renderDirections`,`displayAroundControls`,`keepRatio`,`resizeFormat`,`keepRatioFinally`,`edge`,`checkResizableError`],events:[`resizeStart`,`beforeResize`,`resize`,`resizeEnd`,`resizeGroupStart`,`beforeResizeGroup`,`resizeGroup`,`resizeGroupEnd`],render:Sx(`resizable`),dragControlCondition:LS,viewClassName:Mw(`resizable`),dragControlStart:function(e,t){var n=t.inputEvent,r=t.isPinch,i=t.isGroup,a=t.parentDirection,o=t.parentGesto,s=t.datas,c=t.parentFixedDirection,l=t.parentEvent,u=cw(a,r,n,s),d=e.state,f=d.target,p=d.width,m=d.height,h=d.gestos;if(!u||!f||h.resizable)return!1;h.resizable=o||e.controlGesto,!r&&Sb(e,t),s.datas={},s.direction=u,s.startOffsetWidth=p,s.startOffsetHeight=m,s.prevWidth=0,s.prevHeight=0,s.minSize=[0,0],s.startWidth=d.inlineCSSWidth||d.cssWidth,s.startHeight=d.inlineCSSHeight||d.cssHeight,s.maxSize=[1/0,1/0],i||(s.minSize=[d.minOffsetWidth,d.minOffsetHeight],s.maxSize=[d.maxOffsetWidth,d.maxOffsetHeight]);var g=e.props.transformOrigin||`% %`;s.transformOrigin=g&&a_(g)?g.split(` `):g,s.startOffsetMatrix=d.offsetMatrix,s.startTransformOrigin=d.transformOrigin,s.isWidth=t?.parentIsWidth??(!u[0]&&!u[1]||u[0]||!u[1]);function _(e){s.ratio=e&&isFinite(e)?e:0}s.startPositions=dw(e.state);function v(e){var t=PS(s.startPositions,e);s.fixedDirection=t.fixedDirection,s.fixedPosition=t.fixedPosition,s.fixedOffset=t.fixedOffset}function y(t){var n=IS(e.state,t);s.fixedDirection=n.fixedDirection,s.fixedPosition=n.fixedPosition,s.fixedOffset=n.fixedOffset}function b(e){s.minSize=[w_(`${e[0]}`,0)||0,w_(`${e[1]}`,0)||0]}function x(e){var t=[e[0]||1/0,e[1]||1/0];(!o_(t[0])||isFinite(t[0]))&&(t[0]=w_(`${t[0]}`,0)||1/0),(!o_(t[1])||isFinite(t[1]))&&(t[1]=w_(`${t[1]}`,0)||1/0),s.maxSize=t}_(p/m),v(c||[-u[0],-u[1]]),s.setFixedDirection=v,s.setFixedPosition=y,s.setMin=b,s.setMax=x;var S=gw(e,t,{direction:u,startRatio:s.ratio,set:function(e){var t=J(e,2),n=t[0],r=t[1];s.startWidth=n,s.startHeight=r},setMin:b,setMax:x,setRatio:_,setFixedDirection:v,setFixedPosition:y,setOrigin:function(e){s.transformOrigin=e},dragStart:NS.dragStart(e,new yb().dragStart([0,0],t))}),C=l||Z(e,`onResizeStart`,S);return s.startFixedDirection=s.fixedDirection,s.startFixedPosition=s.fixedPosition,C!==!1&&(s.isResize=!0,e.state.snapRenderInfo={request:t.isRequest,direction:u}),s.isResize?S:!1},dragControl:function(e,t){var n,r=t.datas,i=t.parentFlag,a=t.isPinch,o=t.parentKeepRatio,s=t.dragClient,c=t.parentDist,l=t.useSnap,u=t.isRequest,d=t.isGroup,f=t.parentEvent,p=t.resolveMatrix,m=r.isResize,h=r.transformOrigin,g=r.startWidth,_=r.startHeight,v=r.prevWidth,y=r.prevHeight,b=r.minSize,x=r.maxSize,S=r.ratio,C=r.startOffsetWidth,w=r.startOffsetHeight,T=r.isWidth;if(!m)return;if(p){var E=e.state.is3d,D=r.startOffsetMatrix,O=r.startTransformOrigin,k=E?4:3,A=Tv(Gb(t)),j=Math.sqrt(A.length);k!==j&&(A=iv(A,j,k));var M=Lb(D,A,O,k);r.startPositions=GC(M,C,w,k),r.nextTargetMatrix=A,r.nextAllMatrix=M}var N=ew(e.props,`resizable`),ee=N.resizeFormat,P=N.throttleResize,F=P===void 0?+!i:P,te=N.parentMoveable,I=N.keepRatioFinally,ne=r.direction,re=ne,ie=0,ae=0;!ne[0]&&!ne[1]&&(re=[1,1]);var oe=S&&(o??N.keepRatio)||!1;function se(){var e=r.fixedDirection,n=Vw(re,oe,r,t);ie=n.distWidth,ae=n.distHeight;var i=re[0]-e[0]||oe?Math.max(C+ie,ub):C,a=re[1]-e[1]||oe?Math.max(w+ae,ub):w;return oe&&C&&w&&(T?a=i/S:i=a*S),[i,a]}var ce=J(se(),2),L=ce[0],le=ce[1];f||(r.setFixedDirection(r.fixedDirection),Z(e,`onBeforeResize`,gw(e,t,{startFixedDirection:r.startFixedDirection,startFixedPosition:r.startFixedPosition,setFixedDirection:function(e){var t;return r.setFixedDirection(e),t=J(se(),2),L=t[0],le=t[1],[L,le]},setFixedPosition:function(e){var t;return r.setFixedPosition(e),t=J(se(),2),L=t[0],le=t[1],[L,le]},boundingWidth:L,boundingHeight:le,setSize:function(e){var t=J(e,2);L=t[0],le=t[1]}},!0)));var ue=s;s||(ue=!i&&a?nx(e,[0,0]):r.fixedPosition);var de=[0,0];a||(de=yC(e,L,le,ne,ue,!l&&u,r)),c&&(!c[0]&&(de[0]=0),!c[1]&&(de[1]=0));function fe(){var e;ee&&(e=J(ee([L,le]),2),L=e[0],le=e[1]),L=P_(L,F),le=P_(le,F)}if(oe){re[0]&&re[1]&&de[0]&&de[1]&&(Q(de[0])>Q(de[1])?de[1]=0:de[0]=0);var pe=!de[0]&&!de[1];pe&&fe(),re[0]&&!re[1]||de[0]&&!de[1]||pe&&T?(L+=de[0],le=L/S):(!re[0]&&re[1]||!de[0]&&de[1]||pe&&!T)&&(le+=de[1],L=le*S)}else L+=de[0],le+=de[1],L=Math.max(0,L),le=Math.max(0,le);n=J(D_([L,le],b,x,oe?S:!1),2),L=n[0],le=n[1],fe(),oe&&(d||I)&&(T?le=L/S:L=le*S),ie=L-C,ae=le-w;var me=[ie-v,ae-y];r.prevWidth=ie,r.prevHeight=ae;var he=tx(e,L,le,ue,h,r);if(!(!te&&me.every(function(e){return!e})&&he.every(function(e){return!e}))){var ge=NS.drag(e,vb(t,e.state,he,!!a,!1,`draggable`)),_e=ge.transform,ve=g+ie,ye=_+ae,be=gw(e,t,q({width:ve,height:ye,offsetWidth:Math.round(L),offsetHeight:Math.round(le),startRatio:S,boundingWidth:L,boundingHeight:le,direction:ne,dist:[ie,ae],delta:me,isPinch:!!a,drag:ge},hw({style:{width:`${ve}px`,height:`${ye}px`},transform:_e},ge,t)));return!f&&Z(e,`onResize`,be),be}},dragControlAfter:function(e,t){var n=t.datas,r=n.isResize,i=n.startOffsetWidth,a=n.startOffsetHeight,o=n.prevWidth,s=n.prevHeight;if(!(!r||e.props.checkResizableError===!1)){var c=e.state,l=c.width,u=c.height,d=l-(i+o),f=u-(a+s),p=Q(d)>3,m=Q(f)>3;if(p&&(n.startWidth+=d,n.startOffsetWidth+=d,n.prevWidth+=d),m&&(n.startHeight+=f,n.startOffsetHeight+=f,n.prevHeight+=f),p||m)return this.dragControl(e,t)}},dragControlEnd:function(e,t){var n=t.datas,r=t.parentEvent;if(n.isResize){n.isResize=!1;var i=_w(e,t,{});return!r&&Z(e,`onResizeEnd`,i),i}},dragGroupControlCondition:LS,dragGroupControlStart:function(e,t){var n=t.datas,r=this.dragControlStart(e,q(q({},t),{isGroup:!0}));if(!r)return!1;var i=mx(e,`resizable`,t),a=n.startOffsetWidth,o=n.startOffsetHeight;function s(){var e=n.minSize;i.forEach(function(t){var n=t.datas,r=n.minSize,i=n.startOffsetWidth,s=n.startOffsetHeight,c=a*(i?r[0]/i:0),l=o*(s?r[1]/s:0);e[0]=Math.max(e[0],c),e[1]=Math.max(e[1],l)})}function c(){var e=n.maxSize;i.forEach(function(t){var n=t.datas,r=n.maxSize,i=n.startOffsetWidth,s=n.startOffsetHeight,c=a*(i?r[0]/i:0),l=o*(s?r[1]/s:0);e[0]=Math.min(e[0],c),e[1]=Math.min(e[1],l)})}var l=gx(e,this,`dragControlStart`,t,function(t,r){return _x(e,t,n,r)});s(),c();var u=function(t){r.setFixedDirection(t),l.forEach(function(r,a){r.setFixedDirection(t),_x(e,r.moveable,n,i[a])})};return n.setFixedDirection=u,n.isResize=Z(e,`onResizeGroupStart`,q(q({},r),{targets:e.props.targets,events:l.map(function(e){return q(q({},e),{setMin:function(t){e.setMin(t),s()},setMax:function(t){e.setMax(t),c()}})}),setFixedDirection:u,setMin:function(e){r.setMin(e),s()},setMax:function(e){r.setMax(e),c()}}))!==!1,n.isResize?r:!1},dragGroupControl:function(e,t){var n=t.datas;if(n.isResize){var r=ew(e.props,`resizable`);vw(e,`onBeforeResize`,function(n){Z(e,`onBeforeResizeGroup`,gw(e,t,q(q({},n),{targets:r.targets}),!0))});var i=this.dragControl(e,q(q({},t),{isGroup:!0}));if(i){var a=i.boundingWidth,o=i.boundingHeight,s=i.dist,c=r.keepRatio,l=[a/(a-s[0]),o/(o-s[1])],u=n.fixedPosition,d=gx(e,this,`dragControl`,t,function(t,n){var r=J(uv(vv(e.rotation/180*Math.PI,3),[n.datas.originalX*l[0],n.datas.originalY*l[1],1],3),2),i=r[0],a=r[1];return q(q({},n),{parentDist:null,parentScale:l,dragClient:sv(u,[i,a]),parentKeepRatio:c})}),f=q({targets:r.targets,events:d},i);return Z(e,`onResizeGroup`,f),f}}},dragGroupControlEnd:function(e,t){var n=t.isDrag;if(t.datas.isResize){this.dragControlEnd(e,t);var r=gx(e,this,`dragControlEnd`,t);return Z(e,`onResizeGroupEnd`,_w(e,t,{targets:e.props.targets,events:r})),n}},request:function(e){var t={},n=0,r=0,i=!1,a=e.getRect();return{isControl:!0,requestStart:function(e){return i=e.useSnap,{datas:t,parentDirection:e.direction||[1,1],parentIsWidth:e?.horizontal??!0,useSnap:i}},request:function(e){return`offsetWidth`in e?n=e.offsetWidth-a.offsetWidth:`deltaWidth`in e&&(n+=e.deltaWidth),`offsetHeight`in e?r=e.offsetHeight-a.offsetHeight:`deltaHeight`in e&&(r+=e.deltaHeight),{datas:t,parentDist:[n,r],parentKeepRatio:e.keepRatio,useSnap:i}},requestEnd:function(){return{datas:t,isDrag:!0,useSnap:i}}}},unset:function(e){e.state.gestos.resizable=null}};function zS(e,t,n,r,i){var a=e.props.groupable,o=e.state,s=o.is3d?4:3,c=t.origin,l=WC(e.state.rootMatrix,K([c[0],c[1]],a?[0,0]:[o.left,o.top]),s),u=sv([i.left,i.top],l);t.startAbsoluteOrigin=u,t.prevDeg=A_(u,[n,r])/Math.PI*180,t.defaultDeg=t.prevDeg,t.prevSnapDeg=0,t.loop=0,t.startDist=N_(u,[n,r])}function BS(e,t,n){var r=n.defaultDeg,i=n.prevDeg,a=i%360,o=Math.floor(i/360);a<0&&(a+=360),a>e&&a>270&&e<90?++o:a<e&&a<90&&e>270&&--o;var s=t*(o*360+e-r);return n.prevDeg=r+s,s}function VS(e,t,n,r){return BS(A_(r.startAbsoluteOrigin,[e,t])/Math.PI*180,n,r)}function HS(e,t,n,r,i,a){var o=e.props.throttleRotate,s=o===void 0?0:o,c=n.prevSnapDeg,l=0,u=!1;if(a){var d=vC(e,t,r,i+r);u=d.isSnap,l=i+d.dist}u||(l=P_(i+r,s));var f=l-i;return n.prevSnapDeg=f,[f-c,f,l]}function US(e,t,n){var r=J(t,4),i=r[0],a=r[1],o=r[2],s=r[3];if(e===`none`)return[];if(i_(e))return e.map(function(e){return US(e,[i,a,o,s],n)[0]});var c=J((e||`top`).split(`-`),2),l=c[0],u=c[1],d=[i,a];l===`left`?d=[o,i]:l===`right`?d=[a,s]:l===`bottom`&&(d=[s,o]);var f=[(d[0][0]+d[1][0])/2,(d[0][1]+d[1][1])/2],p=nw(d,n);if(u){var m=u===`top`||u===`left`,h=l===`bottom`||l===`left`;f=d[m&&!h||!m&&h?0:1]}return[[f,p]]}function WS(e,t){if(t.isRequest)return t.requestAble===`rotatable`;var n=t.inputEvent.target;if(R_(n,X(`rotation-control`))||e.props.rotateAroundControls&&R_(n,X(`around-control`))||R_(n,X(`control`))&&R_(n,X(`rotatable`)))return!0;var r=e.props.rotationTarget;return r?Lw(r,!0).some(function(e){return e?n===e||n.contains(e):!1}):!1}var GS={name:`rotatable`,canPinch:!0,props:[`rotatable`,`rotationPosition`,`throttleRotate`,`renderDirections`,`rotationTarget`,`rotateAroundControls`,`edge`,`resolveAblesWithRotatable`,`displayAroundControls`],events:[`rotateStart`,`beforeRotate`,`rotate`,`rotateEnd`,`rotateGroupStart`,`beforeRotateGroup`,`rotateGroup`,`rotateGroupEnd`],css:[`.rotation {
258
- position: absolute;
259
- height: 40px;
260
- width: 1px;
261
- transform-origin: 50% 100%;
262
- height: calc(40px * var(--zoom));
263
- top: auto;
264
- left: 0;
265
- bottom: 100%;
266
- will-change: transform;
267
- }
268
- .rotation .rotation-line {
269
- display: block;
270
- width: 100%;
271
- height: 100%;
272
- transform-origin: 50% 50%;
273
- }
274
- .rotation .rotation-control {
275
- border-color: #4af;
276
- border-color: var(--moveable-color);
277
- background:#fff;
278
- cursor: alias;
279
- }
280
- :global .view-rotation-dragging, .rotatable.direction.control {
281
- cursor: alias;
282
- }
283
- .rotatable.direction.control.move {
284
- cursor: move;
285
- }
286
- `],viewClassName:function(e){return e.isDragging(`rotatable`)?X(`view-rotation-dragging`):``},render:function(e,t){var n=ew(e.props,`rotatable`),r=n.rotatable,i=n.rotationPosition,a=n.zoom,o=n.renderDirections,s=n.rotateAroundControls,c=n.resolveAblesWithRotatable,l=e.getState(),u=l.renderPoses,d=l.direction;if(!r)return null;var f=US(i,u,d),p=[];if(f.forEach(function(e,n){var r=J(e,2),i=r[0],o=r[1];p.push(t.createElement(`div`,{key:`rotation${n}`,className:X(`rotation`),style:{transform:`translate(-50%) translate(${i[0]}px, ${i[1]}px) rotate(${o}rad)`}},t.createElement(`div`,{className:X(`line rotation-line`),style:{transform:`scaleX(${a})`}}),t.createElement(`div`,{className:X(`control rotation-control`),style:{transform:`translate(0.5px) scale(${a})`}})))}),o){var m=C_(c||{}),h={};m.forEach(function(e){c[e].forEach(function(t){h[t]=e})});var g=[];i_(o)&&(g=o.map(function(e){var t=h[e];return{data:t?{resolve:t}:{},classNames:t?[`move`]:[],dir:e}})),p.push.apply(p,Y([],J(vx(e,`rotatable`,g,t)),!1))}return s&&p.push.apply(p,Y([],J(Tx(e,t)),!1)),p},dragControlCondition:WS,dragControlStart:function(e,t){var n,r=t.datas,i=t.clientX,a=t.clientY,o=t.parentRotate,s=t.parentFlag,c=t.isPinch,l=t.isRequest,u=e.state,d=u.target,f=u.left,p=u.top,m=u.direction,h=u.beforeDirection,g=u.targetTransform,_=u.moveableClientRect,v=u.offsetMatrix,y=u.targetMatrix,b=u.allMatrix,x=u.width,S=u.height;if(!l&&!d)return!1;var C=e.getRect();r.rect=C,r.transform=g,r.left=f,r.top=p;var w=function(t){var n=IS(e.state,t);r.fixedDirection=n.fixedDirection,r.fixedOffset=n.fixedOffset,r.fixedPosition=n.fixedPosition,ee&&ee.setFixedPosition(t)},T=function(t){var n=FS(e.state,t);r.fixedDirection=n.fixedDirection,r.fixedOffset=n.fixedOffset,r.fixedPosition=n.fixedPosition,ee&&ee.setFixedDirection(t)},E=i,D=a;if(l||c||s){var O=o||0;r.beforeInfo={origin:C.beforeOrigin,prevDeg:O,defaultDeg:O,prevSnapDeg:0,startDist:0},r.afterInfo=q(q({},r.beforeInfo),{origin:C.origin}),r.absoluteInfo=q(q({},r.beforeInfo),{origin:C.origin,startValue:O})}else{var k=t.inputEvent?.target;if(k){var A=mb[k.getAttribute(`data-direction`)||``];if(A){r.isControl=!0,r.isAroundControl=R_(k,X(`around-control`)),r.controlDirection=A;var j=k.getAttribute(`data-resolve`);j&&(r.resolveAble=j),n=J(Fb(YC(u.rootMatrix,u.renderPoses,_),A),2),E=n[0],D=n[1]}}r.beforeInfo={origin:C.beforeOrigin},r.afterInfo={origin:C.origin},r.absoluteInfo={origin:C.origin,startValue:C.rotation};var M=w;w=function(t){var n=u.is3d?4:3,i=J(sv(tv(y,n),t),2),a=i[0],o=i[1],s=uv(v,rv([a,o],n)),c=uv(b,rv([t[0],t[1]],n));M(t);var l=u.posDelta;r.beforeInfo.origin=K(s,l),r.afterInfo.origin=K(c,l),r.absoluteInfo.origin=K(c,l),zS(e,r.beforeInfo,E,D,_),zS(e,r.afterInfo,E,D,_),zS(e,r.absoluteInfo,E,D,_)},T=function(e){var t=Fb([[0,0],[x,0],[0,S],[x,S]],e);w(t)}}r.startClientX=E,r.startClientY=D,r.direction=m,r.beforeDirection=h,r.startValue=0,r.datas={},Vb(e,t,`rotate`);var N=!1,ee=!1;r.isControl&&r.resolveAble&&r.resolveAble===`resizable`&&(ee=RS.dragControlStart(e,q(q({},new yb(`resizable`).dragStart([0,0],t)),{parentPosition:r.controlPosition,parentFixedPosition:r.fixedPosition}))),ee||(N=NS.dragStart(e,new yb().dragStart([0,0],t))),w(sw(e));var P=gw(e,t,q(q({set:function(e){r.startValue=e*Math.PI/180},setFixedDirection:T,setFixedPosition:w},Bb(e,t)),{dragStart:N,resizeStart:ee}));return r.isRotate=Z(e,`onRotateStart`,P)!==!1,u.snapRenderInfo={request:t.isRequest},r.isRotate?P:!1},dragControl:function(e,t){var n,r,i,a=t.datas,o=t.clientDistX,s=t.clientDistY,c=t.parentRotate,l=t.parentFlag,u=t.isPinch,d=t.groupDelta,f=t.resolveMatrix,p=a.beforeDirection,m=a.beforeInfo,h=a.afterInfo,g=a.absoluteInfo,_=a.isRotate,v=a.startValue,y=a.rect,b=a.startClientX,x=a.startClientY;if(_){wb(e,t,`rotate`);var S=p*Cb(t),C=e.props.parentMoveable,w=0,T,E,D=0,O,k,A=0,j,M,N=180/Math.PI*v,ee=g.startValue,P=!1,F=b+o,te=x+s;if(!l&&`parentDist`in t){var I=t.parentDist;T=I,O=I,j=I}else u||l?(T=BS(c,p,m),O=BS(c,S,h),j=BS(c,S,g)):(T=VS(F,te,p,m),O=VS(F,te,S,h),j=VS(F,te,S,g),P=!0);if(E=N+T,k=N+O,M=ee+j,Z(e,`onBeforeRotate`,gw(e,t,{beforeRotation:E,rotation:k,absoluteRotation:M,setRotation:function(e){O=e-N,T=O,j=O}},!0)),n=J(HS(e,y,m,T,N,P),3),w=n[0],T=n[1],E=n[2],r=J(HS(e,y,h,O,N,P),3),D=r[0],O=r[1],k=r[2],i=J(HS(e,y,g,j,ee,P),3),A=i[0],j=i[1],M=i[2],!(!A&&!D&&!w&&!C&&!f)){var ne=Tb(a,`rotate(${k}deg)`,`rotate(${O}deg)`);f&&(a.fixedPosition=Yb(e,a.targetAllTransform,a.fixedDirection,a.fixedOffset,a));var re=ex(e,O,a),ie=K(sv(d||[0,0],re),a.prevInverseDist||[0,0]);a.prevInverseDist=re,a.requestValue=null;var ae=Jb(e,ne,ie,u,t),oe=ae,se=N_([F,te],g.startAbsoluteOrigin)-g.startDist,ce=void 0;if(a.resolveAble===`resizable`){var L=RS.dragControl(e,q(q({},vb(t,e.state,[t.deltaX,t.deltaY],!!u,!1,`resizable`)),{resolveMatrix:!0,parentDistance:se}));L&&(ce=L,oe=hw(oe,L,t))}var le=gw(e,t,q(q({delta:D,dist:O,rotate:k,rotation:k,beforeDist:T,beforeDelta:w,beforeRotate:E,beforeRotation:E,absoluteDist:j,absoluteDelta:A,absoluteRotate:M,absoluteRotation:M,isPinch:!!u,resize:ce},ae),oe));return Z(e,`onRotate`,le),le}}},dragControlEnd:function(e,t){var n=t.datas;if(n.isRotate){n.isRotate=!1;var r=_w(e,t,{});return Z(e,`onRotateEnd`,r),r}},dragGroupControlCondition:WS,dragGroupControlStart:function(e,t){var n=t.datas,r=e.state,i=r.left,a=r.top,o=r.beforeOrigin,s=this.dragControlStart(e,t);if(!s)return!1;s.set(n.beforeDirection*e.rotation);var c=gx(e,this,`dragControlStart`,t,function(e,t){var n=e.state,r=n.left,s=n.top,c=n.beforeOrigin,l=sv(K([r,s],[i,a]),K(c,o));return t.datas.startGroupClient=l,t.datas.groupClient=l,q(q({},t),{parentRotate:0})});return n.isRotate=Z(e,`onRotateGroupStart`,q(q({},s),{targets:e.props.targets,events:c}))!==!1,n.isRotate?s:!1},dragGroupControl:function(e,t){var n=t.datas;if(n.isRotate){vw(e,`onBeforeRotate`,function(n){Z(e,`onBeforeRotateGroup`,gw(e,t,q(q({},n),{targets:e.props.targets}),!0))});var r=this.dragControl(e,t);if(r){var i=n.beforeDirection,a=r.beforeDist,o=a/180*Math.PI,s=gx(e,this,`dragControl`,t,function(e,t){var n=t.datas.startGroupClient,r=J(t.datas.groupClient,2),s=r[0],c=r[1],l=J(hv(n,o*i),2),u=l[0],d=l[1],f=[u-s,d-c];return t.datas.groupClient=[u,d],q(q({},t),{parentRotate:a,groupDelta:f})});e.rotation=i*r.beforeRotation;var c=q({targets:e.props.targets,events:s,set:function(t){e.rotation=t},setGroupRotation:function(t){e.rotation=t}},r);return Z(e,`onRotateGroup`,c),c}}},dragGroupControlEnd:function(e,t){var n=t.isDrag;if(t.datas.isRotate){this.dragControlEnd(e,t);var r=gx(e,this,`dragControlEnd`,t);return Z(e,`onRotateGroupEnd`,_w(e,t,{targets:e.props.targets,events:r})),n}},request:function(e){var t={},n=0,r=e.getRotation();return{isControl:!0,requestStart:function(){return{datas:t}},request:function(e){return`deltaRotate`in e?n+=e.deltaRotate:`rotate`in e&&(n=e.rotate-r),{datas:t,parentDist:n}},requestEnd:function(){return{datas:t,isDrag:!0}}}}};function KS(e,t){var n,r=e.direction,i=e.classNames,a=e.size,o=e.pos,s=e.zoom,c=e.key,l=r===`horizontal`,u=l?`Y`:`X`;return t.createElement(`div`,{key:c,className:i.join(` `),style:(n={},n[l?`width`:`height`]=`${a}`,n.transform=`translate(${o[0]}, ${o[1]}) translate${u}(-50%) scale${u}(${s})`,n)})}function qS(e,t){return KS(q(q({},e),{classNames:Y([X(`line`,`guideline`,e.direction)],J(e.classNames),!1).filter(function(e){return e}),size:e.size||`${e.sizeValue}px`,pos:e.pos||e.posValue.map(function(e){return`${P_(e,.1)}px`})}),t)}function JS(e,t,n,r,i,a,o,s){var c=e.props.zoom;return n.map(function(e,n){var l=e.type,u=e.pos,d=[0,0];return d[o]=r,d[+!o]=-i+u,qS({key:`${t}TargetGuideline${n}`,classNames:[X(`target`,`bold`,l)],posValue:d,sizeValue:a,zoom:c,direction:t},s)})}function YS(e,t,n,r,i,a){var o=e.props,s=o.zoom,c=o.isDisplayInnerSnapDigit,l=t===`horizontal`?Ix:Lx,u=i[l.start],d=i[l.end];return n.filter(function(e){var t=e.hide,n=e.elementRect;if(t)return!1;if(c&&n){var r=n.rect;if(r[l.start]<=u&&d<=r[l.end])return!1}return!0}).map(function(e,n){var i=e.pos,o=e.size,c=e.element,l=e.className,u=[-r[0]+i[0],-r[1]+i[1]];return qS({key:`${t}-default-guideline-${n}`,classNames:c?[X(`bold`),l]:[X(`normal`),l],direction:t,posValue:u,sizeValue:o,zoom:s},a)})}function XS(e,t,n,r,i,a,o,s){var c,l=e.props,u=l.snapDigit,d=u===void 0?0:u,f=l.isDisplaySnapDigit,p=f===void 0?!0:f,m=l.snapDistFormat,h=m===void 0?function(e,t){return e}:m,g=l.zoom,_=t===`horizontal`?`X`:`Y`,v=t===`vertical`?`height`:`width`,y=Math.abs(i),b=p?parseFloat(y.toFixed(d)):0;return s.createElement(`div`,{key:`${t}-${n}-guideline-${r}`,className:X(`guideline-group`,t),style:(c={left:`${a[0]}px`,top:`${a[1]}px`},c[v]=`${y}px`,c)},qS({direction:t,classNames:[X(n),o],size:`100%`,posValue:[0,0],sizeValue:y,zoom:g},s),s.createElement(`div`,{className:X(`size-value`,`gap`),style:{transform:`translate${_}(-50%) scale(${g})`}},b>0?h(b,t):``))}function ZS(e,t,n,r){var i=e===`vertical`?0:1,a=+(e===`vertical`),o=i?Ix:Lx,s=n[o.start],c=n[o.end];return Cw(t,function(e){return e.pos[i]}).map(function(t){var n=[],l=[];return t.forEach(function(t){var u,d,f=t.element,p=t.elementRect.rect;if(p[o.end]<s)n.push(t);else if(c<p[o.start])l.push(t);else if(p[o.start]<=s&&c<=p[o.end]&&r){var m=t.pos,h={element:f,rect:q(q({},p),(u={},u[o.end]=p[o.start],u))},g={element:f,rect:q(q({},p),(d={},d[o.start]=p[o.end],d))},_=[0,0],v=[0,0];_[i]=m[i],_[a]=m[a],v[i]=m[i],v[a]=m[a]+t.size,n.push({type:e,pos:_,size:0,elementRect:h,direction:``,elementDirection:`end`}),l.push({type:e,pos:v,size:0,elementRect:g,direction:``,elementDirection:`start`})}}),n.sort(function(e,t){return t.pos[a]-e.pos[a]}),l.sort(function(e,t){return e.pos[a]-t.pos[a]}),{total:t,start:n,end:l,inner:[]}})}function QS(e,t,n,r,i){var a=e.props.isDisplayInnerSnapDigit,o=[];return[`vertical`,`horizontal`].forEach(function(s){var c=t.filter(function(e){return e.type===s}),l=+(s===`vertical`),u=+!l,d=ZS(s,c,r,a),f=l?Lx:Ix,p=l?Ix:Lx,m=r[f.start],h=r[f.end];d.forEach(function(t){var a=t.total,c=t.start,d=t.end,g=t.inner,_=n[u]+a[0].pos[u]-r[p.start],v=r;c.forEach(function(t){var r=t.elementRect.rect,a=v[f.start]-r[f.end];if(a>0){var c=[0,0];c[l]=n[l]+v[f.start]-m-a,c[u]=_,o.push(XS(e,s,`dashed`,o.length,a,c,t.className,i))}v=r}),v=r,d.forEach(function(t){var r=t.elementRect.rect,a=r[f.start]-v[f.end];if(a>0){var c=[0,0];c[l]=n[l]+v[f.end]-m,c[u]=_,o.push(XS(e,s,`dashed`,o.length,a,c,t.className,i))}v=r}),g.forEach(function(t){var r=t.elementRect.rect,a=m-r[f.start],c=r[f.end]-h,d=[0,0],p=[0,0];d[l]=n[l]-a,d[u]=_,p[l]=n[l]+h-m,p[u]=_,o.push(XS(e,s,`dashed`,o.length,a,d,t.className,i)),o.push(XS(e,s,`dashed`,o.length,c,p,t.className,i))})})}),o}function $S(e,t,n,r,i){var a=[];return[`horizontal`,`vertical`].forEach(function(o){var s=t.filter(function(e){return e.type===o}).slice(0,1),c=o===`vertical`?0:1,l=+!c,u=c?Lx:Ix,d=c?Ix:Lx,f=r[u.start],p=r[u.end],m=r[d.start],h=r[d.end];s.forEach(function(t){var r=t.gap,o=t.gapRects,s=Math.max.apply(Math,Y([m],J(o.map(function(e){return e.rect[d.start]})),!1)),g=Math.min.apply(Math,Y([h],J(o.map(function(e){return e.rect[d.end]})),!1)),_=(s+g)/2;s===g||_===(m+h)/2||o.forEach(function(t){var o=t.rect,s=t.className,d=[n[0],n[1]];if(o[u.end]<f)d[c]+=o[u.end]-f;else if(p<o[u.start])d[c]+=o[u.start]-f-r;else return;d[l]+=_-m,a.push(XS(e,c?`vertical`:`horizontal`,`gap`,a.length,r,d,s,i))})})}),a}function eC(e){var t=e.state,n=t.containerClientRect,r=t.hasFixed,i=n.overflow,a=n.scrollHeight,o=n.scrollWidth,s=n.clientHeight,c=n.clientWidth,l=n.clientLeft,u=n.clientTop,d=e.props,f=d.snapGap,p=f===void 0?!0:f,m=d.verticalGuidelines,h=d.horizontalGuidelines,g=d.snapThreshold,_=g===void 0?5:g,v=d.maxSnapElementGuidelineDistance,y=v===void 0?1/0:v,b=d.isDisplayGridGuidelines,x=KC(dw(e.state)),S=x.top,C=x.left,w=x.bottom,T=x.right,E={top:S,left:C,bottom:w,right:T,center:(C+T)/2,middle:(S+w)/2},D=Y([],J(aC(e)),!1),O=(t.snapThresholdInfo?.multiples??[1,1]).map(function(e){return e*_});p&&D.push.apply(D,Y([],J(tC(e,E,O)),!1));var k=q({},t.snapOffset||{left:0,top:0,bottom:0,right:0});if(D.push.apply(D,Y([],J(rC(e,i?o:c,i?a:s,l,u,k,b)),!1)),r){var A=n.left,j=n.top;k.left+=A,k.top+=j,k.right+=A,k.bottom+=j}return D.push.apply(D,Y([],J(sC(h||!1,m||!1,i?o:c,i?a:s,l,u,k)),!1)),D=D.filter(function(e){var t=e.element,n=e.elementRect,r=e.type;if(!t||!n)return!0;var i=n.rect;return iC(E,i,r,y)}),D}function tC(e,t,n){var r=e.props,i=r.maxSnapElementGuidelineDistance,a=i===void 0?1/0:i,o=r.maxSnapElementGapDistance,s=o===void 0?1/0:o,c=e.state.elementRects,l=[];return[[`vertical`,Ix,Lx],[`horizontal`,Lx,Ix]].forEach(function(e){var r=J(e,3),i=r[0],o=r[1],u=r[2],d=t[o.start],f=t[o.end],p=t[o.center],m=t[u.start],h=t[u.end],g={left:n[0],top:n[1]};function _(e){var t=e.rect,n=g[o.start];return t[o.end]<d+n?d-t[o.end]:f-n<t[o.start]?t[o.start]-f:-1}var v=c.filter(function(e){var t=e.rect;return t[u.start]>h||t[u.end]<m?!1:_(e)>0}).sort(function(e,t){return _(e)-_(t)}),y=[];v.forEach(function(e){v.forEach(function(t){if(e!==t){var n=e.rect,r=t.rect,i=n[u.start],a=n[u.end],o=r[u.start];i>r[u.end]||o>a||y.push([e,t])}})}),y.forEach(function(e){var n=J(e,2),r=n[0],c=n[1],u=r.rect,m=c.rect,h=u[o.start],_=u[o.end],v=m[o.start],y=m[o.end],b=g[o.start],x=0,S=0,C=!1,w=!1,T=!1;if(_<=d&&f<=v){if(w=!0,x=(v-_-(f-d))/2,S=_+x+(f-d)/2,Q(S-p)>b)return}else if(_<v&&y<d+b){if(C=!0,x=v-_,S=y+x,Q(S-d)>b)return}else if(_<v&&f-b<h){if(T=!0,x=v-_,S=h-x,Q(S-f)>b)return}else return;x&&iC(t,m,i,a)&&(x>s||l.push({type:i,pos:i===`vertical`?[S,0]:[0,S],element:c.element,size:0,className:c.className,isStart:C,isCenter:w,isEnd:T,gap:x,hide:!0,gapRects:[r,c],direction:``,elementDirection:``}))})}),l}function nC(e,t,n,r){var i=e.props,a=e.state,o=i.snapGridAll,s=i.snapGridWidth,c=s===void 0?0:s,l=i.snapGridHeight,u=l===void 0?0:l,d=a.snapRenderInfo,f=d&&(d.direction?.[0]||d.direction?.[1]),p=e.moveables;if(o&&p&&f&&(c||u)){if(a.snapThresholdInfo)return;a.snapThresholdInfo={multiples:[1,1],offset:[0,0]};var m=e.getRect(),h=m.children,g=d.direction;if(h){var _=g.map(function(e,i){var a=i===0?{snapSize:c,posName:`left`,sizeName:`width`,clientOffset:r.left-t}:{snapSize:u,posName:`top`,sizeName:`height`,clientOffset:r.top-n},o=a.snapSize,s=a.posName,l=a.sizeName,d=a.clientOffset;if(!o)return{dir:e,multiple:1,snapSize:o,snapOffset:0};var f=m[l],p=m[s],g=L_(h.map(function(e){return[e[s]-p,e[l],f-e[l]-e[s]+p]})).filter(function(e){return e}).sort(function(e,t){return e-t}),_=g[0],v=g.map(function(e){return P_(e/_,.1)*o}),y=1,b=P_(f/_,.1);for(y=1;y<=10&&!v.every(function(e){return e*y%1==0});++y);var x=(-e+1)/2,S=t_(p-d,p-d+f,x,1-x);return{multiple:b*y,dir:e,snapSize:o,snapOffset:Math.round(S/o)}}),v=_.map(function(e){return e.multiple||1});a.snapThresholdInfo.multiples=v,a.snapThresholdInfo.offset=_.map(function(e){return e.snapOffset}),_.forEach(function(e,t){e.snapSize})}}else a.snapThresholdInfo=null}function rC(e,t,n,r,i,a,o){r===void 0&&(r=0),i===void 0&&(i=0);var s=e.props,c=e.state,l=s.snapGridWidth,u=l===void 0?0:l,d=s.snapGridHeight,f=d===void 0?0:d,p=[],m=a.left,h=a.top,g=[0,0];nC(e,r,i,a);var _=c.snapThresholdInfo,v=u,y=f;if(_&&(u*=_.multiples[0]||1,f*=_.multiples[1]||1,g=_.offset),f){for(var b=function(e){p.push({type:`horizontal`,pos:[m,P_(g[1]*y+e-i+h,.1)],className:X(`grid-guideline`),size:t,hide:!o,direction:``,grid:!0})},x=0;x<=n*2;x+=f)b(x);for(var x=-f;x>=-n;x-=f)b(x)}if(u){for(var b=function(e){p.push({type:`vertical`,pos:[P_(g[0]*v+e-r+m,.1),h],className:X(`grid-guideline`),size:n,hide:!o,direction:``,grid:!0})},x=0;x<=t*2;x+=u)b(x);for(var x=-u;x>=-t;x-=u)b(x)}return p}function iC(e,t,n,r){return n===`horizontal`?Q(e.right-t.left)<=r||Q(e.left-t.right)<=r||e.left<=t.right&&t.left<=e.right:n===`vertical`?Q(e.bottom-t.top)<=r||Q(e.top-t.bottom)<=r||e.top<=t.bottom&&t.top<=e.bottom:!0}function aC(e){var t=e.state,n=e.props.elementGuidelines,r=n===void 0?[]:n;if(!r.length)return t.elementRects=[],[];var i=(t.elementRects||[]).filter(function(e){return!e.refresh}),a=r.map(function(e){return r_(e)&&`element`in e?q(q({},e),{element:Iw(e.element,!0)}):{element:Iw(e,!0)}}).filter(function(e){return e.element}),o=Vv(i.map(function(e){return e.element}),a.map(function(e){return e.element})),s=o.maintained,c=o.added,l=[];s.forEach(function(e){var t=J(e,2),n=t[0],r=t[1];l[r]=i[n]}),cC(e,c.map(function(e){return a[e]})).map(function(e,t){l[c[t]]=e}),t.elementRects=l;var u=Bx(e.props.elementSnapDirections),d=[];return l.forEach(function(e){var t=e.element,n=e.top,r=n===void 0?u.top:n,i=e.left,a=i===void 0?u.left:i,o=e.right,s=o===void 0?u.right:o,c=e.bottom,l=c===void 0?u.bottom:c,f=e.center,p=f===void 0?u.center:f,m=e.middle,h=m===void 0?u.middle:m,g=e.className,_=e.rect,v=Hx({top:r,right:s,left:a,bottom:l,center:p,middle:h},_),y=v.horizontal,b=v.vertical,x=v.horizontalNames,S=v.verticalNames,C=_.top,w=_.left,T=_.right-w,E=_.bottom-C,D=[T,E];b.forEach(function(n,r){d.push({type:`vertical`,element:t,pos:[P_(n,.1),C],size:E,sizes:D,className:g,elementRect:e,elementDirection:Fx[S[r]]||S[r],direction:``})}),y.forEach(function(n,r){d.push({type:`horizontal`,element:t,pos:[w,P_(n,.1)],size:T,sizes:D,className:g,elementRect:e,elementDirection:Fx[x[r]]||x[r],direction:``})})}),d}function oC(e,t){return e?e.map(function(e){var n=r_(e)?e:{pos:e},r=n.pos;return o_(r)?n:q(q({},n),{pos:w_(r,t)})}):[]}function sC(e,t,n,r,i,a,o){i===void 0&&(i=0),a===void 0&&(a=0),o===void 0&&(o={left:0,top:0,right:0,bottom:0});var s=[],c=o.left,l=o.top,u=o.bottom,d=n+o.right-c,f=r+u-l;return oC(e,f).forEach(function(e){s.push({type:`horizontal`,pos:[c,P_(e.pos-a+l,.1)],size:d,className:e.className,direction:``})}),oC(t,d).forEach(function(e){s.push({type:`vertical`,pos:[P_(e.pos-i+c,.1),l],size:f,className:e.className,direction:``})}),s}function cC(e,t){if(!t.length)return[];var n=e.props.groupable,r=e.state,i=r.containerClientRect,a=r.rootMatrix,o=r.is3d,s=r.offsetDelta,c=o?4:3,l=J(Ux(a,i,c),2),u=l[0],d=l[1],f=n?0:s[0],p=n?0:s[1];return t.map(function(e){var t=e.element.getBoundingClientRect(),n=t.left-u-f,r=t.top-d-p,i=r+t.height,o=n+t.width,s=J(Dw(a,[n,r],c),2),l=s[0],m=s[1],h=J(Dw(a,[o,i],c),2),g=h[0],_=h[1];return q(q({},e),{rect:{left:l,right:g,top:m,bottom:_,center:(l+g)/2,middle:(m+_)/2}})})}function lC(e){var t=e.state,n=t.container,r=e.props.snapContainer||n;if(t.snapContainer===r&&t.guidelines&&t.guidelines.length)return!1;var i=t.containerClientRect,a={left:0,top:0,bottom:0,right:0};if(n!==r){var o=Iw(r,!0);if(o){var s=ow(o),c=zw(t,[s.left-i.left,s.top-i.top]),l=zw(t,[s.right-i.right,s.bottom-i.bottom]);a.left=P_(c[0],1e-5),a.top=P_(c[1],1e-5),a.right=P_(l[0],1e-5),a.bottom=P_(l[1],1e-5)}}return t.snapContainer=r,t.snapOffset=a,t.guidelines=eC(e),t.enableSnap=!0,!0}function uC(e,t,n,r,i,a){var o=GC(e,t,n,a?4:3);return uw(o,K(i,Fb(o,r)))}function dC(e){return e?e/Q(e):0}function fC(e,t,n,r,i,a){var o=a.fixedDirection,s=aS(n,o,r),c=hS(e,t,n,r),l=Y(Y([],J(kS(e,t,s,r,i,a)),!1),J(fS(e,c,a)),!1),u=iS(l,0),d=iS(l,1);return{width:{isBound:u.isBound,offset:u.offset[0]},height:{isBound:d.isBound,offset:d.offset[1]}}}function pC(e,t,n,r,i,a,o,s,c){var l=Fb(t,o),u=ES(e,s,{vertical:[l[0]],horizontal:[l[1]]}),d=u.horizontal.offset,f=u.vertical.offset;if(P_(f,lb)||P_(d,lb)){var p=J(kb({datas:c,distX:-f,distY:-d}),2),m=p[0],h=p[1],g=Math.min(i||1/0,n+o[0]*m),_=Math.min(a||1/0,r+o[1]*h);return[g-n,_-r]}return[0,0]}function mC(e,t,n,r,i,a,o,s){for(var c=dw(e.state),l=e.props.keepRatio,u=0,d=0,f=0;f<2;++f){var p=fC(e,t(u,d),i,l,o,s),m=p.width,h=p.height,g=m.isBound,_=h.isBound,v=m.offset,y=h.offset;if(f===1&&(g||(v=0),_||(y=0)),f===0&&o&&!g&&!_)return[0,0];if(l){var b=Q(v)*(n?1/n:1),x=Q(y)*(r?1/r:1);(g&&_?b<x:_||!g&&b<x)?v=n*y/r:y=r*v/n}u+=v,d+=y}if(!l&&i[0]&&i[1]){var S=MS(e,c,i,a,s),C=S.maxWidth,w=S.maxHeight,T=J(pC(e,t(u,d).map(function(e){return e.map(function(e){return P_(e,lb)})}),n+u,r+d,C,w,i,o,s),2),v=T[0],y=T[1];u+=v,d+=y}return[u,d]}function hC(e){return e<0&&(e=e%360+360),e%=360,e}function gC(e,t){t=hC(t);var n=Math.floor(e/360),r=n*360+360-t,i=n*360+t;return Q(e-r)<Q(e-i)?r:i}function _C(e,t){e=hC(e),t=hC(t);var n=hC(e-t);return Math.min(n,360-n)}function vC(e,t,n,r){var i=e.props,a=i[Gx]??5,o=i[Kx];if(zx(e,`rotatable`)){var s=t.pos1,c=t.pos2,l=t.pos3,u=t.pos4,d=t.origin,f=n*Math.PI/180,p=[s,c,l,u].map(function(e){return K(e,d)}),m=p.map(function(e){return hv(e,f)}),h=Y(Y([],J(Mx(e,p,m,d,n)),!1),J(yS(e,p,m,d,n)),!1);h.sort(function(e,t){return Q(e-n)-Q(t-n)});var g=h.length>0;if(g)return{isSnap:g,dist:g?h[0]:n}}if(o?.length&&a){var _=o.slice().sort(function(e,t){return _C(e,r)-_C(t,r)})[0];if(_C(_,r)<=a)return{isSnap:!0,dist:n+gC(r,_)-r}}return{isSnap:!1,dist:n}}function yC(e,t,n,r,i,a,o){if(!zx(e,`resizable`))return[0,0];var s=o.fixedDirection,c=o.nextAllMatrix,l=e.state,u=l.allMatrix,d=l.is3d;return mC(e,function(e,r){return uC(c||u,t+e,n+r,s,i,d)},t,n,r,i,a,o)}function bC(e,t,n,r,i){if(!zx(e,`scalable`))return[0,0];var a=i.startOffsetWidth,o=i.startOffsetHeight,s=i.fixedPosition,c=i.fixedDirection,l=i.is3d,u=mC(e,function(e,n){return uC(zb(i,sv(t,[e/a,n/o])),a,o,c,s,l)},a,o,n,s,r,i);return[u[0]/a,u[1]/o]}function xC(e,t){t.absolutePoses=dw(e.state)}function SC(e){var t=[];return e.forEach(function(e){e.guidelineInfos.forEach(function(n){var r=n.guideline;b_(t,function(e){return e.guideline===r})||(r.direction=``,t.push({guideline:r,posInfo:e}))})}),t.map(function(e){var t=e.guideline,n=e.posInfo;return q(q({},t),{direction:n.direction})})}function CC(e,t,n,r,i,a){var o=Ex(Dx(e,a),t,n),s=o.vertical,c=o.horizontal,l=Rx();s.forEach(function(e){e.isBound&&(e.direction===`start`&&(l.left=!0),e.direction===`end`&&(l.right=!0),r.push({type:`bounds`,pos:e.pos}))}),c.forEach(function(e){e.isBound&&(e.direction===`start`&&(l.top=!0),e.direction===`end`&&(l.bottom=!0),i.push({type:`bounds`,pos:e.pos}))});var u=bS(e),d=u.boundMap,f=u.vertical,p=u.horizontal;return f.forEach(function(e){y_(r,function(t){var n=t.type,r=t.pos;return n===`bounds`&&r===e})>=0||r.push({type:`bounds`,pos:e})}),p.forEach(function(e){y_(i,function(t){var n=t.type,r=t.pos;return n===`bounds`&&r===e})>=0||i.push({type:`bounds`,pos:e})}),{boundMap:l,innerBoundMap:d}}var wC=Nw(``,[`resizable`,`scalable`]),TC={name:`snappable`,dragRelation:`strong`,props:[`snappable`,`snapContainer`,`snapDirections`,`elementSnapDirections`,`snapGap`,`snapGridWidth`,`snapGridHeight`,`isDisplaySnapDigit`,`isDisplayInnerSnapDigit`,`isDisplayGridGuidelines`,`snapDigit`,`snapThreshold`,`snapRenderThreshold`,`snapGridAll`,Gx,Kx,qx,Jx,`horizontalGuidelines`,`verticalGuidelines`,`elementGuidelines`,`bounds`,`innerBounds`,`snapDistFormat`,`maxSnapElementGuidelineDistance`,`maxSnapElementGapDistance`],events:[`snap`,`bound`],css:[`:host {
287
- --bounds-color: #d66;
288
- }
289
- .guideline {
290
- pointer-events: none;
291
- z-index: 2;
292
- }
293
- .guideline.bounds {
294
- background: #d66;
295
- background: var(--bounds-color);
296
- }
297
- .guideline-group {
298
- position: absolute;
299
- top: 0;
300
- left: 0;
301
- }
302
- .guideline-group .size-value {
303
- position: absolute;
304
- color: #f55;
305
- font-size: 12px;
306
- font-size: calc(12px * var(--zoom));
307
- font-weight: bold;
308
- }
309
- .guideline-group.horizontal .size-value {
310
- transform-origin: 50% 100%;
311
- transform: translateX(-50%);
312
- left: 50%;
313
- bottom: 5px;
314
- bottom: calc(2px + 3px * var(--zoom));
315
- }
316
- .guideline-group.vertical .size-value {
317
- transform-origin: 0% 50%;
318
- top: 50%;
319
- transform: translateY(-50%);
320
- left: 5px;
321
- left: calc(2px + 3px * var(--zoom));
322
- }
323
- .guideline.gap {
324
- background: #f55;
325
- }
326
- .size-value.gap {
327
- color: #f55;
328
- }
329
- `],render:function(e,t){var n=e.state,r=n.top,i=n.left,a=n.pos1,o=n.pos2,s=n.pos3,c=n.pos4,l=n.snapRenderInfo,u=e.props.snapRenderThreshold,d=u===void 0?1:u;if(!l||!l.render||!zx(e,``))return Kw(e,`boundMap`,Rx(),function(e){return JSON.stringify(e)}),Kw(e,`innerBoundMap`,Rx(),function(e){return JSON.stringify(e)}),[];n.guidelines=eC(e);var f=Math.min(a[0],o[0],s[0],c[0]),p=Math.min(a[1],o[1],s[1],c[1]),m=l.externalPoses||[],h=dw(e.state),g=[],_=[],v=[],y=[],b=[],x=KC(h),S=x.width,C=x.height,w=x.top,T=x.left,E=x.bottom,D=x.right,O={left:T,right:D,top:w,bottom:E,center:(T+D)/2,middle:(w+E)/2},k=m.length>0,A=k?KC(m):{};if(!l.request){if(l.direction&&b.push(nS(e,h,l.direction,d,d)),l.snap){var j=KC(h);l.center&&(j.middle=(j.top+j.bottom)/2,j.center=(j.left+j.right)/2),b.push($x(e,j,d,d))}k&&(l.center&&(A.middle=(A.top+A.bottom)/2,A.center=(A.left+A.right)/2),b.push($x(e,A,d,d))),b.forEach(function(e){var t=e.vertical.posInfos,n=e.horizontal.posInfos;g.push.apply(g,Y([],J(t.filter(function(e){return e.guidelineInfos.some(function(e){return!e.guideline.hide})}).map(function(e){return{type:`snap`,pos:e.pos}})),!1)),_.push.apply(_,Y([],J(n.filter(function(e){return e.guidelineInfos.some(function(e){return!e.guideline.hide})}).map(function(e){return{type:`snap`,pos:e.pos}})),!1)),v.push.apply(v,Y([],J(SC(t)),!1)),y.push.apply(y,Y([],J(SC(n)),!1))})}var M=CC(e,[T,D],[w,E],g,_),N=M.boundMap,ee=M.innerBoundMap;k&&CC(e,[A.left,A.right],[A.top,A.bottom],g,_,l.externalBounds);var P=Y(Y([],J(v),!1),J(y),!1),F=P.filter(function(e){return e.element&&!e.gapRects}),te=P.filter(function(e){return e.gapRects}).sort(function(e,t){return e.gap-t.gap});Z(e,`onSnap`,{guidelines:P.filter(function(e){return!e.element}),elements:F,gaps:te},!0);var I=Kw(e,`boundMap`,N,function(e){return JSON.stringify(e)},Rx()),ne=Kw(e,`innerBoundMap`,ee,function(e){return JSON.stringify(e)},Rx());return(N===I||ee===ne)&&Z(e,`onBound`,{bounds:N,innerBounds:ee},!0),Y(Y(Y(Y(Y(Y([],J(QS(e,F,[f,p],O,t)),!1),J($S(e,te,[f,p],O,t)),!1),J(YS(e,`horizontal`,y,[i,r],O,t)),!1),J(YS(e,`vertical`,v,[i,r],O,t)),!1),J(JS(e,`horizontal`,_,f,r,S,0,t)),!1),J(JS(e,`vertical`,g,p,i,C,1,t)),!1)},dragStart:function(e,t){e.state.snapRenderInfo={request:t.isRequest,snap:!0,center:!0},lC(e)},drag:function(e){var t=e.state;lC(e)||(t.guidelines=eC(e)),t.snapRenderInfo&&(t.snapRenderInfo.render=!0)},pinchStart:function(e){this.unset(e)},dragEnd:function(e){this.unset(e)},dragControlCondition:function(e,t){if(wC(e,t)||WS(e,t))return!0;if(!t.isRequest&&t.inputEvent)return R_(t.inputEvent.target,X(`snap-control`))},dragControlStart:function(e){e.state.snapRenderInfo=null,lC(e)},dragControl:function(e){this.drag(e)},dragControlEnd:function(e){this.unset(e)},dragGroupStart:function(e,t){this.dragStart(e,t)},dragGroup:function(e){this.drag(e)},dragGroupEnd:function(e){this.unset(e)},dragGroupControlStart:function(e){e.state.snapRenderInfo=null,lC(e)},dragGroupControl:function(e){this.drag(e)},dragGroupControlEnd:function(e){this.unset(e)},unset:function(e){var t=e.state;t.enableSnap=!1,t.guidelines=[],t.snapRenderInfo=null,t.elementRects=[]}};function EC(e,t){return[e[0]*t[0],e[1]*t[1]]}function X(){var e=[...arguments];return Bg.apply(void 0,Y([ob],J(e),!1))}function DC(e){e()}function OC(e){return!e||e===`none`?[1,0,0,1,0,0]:r_(e)?e:Tv(e)}function kC(e,t,n){return av(t,xv(n,t),e,xv(n.map(function(e){return-e}),t))}function AC(e,t,n){return t===`%`?VC(e.ownerSVGElement)[n?`width`:`height`]/100:1}function jC(e){return NC(yw(e,`:before`)).map(function(t,n){var r=g_(t),i=r.value,a=r.unit;return i*AC(e,a,n===0)})}function MC(e){return e?e.split(` `):[`0`,`0`]}function NC(e){return MC(e.transformOrigin)}function PC(e){var t=px(e)(`transform`);if(t&&t!==`none`)return t;if(`transform`in e){var n=e.transform.baseVal;if(!n)return``;var r=n.length;if(!r)return``;for(var i=[],a=function(e){var t=n[e].matrix;i.push(`matrix(${[`a`,`b`,`c`,`d`,`e`,`f`].map(function(e){return t[e]}).join(`, `)})`)},o=0;o<r;++o)a(o);return i.join(` `)}return``}function FC(e,t,n,r,i){var a=W_(e)||G_(e),o=!1,s,c;if(!e||n)s=e;else{var l=e?.assignedSlot?.parentElement,u=e.parentElement;l?(o=!0,c=u,s=l):s=u}for(var d=!1,f=e===t||s===t,p=`relative`,m=1,h=parseFloat(i?.(`zoom`))||1,g=i?.(`position`);s&&s!==a;){t===s&&(f=!0);var _=px(s),v=s.tagName.toLowerCase(),y=PC(s),b=_(`willChange`),x=parseFloat(_(`zoom`))||1;if(p=_(`position`),r&&x!==1){m=x;break}if(!n&&r&&h!==1&&g&&g!==`absolute`||v===`svg`||v===`foreignobject`||p!==`static`||y&&y!==`none`||b===`transform`)break;var S=e?.assignedSlot?.parentNode,C=s.parentNode;S&&(o=!0,c=C);var w=C;if(w&&w.nodeType===11){s=w.host,d=!0,p=px(s)(`position`);break}s=w,p=`relative`}return{offsetZoom:m,hasSlot:o,parentSlotElement:c,isCustomElement:d,isStatic:p===`static`,isEnd:f||!s||s===a,offsetParent:s||a}}function IC(e,t){var n,r=e.tagName.toLowerCase(),i=e.offsetLeft,a=e.offsetTop,o=px(e),s=n_(i),c=!s,l,u;return!c&&(r!==`svg`||e.ownerSVGElement)?(l=Zy?jC(e):MC(o(`transformOrigin`)).map(function(e){return parseFloat(e)}),u=l.slice(),c=!0,r===`svg`?(i=0,a=0):(n=J(UC(e,l,e===t&&t.tagName.toLowerCase()===`g`),4),i=n[0],a=n[1],l[0]=n[2],l[1]=n[3])):(l=MC(o(`transformOrigin`)).map(function(e){return parseFloat(e)}),u=l.slice()),{tagName:r,isSVG:s,hasOffset:c,offset:[i||0,a||0],origin:l,targetOrigin:u}}function LC(e,t){var n=px(e),r=px(G_(e)),i=r(`position`);if(!t&&(!i||i===`static`))return[0,0];var a=parseInt(r(`marginLeft`),10),o=parseInt(r(`marginTop`),10);return n(`position`)===`absolute`&&((n(`top`)!==`auto`||n(`bottom`)!==`auto`)&&(o=0),(n(`left`)!==`auto`||n(`right`)!==`auto`)&&(a=0)),[a,o]}function RC(e){e.forEach(function(e){var t=e.matrix;t&&(e.matrix=iv(t,3,4))})}function zC(e){for(var t=e.parentElement,n=!1,r=G_(e);t;){var i=yw(t).transform;if(i&&i!==`none`){n=!0;break}if(t===r)break;t=t.parentElement}return{fixedContainer:t||r,hasTransform:n}}function BC(e,t){return t===void 0&&(t=e.length>9),`${t?`matrix3d`:`matrix`}(${lv(e,!t).join(`,`)})`}function VC(e){var t=e.clientWidth,n=e.clientHeight;if(!e)return{x:0,y:0,width:0,height:0,clientWidth:t,clientHeight:n};var r=e.viewBox,i=r&&r.baseVal||{x:0,y:0,width:0,height:0};return{x:i.x,y:i.y,width:i.width||t,height:i.height||n,clientWidth:t,clientHeight:n}}function HC(e,t){var n,r=VC(e),i=r.width,a=r.height,o=r.clientWidth,s=r.clientHeight,c=o/i,l=s/a,u=e.preserveAspectRatio.baseVal,d=u.align,f=u.meetOrSlice,p=[0,0],m=[c,l],h=[0,0];if(d!==1){var g=(d-2)%3,_=Math.floor((d-2)/3);p[0]=i*g/2,p[1]=a*_/2;var v=f===2?Math.max(l,c):Math.min(c,l);m[0]=v,m[1]=v,h[0]=(o-i)/2*g,h[1]=(s-a)/2*_}var y=bv(m,t);return n=J(h,2),y[t*(t-1)]=n[0],y[t*(t-1)+1]=n[1],kC(y,t,p)}function UC(e,t,n){var r=e.tagName.toLowerCase();if(!e.getBBox||!n&&r===`g`)return[0,0,0,0];var i=px(e)(`transform-box`)===`fill-box`,a=e.getBBox(),o=VC(e.ownerSVGElement),s=a.x,c=a.y;r===`foreignobject`&&!s&&!c&&(s=parseFloat(e.getAttribute(`x`))||0,c=parseFloat(e.getAttribute(`y`))||0);var l=s-o.x,u=c-o.y;return[l,u,i?t[0]:t[0]-l,i?t[1]:t[1]-u]}function WC(e,t,n){return uv(e,rv(t,n),n)}function GC(e,t,n,r){return[[0,0],[t,0],[0,n],[t,n]].map(function(t){return WC(e,t,r)})}function KC(e){var t=e.map(function(e){return e[0]}),n=e.map(function(e){return e[1]}),r=Math.min.apply(Math,Y([],J(t),!1)),i=Math.min.apply(Math,Y([],J(n),!1)),a=Math.max.apply(Math,Y([],J(t),!1)),o=Math.max.apply(Math,Y([],J(n),!1));return{left:r,top:i,right:a,bottom:o,width:a-r,height:o-i}}function qC(e,t,n,r){return KC(GC(e,t,n,r))}function JC(e,t,n,r,i){var a,o=e.target,s=e.origin,c=t.matrix,l=tw(o),u=l.offsetWidth,d=l.offsetHeight,f=n.getBoundingClientRect(),p=[0,0];n===G_(n)&&(p=LC(o,!0));for(var m=o.getBoundingClientRect(),h=m.left-f.left+n.scrollLeft-(n.clientLeft||0)+p[0],g=m.top-f.top+n.scrollTop-(n.clientTop||0)+p[1],_=m.width,v=m.height,y=av(r,i,c),b=qC(y,u,d,r),x=b.left,S=b.top,C=b.width,w=b.height,T=WC(y,s,r),E=K(T,[x,S]),D=[h+E[0]*_/C,g+E[1]*v/w],O=[0,0],k=0;++k<10;){var A=$_(i,r);a=J(K(WC(A,D,r),WC(A,T,r)),2),O[0]=a[0],O[1]=a[1];var j=qC(av(r,i,xv(O,r),c),u,d,r),M=j.left,N=j.top,ee=M-h,P=N-g;if(Q(ee)<2&&Q(P)<2)break;D[0]-=ee,D[1]-=P}return O.map(function(e){return Math.round(e)})}function YC(e,t,n){var r=e.length===16?4:3,i=t.map(function(t){return WC(e,t,r)}),a=n.left,o=n.top;return i.map(function(e){return[e[0]+a,e[1]+o]})}function XC(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ZC(e,t){return XC([t[0]-e[0],t[1]-e[1]])}function QC(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=A_(e,t));var i=ZC(e,t);return{transform:`translateY(-50%) translate(${e[0]}px, ${e[1]}px) rotate(${r}rad) scaleY(${n})`,width:`${i}px`}}function $C(e,t){var n=[...arguments].slice(2),r=n.length;return{transform:`translateZ(0px) translate(${n.reduce(function(e,t){return e+t[0]},0)/r}px, ${n.reduce(function(e,t){return e+t[1]},0)/r}px) rotate(${e}rad) scale(${t})`}}function ew(e,t){var n=e[t];return r_(n)?q(q({},e),n):e}function tw(e){var t=e&&!n_(e.offsetWidth),n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=1/0,h=1/0,g=1/0,_=1/0,v=0,y=0,b=!1;if(e)if(!t&&e.ownerSVGElement){var x=e.getBBox();b=!0,n=x.width,r=x.height,o=n,s=r,c=n,l=r,i=n,a=r}else{var S=px(e),C=e.style,w=S(`boxSizing`)===`border-box`,T=parseFloat(S(`borderLeftWidth`))||0,E=parseFloat(S(`borderRightWidth`))||0,D=parseFloat(S(`borderTopWidth`))||0,O=parseFloat(S(`borderBottomWidth`))||0,k=parseFloat(S(`paddingLeft`))||0,A=parseFloat(S(`paddingRight`))||0,j=parseFloat(S(`paddingTop`))||0,M=parseFloat(S(`paddingBottom`))||0,N=k+A,ee=j+M,P=T+E,F=D+O,te=N+P,I=ee+F,ne=S(`position`),re=0,ie=0;if(`clientLeft`in e){var ae=null;if(ae=ne===`absolute`?FC(e,G_(e)).offsetParent:e.parentElement,ae){var oe=px(ae);re=parseFloat(oe(`width`)),ie=parseFloat(oe(`height`))}}u=Math.max(N,w_(S(`minWidth`),re)||0),d=Math.max(ee,w_(S(`minHeight`),ie)||0),m=w_(S(`maxWidth`),re),h=w_(S(`maxHeight`),ie),isNaN(m)&&(m=1/0),isNaN(h)&&(h=1/0),v=w_(C.width,0)||0,y=w_(C.height,0)||0,o=parseFloat(S(`width`))||0,s=parseFloat(S(`height`))||0,c=Q(o-v)<1?T_(u,v||o,m):o,l=Q(s-y)<1?T_(d,y||s,h):s,n=c,r=l,i=c,a=l,w?(g=m,_=h,f=u,p=d,c=n-te,l=r-I):(g=m+te,_=h+I,f=u+te,p=d+I,n=c+te,r=l+I),i=c+N,a=l+ee}return{svg:b,offsetWidth:n,offsetHeight:r,clientWidth:i,clientHeight:a,contentWidth:c,contentHeight:l,inlineCSSWidth:v,inlineCSSHeight:y,cssWidth:o,cssHeight:s,minWidth:u,minHeight:d,maxWidth:m,maxHeight:h,minOffsetWidth:f,minOffsetHeight:p,maxOffsetWidth:g,maxOffsetHeight:_}}function nw(e,t){return A_(t>0?e[0]:e[1],t>0?e[1]:e[0])}function rw(){return{left:0,top:0,width:0,height:0,right:0,bottom:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0}}function iw(e,t){var n=e===G_(e)||e===W_(e),r={clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,overflow:!1};return n&&(r.clientHeight=Math.max(t.height,r.clientHeight),r.scrollHeight=Math.max(t.height,r.scrollHeight)),r.overflow=px(e)(`overflow`)!==`visible`,q(q({},t),r)}function aw(e,t,n,r){var i=e.left,a=e.right,o=e.top,s=e.bottom,c=t.top,l=t.left,u={left:l+i,top:c+o,right:l+a,bottom:c+s,width:a-i,height:s-o};return n&&r?iw(n,u):u}function ow(e,t){var n=0,r=0,i=0,a=0;if(e){var o=e.getBoundingClientRect();n=o.left,r=o.top,i=o.width,a=o.height}var s={left:n,top:r,width:i,height:a,right:n+i,bottom:r+a};return e&&t?iw(e,s):s}function sw(e){var t=e.props,n=t.groupable,r=t.svgOrigin,i=e.getState(),a=i.offsetWidth,o=i.offsetHeight,s=i.svg,c=i.transformOrigin;return!n&&s&&r?Uw(r,a,o):c}function cw(e,t,n,r){var i;if(e)i=e;else if(t)i=[0,0];else{var a=n.target;i=lw(a,r)}return i}function lw(e,t){if(e){var n=e.getAttribute(`data-rotation`)||``,r=e.getAttribute(`data-direction`);if(t.deg=n,r){var i=[0,0];return r.indexOf(`w`)>-1&&(i[0]=-1),r.indexOf(`e`)>-1&&(i[0]=1),r.indexOf(`n`)>-1&&(i[1]=-1),r.indexOf(`s`)>-1&&(i[1]=1),i}}}function uw(e,t){return[sv(t,e[0]),sv(t,e[1]),sv(t,e[2]),sv(t,e[3])]}function dw(e){var t=e.left,n=e.top,r=e.pos1,i=e.pos2,a=e.pos3,o=e.pos4;return uw([r,i,a,o],[t,n])}function fw(e,t){e[t?`controlAbles`:`targetAbles`].forEach(function(t){t.unset&&t.unset(e)})}function pw(e,t){var n=t?`controlGesto`:`targetGesto`,r=e[n];r?.isIdle()===!1&&fw(e,t),r?.unset(),e[n]=null}function mw(e,t){if(t){var n=Wb(t);n.nextStyle=q(q({},n.nextStyle),e)}return{style:e,cssText:C_(e).map(function(t){return`${__(t,`-`)}: ${e[t]};`}).join(``)}}function hw(e,t,n){var r=t.afterTransform||t.transform;return q(q({},mw(q(q(q({},e.style),t.style),{transform:r}),n)),{afterTransform:r,transform:e.transform})}function gw(e,t,n,r){var i=t.datas;i.datas||={};var a=q(q({},n),{target:e.state.target,clientX:t.clientX,clientY:t.clientY,inputEvent:t.inputEvent,currentTarget:e,moveable:e,datas:i.datas,isRequest:t.isRequest,isRequestChild:t.isRequestChild,isFirstDrag:!!t.isFirstDrag,isTrusted:t.isTrusted!==!1,stopAble:function(){i.isEventStart=!1},stopDrag:function(){var e;(e=t.stop)==null||e.call(t)}});return i.isStartEvent?r||(i.lastEvent=a):i.isStartEvent=!0,a}function _w(e,t,n){var r=t.datas,i=`isDrag`in n?n.isDrag:t.isDrag;return r.datas||={},q(q({isDrag:i},n),{moveable:e,target:e.state.target,clientX:t.clientX,clientY:t.clientY,inputEvent:t.inputEvent,currentTarget:e,lastEvent:r.lastEvent,isDouble:t.isDouble,datas:r.datas,isFirstDrag:!!t.isFirstDrag})}function vw(e,t,n){e._emitter.on(t,n)}function Z(e,t,n,r,i){return e.triggerEvent(t,n,r,i)}function yw(e,t){return K_(e).getComputedStyle(e,t)}function bw(e,t,n){var r={},i={};return e.filter(function(e){var a=e.name;if(r[a]||!t.some(function(t){return e[t]}))return!1;if(!n&&e.ableGroup){if(i[e.ableGroup])return!1;i[e.ableGroup]=!0}return r[a]=!0,!0})}function xw(e,t){return e===t||e==null&&t==null}function Sw(){for(var e=[...arguments],t=e.length-1,n=0;n<t;++n){var r=e[n];if(!n_(r))return r}return e[t]}function Cw(e,t){var n=[],r=[];return e.forEach(function(i,a){var o=t(i,a,e),s=r.indexOf(o),c=n[s]||[];s===-1&&(r.push(o),n.push(c)),c.push(i)}),n}function ww(e,t){var n=[],r={};return e.forEach(function(i,a){var o=t(i,a,e),s=r[o];s||(s=[],r[o]=s,n.push(s)),s.push(i)}),n}function Tw(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Ew(){var e=[...arguments];return e.sort(function(e,t){return Q(t)-Q(e)}),e[0]}function Dw(e,t,n){return uv($_(e,n),rv(t,n),n)}function Ow(e,t){var n,r=e.is3d,i=e.rootMatrix,a=r?4:3;return n=J(Dw(i,[t.distX,t.distY],a),2),t.distX=n[0],t.distY=n[1],t}function kw(e,t,n,r){if(!n[0]&&!n[1])return t;var i=WC(e,[dC(n[0]||1),0],r),a=WC(e,[0,dC(n[1]||1)],r);return sv(t,WC(e,[n[0]/XC(i),n[1]/XC(a)],r))}function Aw(e,t,n){return n?`${e/t*100}%`:`${e}px`}function jw(e){return Q(e)<=ub?0:e}function Mw(e){return function(t){if(!t.isDragging(e))return``;var n=rx(t,e).deg;return n?X(`view-control-rotation${n}`):``}}function Nw(e,t){return t===void 0&&(t=[e]),function(n,r){if(r.isRequest)return t.some(function(e){return r.requestAble===e})?r.parentDirection:!1;var i=r.inputEvent.target;return R_(i,X(`direction`))&&(!e||R_(i,X(e)))}}function Pw(e,t,n){var r=Ov(e,{"x%":function(e){return e/100*t.offsetWidth},"y%":function(e){return e/100*t.offsetHeight}}),i=e.slice(0,n<0?void 0:n),a=e.slice(0,n<0?void 0:n+1),o=e[n]||``,s=n<0?[]:e.slice(n),c=n<0?[]:e.slice(n+1),l=r.slice(0,n<0?void 0:n),u=r.slice(0,n<0?void 0:n+1),d=r[n]??Ov([``])[0],f=n<0?[]:r.slice(n),p=n<0?[]:r.slice(n+1),m=d?[d]:[],h=Dv(l),g=Dv(u),_=Dv(f),v=Dv(p),y=ov(h,_,4);return{transforms:e,beforeFunctionMatrix:h,beforeFunctionMatrix2:g,targetFunctionMatrix:Dv(m),afterFunctionMatrix:_,afterFunctionMatrix2:v,allFunctionMatrix:y,beforeFunctions:l,beforeFunctions2:u,targetFunction:m[0],afterFunctions:f,afterFunctions2:p,beforeFunctionTexts:i,beforeFunctionTexts2:a,targetFunctionText:o,afterFunctionTexts:s,afterFunctionTexts2:c}}function Fw(e){return!e||!r_(e)||J_(e)?!1:i_(e)||`length`in e}function Iw(e,t){return e?J_(e)?e:a_(e)?t?document.querySelector(e):e:s_(e)?e():q_(e)?e:`current`in e?e.current:e:null}function Lw(e,t){return e?(Fw(e)?[].slice.call(e):[e]).reduce(function(e,n){return a_(n)&&t?Y(Y([],J(e),!1),J([].slice.call(document.querySelectorAll(n))),!1):(i_(n)?e.push(Lw(n,t)):e.push(Iw(n,t)),e)},[]):[]}function Rw(e,t,n){var r=A_(e,t)/Math.PI*180;return r=n>=0?r:180-r,r=r>=0?r:360+r,r}function zw(e,t){var n=e.rootMatrix,r=e.is3d,i=$_(n,r?4:3);return r||(i=iv(i,3,4)),i[12]=0,i[13]=0,i[14]=0,Ev(i,t)}function Bw(e,t,n,r,i){var a=J(e,2),o=a[0],s=a[1],c=0,l=0;if(i&&o&&s){var u=A_([0,0],t),d=A_([0,0],r),f=XC(t),p=Math.cos(u-d)*f;if(!r[0])l=p,c=l*n;else if(!r[1])c=p,l=c/n;else{var m=r[0]*o,h=r[1]*s,g=Math.atan2(m+t[0],h+t[1]),_=Math.atan2(m,h);g<0&&(g+=Math.PI*2),_<0&&(_+=Math.PI*2);var v=0;Q(g-_)<Math.PI/2||Q(g-_)>Math.PI/2*3||(_+=Math.PI),v=g-_,v>Math.PI*2?v-=Math.PI*2:v>Math.PI?v=2*Math.PI-v:v<-Math.PI&&(v=-2*Math.PI-v);var y=XC([m+t[0],h+t[1]])*Math.cos(v);c=y*Math.sin(_)-m,l=y*Math.cos(_)-h,r[0]<0&&(c*=-1),r[1]<0&&(l*=-1)}}else c=r[0]*t[0],l=r[1]*t[1];return[c,l]}function Vw(e,t,n,r){var i,a=n.ratio,o=n.startOffsetWidth,s=n.startOffsetHeight,c=0,l=0,u=r.distX,d=r.distY,f=r.pinchScale,p=r.parentDistance,m=r.parentDist,h=r.parentScale,g=n.fixedDirection,_=[0,1].map(function(t){return Q(e[t]-g[t])}),v=[0,1].map(function(e){var t=_[e];return t!==0&&(t=2/t),t});if(m)c=m[0],l=m[1],t&&(c?l||=c/a:c=l*a);else if(o_(f))c=(f-1)*o,l=(f-1)*s;else if(h)c=(h[0]-1)*o,l=(h[1]-1)*s;else if(p){var y=o*_[0],b=s*_[1],x=XC([y,b]);c=p/x*y*v[0],l=p/x*b*v[1]}else{var S=kb({datas:n,distX:u,distY:d});S=v.map(function(e,t){return S[t]*e}),i=J(Bw([o,s],S,a,e,t),2),c=i[0],l=i[1]}return{distWidth:c,distHeight:l}}function Hw(e,t){if(t){if(e===`left`)return{x:`0%`,y:`50%`};if(e===`top`||e===`center`)return{x:`50%`,y:`50%`};if(e===`right`)return{x:`100%`,y:`50%`};if(e===`bottom`)return{x:`50%`,y:`100%`};var n=J(e.split(` `),2),r=n[0],i=n[1],a=Hw(r||``),o=Hw(i||``),s=q(q({},a),o),c={x:`50%`,y:`50%`};return s.x&&(c.x=s.x),s.y&&(c.y=s.y),s.value&&(s.x&&!s.y&&(c.y=s.value),!s.x&&s.y&&(c.x=s.value)),c}return e===`left`?{x:`0%`}:e===`right`?{x:`100%`}:e===`top`?{y:`0%`}:e===`bottom`?{y:`100%`}:e?e===`center`?{value:`50%`}:{value:e}:{}}function Uw(e,t,n){var r=Hw(e,!0),i=r.x,a=r.y;return[w_(i,t)||0,w_(a,n)||0]}function Ww(e,t,n){var r=e.map(function(e){return K(e,t)}),i=r.map(function(e){return hv(e,n)});return{prev:r,next:i,result:i.map(function(e){return sv(e,t)})}}function Gw(e,t){return e.length===t.length&&e.every(function(e,n){var r=t[n],i=i_(e),a=i_(r);return i&&a?Gw(e,r):!i&&!a?e===r:!1})}function Kw(e,t,n,r,i){var a=e._store,o=a[t];if(!(t in a))if(i!=null)a[t]=i,o=i;else return a[t]=n,n;return o===n||r(o)===r(n)?o:(a[t]=n,n)}function qw(e){return e>=0?1:-1}function Q(e){return Math.abs(e)}function Jw(e,t){return I_(e).map(function(e){return t(e)})}function Yw(e){return o_(e)?{top:e,left:e,right:e,bottom:e}:{left:e.left||0,top:e.top||0,right:e.right||0,bottom:e.bottom||0}}var Xw=Wy(`pinchable`,{props:[`pinchable`],events:[`pinchStart`,`pinch`,`pinchEnd`,`pinchGroupStart`,`pinchGroup`,`pinchGroupEnd`],dragStart:function(){return!0},pinchStart:function(e,t){var n=t.datas,r=t.targets,i=t.angle,a=t.originalDatas,o=e.props,s=o.pinchable,c=o.ables;if(!s)return!1;var l=`onPinch${r?`Group`:``}Start`,u=`drag${r?`Group`:``}ControlStart`,d=(s===!0?e.controlAbles:c.filter(function(e){return s.indexOf(e.name)>-1})).filter(function(e){return e.canPinch&&e[u]}),f=gw(e,t,{});r&&(f.targets=r),n.isPinch=Z(e,l,f)!==!1,n.ables=d;var p=n.isPinch;return p?(d.forEach(function(n){if(a[n.name]=a[n.name]||{},n[u]){var r=q(q({},t),{datas:a[n.name],parentRotate:i,isPinch:!0});n[u](e,r)}}),e.state.snapRenderInfo={request:t.isRequest,direction:[0,0]},p):!1},pinch:function(e,t){var n=t.datas,r=t.scale,i=t.distance,a=t.originalDatas,o=t.inputEvent,s=t.targets,c=t.angle;if(n.isPinch){var l=i*(1-1/r),u=gw(e,t,{});s&&(u.targets=s),Z(e,`onPinch${s?`Group`:``}`,u);var d=n.ables,f=`drag${s?`Group`:``}Control`;return d.forEach(function(n){n[f]&&n[f](e,q(q({},t),{datas:a[n.name],inputEvent:o,resolveMatrix:!0,pinchScale:r,parentDistance:l,parentRotate:c,isPinch:!0}))}),u}},pinchEnd:function(e,t){var n=t.datas,r=t.isPinch,i=t.inputEvent,a=t.targets,o=t.originalDatas;if(n.isPinch){var s=`onPinch${a?`Group`:``}End`,c=_w(e,t,{isDrag:r});a&&(c.targets=a),Z(e,s,c);var l=n.ables,u=`drag${a?`Group`:``}ControlEnd`;return l.forEach(function(n){n[u]&&n[u](e,q(q({},t),{isDrag:r,datas:o[n.name],inputEvent:i,isPinch:!0}))}),r}},pinchGroupStart:function(e,t){return this.pinchStart(e,q(q({},t),{targets:e.props.targets}))},pinchGroup:function(e,t){return this.pinch(e,q(q({},t),{targets:e.props.targets}))},pinchGroupEnd:function(e,t){return this.pinchEnd(e,q(q({},t),{targets:e.props.targets}))}}),Zw=Nw(`scalable`),Qw={name:`scalable`,ableGroup:`size`,canPinch:!0,props:[`scalable`,`throttleScale`,`renderDirections`,`keepRatio`,`edge`,`displayAroundControls`],events:[`scaleStart`,`beforeScale`,`scale`,`scaleEnd`,`scaleGroupStart`,`beforeScaleGroup`,`scaleGroup`,`scaleGroupEnd`],render:Sx(`scalable`),dragControlCondition:Zw,viewClassName:Mw(`scalable`),dragControlStart:function(e,t){var n=t.datas,r=t.isPinch,i=t.inputEvent,a=t.parentDirection,o=cw(a,r,i,n),s=e.state,c=s.width,l=s.height,u=s.targetTransform,d=s.target,f=s.pos1,p=s.pos2,m=s.pos4;if(!o||!d)return!1;r||Sb(e,t),n.datas={},n.transform=u,n.prevDist=[1,1],n.direction=o,n.startOffsetWidth=c,n.startOffsetHeight=l,n.startValue=[1,1];var h=!o[0]&&!o[1]||o[0]||!o[1];Vb(e,t,`scale`),n.isWidth=h;function g(e){n.ratio=e&&isFinite(e)?e:0}n.startPositions=dw(e.state);function _(e){var t=PS(n.startPositions,e);n.fixedDirection=t.fixedDirection,n.fixedPosition=t.fixedPosition,n.fixedOffset=t.fixedOffset}n.setFixedDirection=_,g(N_(f,p)/N_(p,m)),_([-o[0],-o[1]]);var v=function(e){n.minScaleSize=e},y=function(e){n.maxScaleSize=e};v([-1/0,-1/0]),y([1/0,1/0]);var b=gw(e,t,q(q({direction:o,set:function(e){n.startValue=e},setRatio:g,setFixedDirection:_,setMinScaleSize:v,setMaxScaleSize:y},Bb(e,t)),{dragStart:NS.dragStart(e,new yb().dragStart([0,0],t))})),x=Z(e,`onScaleStart`,b);return n.startFixedDirection=n.fixedDirection,x!==!1&&(n.isScale=!0,e.state.snapRenderInfo={request:t.isRequest,direction:o}),n.isScale?b:!1},dragControl:function(e,t){wb(e,t,`scale`);var n=t.datas,r=t.parentKeepRatio,i=t.parentFlag,a=t.isPinch,o=t.dragClient,s=t.isRequest,c=t.useSnap,l=t.resolveMatrix,u=n.prevDist,d=n.direction,f=n.startOffsetWidth,p=n.startOffsetHeight,m=n.isScale,h=n.startValue,g=n.isWidth,_=n.ratio;if(!m)return!1;var v=e.props,y=v.throttleScale,b=v.parentMoveable,x=d;!d[0]&&!d[1]&&(x=[1,1]);var S=_&&(r??v.keepRatio)||!1,C=e.state,w=[h[0],h[1]];function T(){var e=Vw(x,S,n,t),r=e.distWidth,i=e.distHeight,a=f?(f+r)/f:1,o=p?(p+i)/p:1;h[0]||(w[0]=r/f),h[1]||(w[1]=i/p);var s=(x[0]||S?a:1)*w[0],c=(x[1]||S?o:1)*w[1];return s===0&&(s=qw(u[0])*db),c===0&&(c=qw(u[1])*db),[s,c]}var E=T();if(!a&&e.props.groupable){var D=(C.snapRenderInfo||{}).direction;i_(D)&&(D[0]||D[1])&&(C.snapRenderInfo={direction:d,request:t.isRequest})}Z(e,`onBeforeScale`,gw(e,t,{scale:E,setFixedDirection:function(e){return n.setFixedDirection(e),E=T(),E},startFixedDirection:n.startFixedDirection,setScale:function(e){E=e}},!0));var O=[E[0]/w[0],E[1]/w[1]],k=o,A=[0,0],j=qw(O[0]*O[1]),M=!o&&!i&&a;if(M||l?k=Yb(e,n.targetAllTransform,[0,0],[0,0],n):o||(k=n.fixedPosition),a||(A=bC(e,O,d,!c&&s,n)),S){x[0]&&x[1]&&A[0]&&A[1]&&(Math.abs(A[0]*f)>Math.abs(A[1]*p)?A[1]=0:A[0]=0);var N=!A[0]&&!A[1];if(N&&(g?O[0]=P_(O[0]*w[0],y)/w[0]:O[1]=P_(O[1]*w[1],y)/w[1]),x[0]&&!x[1]||A[0]&&!A[1]||N&&g){O[0]+=A[0];var ee=f*O[0]*w[0]/_;O[1]=qw(j*O[0])*Q(ee/p/w[1])}else if(!x[0]&&x[1]||!A[0]&&A[1]||N&&!g){O[1]+=A[1];var P=p*O[1]*w[1]*_;O[0]=qw(j*O[1])*Q(P/f/w[0])}}else O[0]+=A[0],O[1]+=A[1],A[0]||(O[0]=P_(O[0]*w[0],y)/w[0]),A[1]||(O[1]=P_(O[1]*w[1],y)/w[1]);O[0]===0&&(O[0]=qw(u[0])*db),O[1]===0&&(O[1]=qw(u[1])*db),E=EC(O,[w[0],w[1]]);var F=[f,p],te=[f*E[0],p*E[1]];te=D_(te,n.minScaleSize,n.maxScaleSize,S?_:!1),E=Jw(2,function(e){return F[e]?te[e]/F[e]:te[e]}),O=Jw(2,function(e){return E[e]/w[e]});var I=Jw(2,function(e){return u[e]?O[e]/u[e]:O[e]}),ne=`scale(${O.join(`, `)})`,re=`scale(${E.join(`, `)})`,ie=Tb(n,re,ne),ae=!h[0]||!h[1],oe=Zb(e,ae?re:ne,n.fixedDirection,k,n.fixedOffset,n,ae),se=M?oe:K(oe,n.prevInverseDist||[0,0]);if(n.prevDist=O,n.prevInverseDist=oe,E[0]===u[0]&&E[1]===u[1]&&se.every(function(e){return!e})&&!b&&!M)return!1;var ce=gw(e,t,q({offsetWidth:f,offsetHeight:p,direction:d,scale:E,dist:O,delta:I,isPinch:!!a},Jb(e,ie,se,a,t)));return Z(e,`onScale`,ce),ce},dragControlEnd:function(e,t){var n=t.datas;if(!n.isScale)return!1;n.isScale=!1;var r=_w(e,t,{});return Z(e,`onScaleEnd`,r),r},dragGroupControlCondition:Zw,dragGroupControlStart:function(e,t){var n=t.datas,r=this.dragControlStart(e,t);if(!r)return!1;var i=mx(e,`resizable`,t);n.moveableScale=e.scale;var a=gx(e,this,`dragControlStart`,t,function(t,r){return _x(e,t,n,r)}),o=function(t){r.setFixedDirection(t),a.forEach(function(r,a){r.setFixedDirection(t),_x(e,r.moveable,n,i[a])})};n.setFixedDirection=o;var s=q(q({},r),{targets:e.props.targets,events:a,setFixedDirection:o});return n.isScale=Z(e,`onScaleGroupStart`,s)!==!1,n.isScale?s:!1},dragGroupControl:function(e,t){var n=t.datas;if(n.isScale){vw(e,`onBeforeScale`,function(n){Z(e,`onBeforeScaleGroup`,gw(e,t,q(q({},n),{targets:e.props.targets}),!0))});var r=this.dragControl(e,t);if(r){var i=r.dist,a=n.moveableScale;e.scale=[i[0]*a[0],i[1]*a[1]];var o=e.props.keepRatio,s=n.fixedPosition,c=gx(e,this,`dragControl`,t,function(t,n){var r=J(uv(vv(e.rotation/180*Math.PI,3),[n.datas.originalX*i[0],n.datas.originalY*i[1],1],3),2),a=r[0],c=r[1];return q(q({},n),{parentDist:null,parentScale:i,parentKeepRatio:o,dragClient:sv(s,[a,c])})}),l=q({targets:e.props.targets,events:c},r);return Z(e,`onScaleGroup`,l),l}}},dragGroupControlEnd:function(e,t){var n=t.isDrag;if(t.datas.isScale){this.dragControlEnd(e,t);var r=gx(e,this,`dragControlEnd`,t);return Z(e,`onScaleGroupEnd`,_w(e,t,{targets:e.props.targets,events:r})),n}},request:function(){var e={},t=0,n=0,r=!1;return{isControl:!0,requestStart:function(t){return r=t.useSnap,{datas:e,parentDirection:t.direction||[1,1],useSnap:r}},request:function(i){return t+=i.deltaWidth,n+=i.deltaHeight,{datas:e,parentDist:[t,n],parentKeepRatio:i.keepRatio,useSnap:r}},requestEnd:function(){return{datas:e,isDrag:!0,useSnap:r}}}}};function $w(e,t){return e.map(function(e,n){return t_(e,t[n],1,2)})}function eT(e,t,n){var r=A_(e,t),i=A_(e,n)-r;return i>=0?i:i+2*Math.PI}function tT(e,t){var n=eT(e[0],e[1],e[2]),r=eT(t[0],t[1],t[2]),i=Math.PI;return!(n>=i&&r<=i||n<=i&&r>=i)}var nT={name:`warpable`,ableGroup:`size`,props:[`warpable`,`renderDirections`,`edge`,`displayAroundControls`],events:[`warpStart`,`warp`,`warpEnd`],viewClassName:Mw(`warpable`),render:function(e,t){var n=e.props,r=n.resizable,i=n.scalable,a=n.warpable,o=n.zoom;if(r||i||!a)return[];var s=e.state,c=s.pos1,l=s.pos2,u=s.pos3,d=s.pos4,f=$w(c,l),p=$w(l,c),m=$w(c,u),h=$w(u,c),g=$w(u,d),_=$w(d,u),v=$w(l,d),y=$w(d,l);return Y([t.createElement(`div`,{className:X(`line`),key:`middeLine1`,style:QC(f,g,o)}),t.createElement(`div`,{className:X(`line`),key:`middeLine2`,style:QC(p,_,o)}),t.createElement(`div`,{className:X(`line`),key:`middeLine3`,style:QC(m,v,o)}),t.createElement(`div`,{className:X(`line`),key:`middeLine4`,style:QC(h,y,o)})],J(Cx(e,`warpable`,t)),!1)},dragControlCondition:function(e,t){if(t.isRequest)return!1;var n=t.inputEvent.target;return R_(n,X(`direction`))&&R_(n,X(`warpable`))},dragControlStart:function(e,t){var n=t.datas,r=t.inputEvent,i=e.props.target,a=r.target,o=lw(a,n);if(!o||!i)return!1;var s=e.state,c=s.transformOrigin,l=s.is3d,u=s.targetTransform,d=s.targetMatrix,f=s.width,p=s.height,m=s.left,h=s.top;return n.datas={},n.targetTransform=u,n.warpTargetMatrix=l?d:iv(d,3,4),n.targetInverseMatrix=Q_($_(n.warpTargetMatrix,4),3,4),n.direction=o,n.left=m,n.top=h,n.poses=[[0,0],[f,0],[0,p],[f,p]].map(function(e){return K(e,c)}),n.nextPoses=n.poses.map(function(e){var t=J(e,2),r=t[0],i=t[1];return uv(n.warpTargetMatrix,[r,i,0,1],4)}),n.startValue=yv(4),n.prevMatrix=yv(4),n.absolutePoses=dw(s),n.posIndexes=Mb(o),Sb(e,t),Vb(e,t,`matrix3d`),s.snapRenderInfo={request:t.isRequest,direction:o},Z(e,`onWarpStart`,gw(e,t,q({set:function(e){n.startValue=e}},Bb(e,t))))!==!1&&(n.isWarp=!0),n.isWarp},dragControl:function(e,t){var n=t.datas,r=t.isRequest,i=t.distX,a=t.distY,o=n.targetInverseMatrix,s=n.prevMatrix,c=n.isWarp,l=n.startValue,u=n.poses,d=n.posIndexes,f=n.absolutePoses;if(!c)return!1;if(wb(e,t,`matrix3d`),zx(e,`warpable`)){var p=d.map(function(e){return f[e]});p.length>1&&p.push([(p[0][0]+p[1][0])/2,(p[0][1]+p[1][1])/2]);var m=ES(e,r,{horizontal:p.map(function(e){return e[1]+a}),vertical:p.map(function(e){return e[0]+i})}),h=m.horizontal,g=m.vertical;a-=h.offset,i-=g.offset}var _=kb({datas:n,distX:i,distY:a},!0),v=n.nextPoses.slice();if(d.forEach(function(e){v[e]=sv(v[e],_)}),!cb.every(function(e){return tT(e.map(function(e){return u[e]}),e.map(function(e){return v[e]}))}))return!1;var y=Sv(u[0],u[2],u[1],u[3],v[0],v[2],v[1],v[3]);if(!y.length)return!1;var b=Db(n,ov(o,y,4),!0),x=ov($_(s,4),b,4);n.prevMatrix=b;var S=ov(l,b,4),C=Tb(n,`matrix3d(${S.join(`, `)})`,`matrix3d(${b.join(`, `)})`);return Ub(t,C),Z(e,`onWarp`,gw(e,t,q({delta:x,matrix:S,dist:b,multiply:ov,transform:C},mw({transform:C},t)))),!0},dragControlEnd:function(e,t){var n=t.datas,r=t.isDrag;return n.isWarp?(n.isWarp=!1,Z(e,`onWarpEnd`,_w(e,t,{})),r):!1}},rT=X(`area-pieces`),iT=X(`area-piece`),aT=X(`avoid`),oT=X(`view-dragging`);function sT(e){var t=e.areaElement;if(t){var n=e.state,r=n.width,i=n.height;B_(t,aT),t.style.cssText+=`left: 0px; top: 0px; width: ${r}px; height: ${i}px`}}function cT(e){return e.createElement(`div`,{key:`area_pieces`,className:rT},e.createElement(`div`,{className:iT}),e.createElement(`div`,{className:iT}),e.createElement(`div`,{className:iT}),e.createElement(`div`,{className:iT}))}var lT={name:`dragArea`,props:[`dragArea`,`passDragArea`],events:[`click`,`clickGroup`],render:function(e,t){var n=e.props,r=n.target,i=n.dragArea,a=n.groupable,o=n.passDragArea,s=e.getState(),c=s.width,l=s.height,u=s.renderPoses,d=o?X(`area`,`pass`):X(`area`);if(a)return[t.createElement(`div`,{key:`area`,ref:Hg(e,`areaElement`),className:d}),cT(t)];if(!r||!i)return[];var f=Sv([0,0],[c,0],[0,l],[c,l],u[0],u[1],u[2],u[3]),p=f.length?BC(f,!0):`none`;return[t.createElement(`div`,{key:`area`,ref:Hg(e,`areaElement`),className:d,style:{top:`0px`,left:`0px`,width:`${c}px`,height:`${l}px`,transformOrigin:`0 0`,transform:p}}),cT(t)]},dragStart:function(e,t){var n=t.datas,r=t.clientX,i=t.clientY;if(!t.inputEvent)return!1;n.isDragArea=!1;var a=e.areaElement,o=e.state,s=o.moveableClientRect,c=o.renderPoses,l=o.rootMatrix,u=o.is3d,d=s.left,f=s.top,p=KC(c),m=p.left,h=p.top,g=p.width,_=p.height,v=u?4:3,y=J(Dw(l,[r-d,i-f],v),2),b=y[0],x=y[1];b-=m,x-=h;var S=[{left:m,top:h,width:g,height:x-10},{left:m,top:h,width:b-10,height:_},{left:m,top:h+x+10,width:g,height:_-x-10},{left:m+b+10,top:h,width:g-b-10,height:_}],C=[].slice.call(a.nextElementSibling.children);S.forEach(function(e,t){C[t].style.cssText=`left: ${e.left}px;top: ${e.top}px; width: ${e.width}px; height: ${e.height}px;`}),z_(a,aT),o.disableNativeEvent=!0},drag:function(e,t){var n=t.datas,r=t.inputEvent;if(this.enableNativeEvent(e),!r)return!1;n.isDragArea||(n.isDragArea=!0,sT(e))},dragEnd:function(e,t){this.enableNativeEvent(e);var n=t.inputEvent,r=t.datas;if(!n)return!1;r.isDragArea||sT(e)},dragGroupStart:function(e,t){return this.dragStart(e,t)},dragGroup:function(e,t){return this.drag(e,t)},dragGroupEnd:function(e,t){return this.dragEnd(e,t)},unset:function(e){sT(e),e.state.disableNativeEvent=!1},enableNativeEvent:function(e){var t=e.state;t.disableNativeEvent&&x_(function(){t.disableNativeEvent=!1})}},uT=Wy(`origin`,{props:[`origin`,`svgOrigin`],render:function(e,t){var n=e.props,r=n.zoom,i=n.svgOrigin,a=n.groupable,o=e.getState(),s=o.beforeOrigin,c=o.rotation,l=o.svg,u=o.allMatrix,d=o.is3d,f=o.left,p=o.top,m=o.offsetWidth,h=o.offsetHeight,g;if(!a&&l&&i){var _=J(Uw(i,m,h),2),v=_[0],y=_[1];g=$C(c,r,K(WC(u,[v,y],d?4:3),[f,p]))}else g=$C(c,r,s);return[t.createElement(`div`,{className:X(`control`,`origin`),style:g,key:`beforeOrigin`})]}});function dT(e){var t=e.scrollContainer;return[t.scrollLeft,t.scrollTop]}var fT={name:`scrollable`,canPinch:!0,props:[`scrollable`,`scrollContainer`,`scrollThreshold`,`scrollThrottleTime`,`getScrollPosition`,`scrollOptions`],events:[`scroll`,`scrollGroup`],dragRelation:`strong`,dragStart:function(e,t){var n=e.props,r=n.scrollContainer,i=r===void 0?e.getContainer():r,a=n.scrollOptions,o=new Zv,s=Iw(i,!0);t.datas.dragScroll=o,e.state.dragScroll=o;var c=t.isControl?`controlGesto`:`targetGesto`,l=t.targets;o.on(`scroll`,function(n){var r=n.container,i=n.direction,a=gw(e,t,{scrollContainer:r,direction:i}),o=l?`onScrollGroup`:`onScroll`;l&&(a.targets=l),Z(e,o,a)}).on(`move`,function(t){var n=t.offsetX,r=t.offsetY,i=t.inputEvent;e[c].scrollBy(n,r,i.inputEvent,!1)}).on(`scrollDrag`,function(t){var n=t.next;n(e[c].getCurrentEvent())}),o.dragStart(t,q({container:s},a))},checkScroll:function(e,t){var n=t.datas.dragScroll;if(n){var r=e.props,i=r.scrollContainer,a=i===void 0?e.getContainer():i,o=r.scrollThreshold,s=o===void 0?0:o,c=r.scrollThrottleTime,l=c===void 0?0:c,u=r.getScrollPosition,d=u===void 0?dT:u,f=r.scrollOptions;return n.drag(t,q({container:a,threshold:s,throttleTime:l,getScrollPosition:function(e){return d({scrollContainer:e.container,direction:e.direction})}},f)),!0}},drag:function(e,t){return this.checkScroll(e,t)},dragEnd:function(e,t){t.datas.dragScroll.dragEnd(),t.datas.dragScroll=null},dragControlStart:function(e,t){return this.dragStart(e,q(q({},t),{isControl:!0}))},dragControl:function(e,t){return this.drag(e,t)},dragControlEnd:function(e,t){return this.dragEnd(e,t)},dragGroupStart:function(e,t){return this.dragStart(e,q(q({},t),{targets:e.props.targets}))},dragGroup:function(e,t){return this.drag(e,q(q({},t),{targets:e.props.targets}))},dragGroupEnd:function(e,t){return this.dragEnd(e,q(q({},t),{targets:e.props.targets}))},dragGroupControlStart:function(e,t){return this.dragStart(e,q(q({},t),{targets:e.props.targets,isControl:!0}))},dragGroupControl:function(e,t){return this.drag(e,q(q({},t),{targets:e.props.targets}))},dragGroupControEnd:function(e,t){return this.dragEnd(e,q(q({},t),{targets:e.props.targets}))},unset:function(e){var t,n=e.state;(t=n.dragScroll)==null||t.dragEnd(),n.dragScroll=null}},pT={name:``,props:`target.dragTargetSelf.dragTarget.dragContainer.container.warpSelf.rootContainer.useResizeObserver.useMutationObserver.zoom.dragFocusedInput.transformOrigin.ables.className.pinchThreshold.pinchOutside.triggerAblesSimultaneously.checkInput.cspNonce.translateZ.hideDefaultLines.props.flushSync.stopPropagation.preventClickEventOnDrag.preventClickDefault.viewContainer.persistData.useAccuratePosition.firstRenderState.linePadding.controlPadding.preventDefault.preventRightClick.preventWheelClick.requestStyles`.split(`.`),events:[`changeTargets`]},mT=Wy(`padding`,{props:[`padding`],render:function(e,t){var n=e.props;if(n.dragArea)return[];var r=Yw(n.padding||{}),i=r.left,a=r.top,o=r.right,s=r.bottom,c=e.getState(),l=c.renderPoses,u=[c.pos1,c.pos2,c.pos3,c.pos4],d=[];return i>0&&d.push([0,2]),a>0&&d.push([0,1]),o>0&&d.push([1,3]),s>0&&d.push([2,3]),d.map(function(e,n){var r=J(e,2),i=r[0],a=r[1],o=u[i],s=u[a],c=l[i],d=l[a],f=Sv([0,0],[100,0],[0,100],[100,100],o,s,c,d);if(f.length)return t.createElement(`div`,{key:`padding${n}`,className:X(`padding`),style:{transform:BC(f,!0)}})})}}),hT=[`nw`,`ne`,`se`,`sw`];function gT(e,t){var n=e[0]+e[1],r=n>t?t/n:1;return e[0]*=r,e[1]=t-e[1]*r,e}var _T=[1,2,5,6],vT=[0,3,4,7],yT=[1,-1,-1,1],bT=[1,1,-1,-1];function xT(e,t,n,r,i,a,o,s){i===void 0&&(i=0),a===void 0&&(a=0),o===void 0&&(o=n),s===void 0&&(s=r);var c=[],l=!1,u=e.filter(function(e){return!e.virtual});return{radiusPoses:u,styles:c,raws:u.map(function(e){var u=e.horizontal,d=e.vertical,f=e.pos;if(d&&!l&&(l=!0,c.push(`/`)),l){var p=Math.max(0,d===1?f[1]-a:s-f[1]);return c.push(Aw(p,r,t)),p}else{var p=Math.max(0,u===1?f[0]-i:o-f[0]);return c.push(Aw(p,n,t)),p}})}}function ST(e){for(var t=[0,0],n=[0,0],r=e.length,i=0;i<r;++i){var a=e[i];a.sub&&(a.horizontal&&(t[1]===0&&(t[0]=i),t[1]=i-t[0]+1,n[0]=i+1),a.vertical&&(n[1]===0&&(n[0]=i),n[1]=i-n[0]+1))}return{horizontalRange:t,verticalRange:n}}function CT(e,t,n,r,i,a,o){var s,c,l,u;a===void 0&&(a=[0,0]),o===void 0&&(o=!1);var d=e.indexOf(`/`),f=(d>-1?e.slice(0,d):e).length,p=e.slice(0,f),m=e.slice(f+1),h=p.length,g=m.length,_=g>0,v=J(p,4),y=v[0],b=y===void 0?`0px`:y,x=v[1],S=x===void 0?b:x,C=v[2],w=C===void 0?b:C,T=v[3],E=T===void 0?S:T,D=J(m,4),O=D[0],k=O===void 0?b:O,A=D[1],j=A===void 0?_?k:S:A,M=D[2],N=M===void 0?_?k:w:M,ee=D[3],P=ee===void 0?_?j:E:ee,F=[b,S,w,E].map(function(e){return w_(e,t)}),te=[k,j,N,P].map(function(e){return w_(e,n)}),I=F.slice(),ne=te.slice();s=J(gT([I[0],I[1]],t),2),I[0]=s[0],I[1]=s[1],c=J(gT([I[3],I[2]],t),2),I[3]=c[0],I[2]=c[1],l=J(gT([ne[0],ne[3]],n),2),ne[0]=l[0],ne[3]=l[1],u=J(gT([ne[1],ne[2]],n),2),ne[1]=u[0],ne[2]=u[1];var re=o?I:I.slice(0,Math.max(a[0],h)),ie=o?ne:ne.slice(0,Math.max(a[1],g));return Y(Y([],J(re.map(function(e,t){var a=hT[t];return{virtual:t>=h,horizontal:yT[t],vertical:0,pos:[r+e,i+(bT[t]===-1?n:0)],sub:!0,raw:F[t],direction:a}})),!1),J(ie.map(function(e,n){var a=hT[n];return{virtual:n>=g,horizontal:0,vertical:bT[n],pos:[r+(yT[n]===-1?t:0),i+e],sub:!0,raw:te[n],direction:a}})),!1)}function wT(e,t,n,r,i){i===void 0&&(i=t.length);var a=ST(e.slice(r)),o=a.horizontalRange,s=a.verticalRange,c=n-r,l=0;if(c===0)l=i;else if(c>0&&c<o[1])l=o[1]-c;else if(c>=s[0])l=s[0]+s[1]-c;else return;e.splice(n,l),t.splice(n,l)}function TT(e,t,n,r,i,a,o,s,c,l,u){l===void 0&&(l=0),u===void 0&&(u=0);var d=ST(e.slice(n)),f=d.horizontalRange,p=d.verticalRange;if(r>-1)for(var m=yT[r]===1?a-l:s-a,h=f[1];h<=r;++h){var g=bT[h]===1?u:c,_=0;if(r===h?_=a:h===0?_=l+m:yT[h]===-1&&(_=s-(t[n][0]-l)),e.splice(n+h,0,{horizontal:yT[h],vertical:0,pos:[_,g]}),t.splice(n+h,0,[_,g]),h===0)break}else if(i>-1){var v=bT[i]===1?o-u:c-o;if(f[1]===0&&p[1]===0){var y=[l+v,u];e.push({horizontal:yT[0],vertical:0,pos:y}),t.push(y)}for(var b=p[0],h=p[1];h<=i;++h){var _=yT[h]===1?l:s,g=0;if(i===h?g=o:h===0?g=u+v:bT[h]===1?g=t[n+b][1]:bT[h]===-1&&(g=c-(t[n+b][1]-u)),e.push({horizontal:0,vertical:bT[h],pos:[_,g]}),t.push([_,g]),h===0)break}}}function ET(e,t){return t===void 0&&(t=e.map(function(e){return e.raw})),{horizontals:e.map(function(e,n){return e.horizontal?t[n]:null}).filter(function(e){return e!=null}),verticals:e.map(function(e,n){return e.vertical?t[n]:null}).filter(function(e){return e!=null})}}var DT=[[0,-1,`n`],[1,0,`e`]],OT=[[-1,-1,`nw`],[0,-1,`n`],[1,-1,`ne`],[1,0,`e`],[1,1,`se`],[0,1,`s`],[-1,1,`sw`],[-1,0,`w`]];function kT(e,t,n){var r=e.props.clipRelative,i=e.state,a=i.width,o=i.height,s=t,c=s.type,l=s.poses,u=c===`rect`,d=c===`circle`;if(c===`polygon`)return n.map(function(e){return`${Aw(e[0],a,r)} ${Aw(e[1],o,r)}`});if(u||c===`inset`){var f=n[1][1],p=n[3][0],m=n[7][0],h=n[5][1];if(u)return[f,p,h,m].map(function(e){return`${e}px`});var g=[f,a-p,o-h,m].map(function(e,t){return Aw(e,t%2?a:o,r)});if(n.length>8){var _=J(K(n[4],n[0]),2),v=_[0],y=_[1];g.push.apply(g,Y([`round`],J(xT(l.slice(8).map(function(e,t){return q(q({},e),{pos:n[t]})}),r,v,y,m,f,p,h).styles),!1))}return g}else if(d||c===`ellipse`){var b=n[0],x=Aw(Q(n[1][1]-b[1]),d?Math.sqrt((a*a+o*o)/2):o,r),g=d?[x]:[Aw(Q(n[2][0]-b[0]),a,r),x];return g.push(`at`,Aw(b[0],a,r),Aw(b[1],o,r)),g}}function AT(e,t,n,r){var i=[r,(r+t)/2,t],a=[e,(e+n)/2,n];return OT.map(function(e){var t=J(e,3),n=t[0],r=t[1],o=t[2],s=i[n+1],c=a[r+1];return{vertical:Q(r),horizontal:Q(n),direction:o,pos:[s,c]}})}function jT(e){var t=[1/0,-1/0],n=[1/0,-1/0];return e.forEach(function(e){var r=e.pos;t[0]=Math.min(t[0],r[0]),t[1]=Math.max(t[1],r[0]),n[0]=Math.min(n[0],r[1]),n[1]=Math.max(n[1],r[1])}),[Q(t[1]-t[0]),Q(n[1]-n[0])]}function MT(e,t,n,r,i){var a,o,s,c,l,u,d,f,p;if(e){var m=i;if(!m){var h=px(e),g=h(`clipPath`);m=g===`none`?h(`clip`):g}if(!((!m||m===`none`||m===`auto`)&&(m=r,!m))){var _=h_(m),v=_.prefix,y=v===void 0?m:v,b=_.value,x=b===void 0?``:b,S=y===`circle`,C=` `;if(y===`polygon`){var w=m_(x||`0% 0%, 100% 0%, 100% 100%, 0% 100%`);C=`,`;var T=w.map(function(e){var r=J(e.split(` `),2),i=r[0],a=r[1];return{vertical:1,horizontal:1,pos:[w_(i,t),w_(a,n)]}}),E=iy(T.map(function(e){return e.pos}));return{type:y,clipText:m,poses:T,splitter:C,left:E.minX,right:E.maxX,top:E.minY,bottom:E.maxY}}else if(S||y===`ellipse`){var D=``,O=``,k=0,A=0,w=p_(x);if(S){var j=``;a=J(w,4),o=a[0],j=o===void 0?`50%`:o,s=a[2],D=s===void 0?`50%`:s,c=a[3],O=c===void 0?`50%`:c,k=w_(j,Math.sqrt((t*t+n*n)/2)),A=k}else{var M=``,N=``;l=J(w,5),u=l[0],M=u===void 0?`50%`:u,d=l[1],N=d===void 0?`50%`:d,f=l[3],D=f===void 0?`50%`:f,p=l[4],O=p===void 0?`50%`:p,k=w_(M,t),A=w_(N,n)}var ee=[w_(D,t),w_(O,n)],T=Y([{vertical:1,horizontal:1,pos:ee,direction:`nesw`}],J(DT.slice(0,S?1:2).map(function(e){return{vertical:Q(e[1]),horizontal:e[0],direction:e[2],sub:!0,pos:[ee[0]+e[0]*k,ee[1]+e[1]*A]}})),!1);return{type:y,clipText:m,radiusX:k,radiusY:A,left:ee[0]-k,top:ee[1]-A,right:ee[0]+k,bottom:ee[1]+A,poses:T,splitter:C}}else if(y===`inset`){var w=p_(x||`0 0 0 0`),P=w.indexOf(`round`),F=(P>-1?w.slice(0,P):w).length,te=w.slice(F+1),I=J(w.slice(0,F),4),ne=I[0],re=I[1],ie=re===void 0?ne:re,ae=I[2],oe=ae===void 0?ne:ae,se=I[3],ce=se===void 0?ie:se,L=J([ne,oe].map(function(e){return w_(e,n)}),2),le=L[0],ue=L[1],de=J([ce,ie].map(function(e){return w_(e,t)}),2),fe=de[0],pe=de[1],me=t-pe,he=n-ue,ge=CT(te,me-fe,he-le,fe,le),T=Y(Y([],J(AT(le,me,he,fe)),!1),J(ge),!1);return{type:`inset`,clipText:m,poses:T,top:le,left:fe,right:me,bottom:he,radius:te,splitter:C}}else if(y===`rect`){var w=m_(x||`0px, ${t}px, ${n}px, 0px`);C=`,`;var _e=J(w.map(function(e){return g_(e).value}),4),ve=_e[0],pe=_e[1],ue=_e[2],fe=_e[3],T=AT(ve,pe,ue,fe);return{type:`rect`,clipText:m,poses:T,top:ve,right:pe,bottom:ue,left:fe,values:w,splitter:C}}}}}function NT(e,t,n,r,i){var a=e[t],o=a.direction,s=a.sub,c=e.map(function(){return[0,0]}),l=o?o.split(``):[];if(r&&t<8){var u=l.filter(function(e){return e===`w`||e===`e`}),d=l.filter(function(e){return e===`n`||e===`s`}),f=u[0],p=d[0];c[t]=n;var m=J(jT(e),2),h=m[0],g=m[1],_=h&&g?h/g:0;if(_&&i){var v=e[(t+4)%8].pos,y=[0,0];o.indexOf(`w`)>-1?y[0]=-1:o.indexOf(`e`)>-1&&(y[0]=1),o.indexOf(`n`)>-1?y[1]=-1:o.indexOf(`s`)>-1&&(y[1]=1);var b=Bw([h,g],n,_,y,!0),x=h+b[0],S=g+b[1],C=v[1],w=v[1],T=v[0],E=v[0];y[0]===-1?T=E-x:y[0]===1?E=T+x:(T-=x/2,E+=x/2),y[1]===-1?C=w-S:(y[1]===1||(C=w-S/2),w=C+S);var D=AT(C,E,w,T);e.forEach(function(e,t){c[t][0]=D[t].pos[0]-e.pos[0],c[t][1]=D[t].pos[1]-e.pos[1]})}else e.forEach(function(e,t){var r=e.direction;r&&(r.indexOf(f)>-1&&(c[t][0]=n[0]),r.indexOf(p)>-1&&(c[t][1]=n[1]))}),f&&(c[1][0]=n[0]/2,c[5][0]=n[0]/2),p&&(c[3][1]=n[1]/2,c[7][1]=n[1]/2)}else o&&!s?l.forEach(function(t){var r=t===`n`||t===`s`;e.forEach(function(e,i){var a=e.direction,o=e.horizontal,s=e.vertical;!a||a.indexOf(t)===-1||(c[i]=[r||!o?0:n[0],!r||!s?0:n[1]])})}):c[t]=n;return c}function PT(e,t){var n=J(xb(e,t),2),r=n[0],i=n[1],a=t.datas,o=a.clipPath,s=a.clipIndex,c=o,l=c.type,u=c.poses,d=c.splitter,f=u.map(function(e){return e.pos});if(l===`polygon`)f.splice(s,0,[r,i]);else if(l===`inset`){var p=_T.indexOf(s),m=vT.indexOf(s),h=u.length;if(TT(u,f,8,p,m,r,i,f[4][0],f[4][1],f[0][0],f[0][1]),h===u.length)return}else return;var g=kT(e,o,f),_=`${l}(${g.join(d)})`;Z(e,`onClip`,gw(e,t,q({clipEventType:`added`,clipType:l,poses:f,clipStyles:g,clipStyle:_,distX:0,distY:0},mw({clipPath:_},t))))}function FT(e,t){var n=t.datas,r=n.clipPath,i=n.clipIndex,a=r,o=a.type,s=a.poses,c=a.splitter,l=s.map(function(e){return e.pos}),u=l.length;if(o===`polygon`)s.splice(i,1),l.splice(i,1);else if(o===`inset`){if(i<8||(wT(s,l,i,8,u),u===s.length))return}else return;var d=kT(e,r,l),f=`${o}(${d.join(c)})`;Z(e,`onClip`,gw(e,t,q({clipEventType:`removed`,clipType:o,poses:l,clipStyles:d,clipStyle:f,distX:0,distY:0},mw({clipPath:f},t))))}var IT={name:`clippable`,props:[`clippable`,`defaultClipPath`,`customClipPath`,`keepRatio`,`clipRelative`,`clipArea`,`dragWithClip`,`clipTargetBounds`,`clipVerticalGuidelines`,`clipHorizontalGuidelines`,`clipSnapThreshold`],events:[`clipStart`,`clip`,`clipEnd`],css:[`.control.clip-control {
330
- background: #6d6;
331
- cursor: pointer;
332
- }
333
- .control.clip-control.clip-radius {
334
- background: #d66;
335
- }
336
- .line.clip-line {
337
- background: #6e6;
338
- cursor: move;
339
- z-index: 1;
340
- }
341
- .clip-area {
342
- position: absolute;
343
- top: 0;
344
- left: 0;
345
- }
346
- .clip-ellipse {
347
- position: absolute;
348
- cursor: move;
349
- border: 1px solid #6d6;
350
- border: var(--zoompx) solid #6d6;
351
- border-radius: 50%;
352
- transform-origin: 0px 0px;
353
- }`,`:host {
354
- --bounds-color: #d66;
355
- }`,`.guideline {
356
- pointer-events: none;
357
- z-index: 2;
358
- }`,`.line.guideline.bounds {
359
- background: #d66;
360
- background: var(--bounds-color);
361
- }`],render:function(e,t){var n=e.props,r=n.customClipPath,i=n.defaultClipPath,a=n.clipArea,o=n.zoom,s=n.groupable,c=e.getState(),l=c.target,u=c.width,d=c.height,f=c.allMatrix,p=c.is3d,m=c.left,h=c.top,g=c.pos1,_=c.pos2,v=c.pos3,y=c.pos4,b=c.clipPathState,x=c.snapBoundInfos,S=c.rotation;if(!l||s)return[];var C=MT(l,u,d,i||`inset`,b||r);if(!C)return[];var w=p?4:3,T=C.type,E=C.poses.map(function(e){var t=WC(f,e.pos,w);return[t[0]-m,t[1]-h]}),D=[],O=[],k=T===`rect`,A=T===`inset`,j=T===`polygon`;if(k||A||j){var M=A?E.slice(0,8):E;O=M.map(function(e,n){var r=n===0?M[M.length-1]:M[n-1],i=A_(r,e),a=ZC(r,e);return t.createElement(`div`,{key:`clipLine${n}`,className:X(`line`,`clip-line`,`snap-control`),"data-clip-index":n,style:{width:`${a}px`,transform:`translate(${r[0]}px, ${r[1]}px) rotate(${i}rad) scaleY(${o})`}})})}if(D=E.map(function(e,n){return t.createElement(`div`,{key:`clipControl${n}`,className:X(`control`,`clip-control`,`snap-control`),"data-clip-index":n,style:{transform:`translate(${e[0]}px, ${e[1]}px) rotate(${S}rad) scale(${o})`}})}),A&&D.push.apply(D,Y([],J(E.slice(8).map(function(e,n){return t.createElement(`div`,{key:`clipRadiusControl${n}`,className:X(`control`,`clip-control`,`clip-radius`,`snap-control`),"data-clip-index":8+n,style:{transform:`translate(${e[0]}px, ${e[1]}px) rotate(${S}rad) scale(${o})`}})})),!1)),T===`circle`||T===`ellipse`){var N=C.left,ee=C.top,P=C.radiusX,F=C.radiusY,te=J(K(WC(f,[N,ee],w),WC(f,[0,0],w)),2),I=te[0],ne=te[1],re=`none`;if(!a){for(var ie=Math.max(10,P/5,F/5),ae=[],oe=0;oe<=ie;++oe){var se=Math.PI*2/ie*oe;ae.push([P+(P-o)*Math.cos(se),F+(F-o)*Math.sin(se)])}ae.push([P,-2]),ae.push([-2,-2]),ae.push([-2,F*2+2]),ae.push([P*2+2,F*2+2]),ae.push([P*2+2,-2]),ae.push([P,-2]),re=`polygon(${ae.map(function(e){return`${e[0]}px ${e[1]}px`}).join(`, `)})`}D.push(t.createElement(`div`,{key:`clipEllipse`,className:X(`clip-ellipse`,`snap-control`),style:{width:`${P*2}px`,height:`${F*2}px`,clipPath:re,transform:`translate(${-m+I}px, ${-h+ne}px) ${BC(f)}`}}))}if(a){var ce=KC(Y([g,_,v,y],J(E),!1)),L=ce.width,le=ce.height,ue=ce.left,de=ce.top;if(j||k||A){var ae=A?E.slice(0,8):E;D.push(t.createElement(`div`,{key:`clipArea`,className:X(`clip-area`,`snap-control`),style:{width:`${L}px`,height:`${le}px`,transform:`translate(${ue}px, ${de}px)`,clipPath:`polygon(${ae.map(function(e){return`${e[0]-ue}px ${e[1]-de}px`}).join(`, `)})`}}))}}return x&&[`vertical`,`horizontal`].forEach(function(e){var n=x[e],r=e===`horizontal`;n.isSnap&&O.push.apply(O,Y([],J(n.snap.posInfos.map(function(n,i){var a=n.pos;return bx(t,``,K(WC(f,r?[0,a]:[a,0],w),[m,h]),K(WC(f,r?[u,a]:[a,d],w),[m,h]),o,`clip${e}snap${i}`,`guideline`)})),!1)),n.isBound&&O.push.apply(O,Y([],J(n.bounds.map(function(n,i){var a=n.pos;return bx(t,``,K(WC(f,r?[0,a]:[a,0],w),[m,h]),K(WC(f,r?[u,a]:[a,d],w),[m,h]),o,`clip${e}bounds${i}`,`guideline`,`bounds`,`bold`)})),!1))}),Y(Y([],J(D),!1),J(O),!1)},dragControlCondition:function(e,t){return t.inputEvent&&(t.inputEvent.target.getAttribute(`class`)||``).indexOf(`clip`)>-1},dragStart:function(e,t){var n=e.props.dragWithClip;return n===void 0||n?!1:this.dragControlStart(e,t)},drag:function(e,t){return this.dragControl(e,q(q({},t),{isDragTarget:!0}))},dragEnd:function(e,t){return this.dragControlEnd(e,t)},dragControlStart:function(e,t){var n=e.state,r=e.props,i=r.defaultClipPath,a=r.customClipPath,o=n.target,s=n.width,c=n.height,l=t.inputEvent?t.inputEvent.target:null,u=l&&l.getAttribute(`class`)||``,d=t.datas,f=MT(o,s,c,i||`inset`,a);if(!f)return!1;var p=f.clipText,m=f.type,h=f.poses;return Z(e,`onClipStart`,gw(e,t,{clipType:m,clipStyle:p,poses:h.map(function(e){return e.pos})}))===!1?(d.isClipStart=!1,!1):(d.isControl=u&&u.indexOf(`clip-control`)>-1,d.isLine=u.indexOf(`clip-line`)>-1,d.isArea=u.indexOf(`clip-area`)>-1||u.indexOf(`clip-ellipse`)>-1,d.clipIndex=l?parseInt(l.getAttribute(`data-clip-index`),10):-1,d.clipPath=f,d.isClipStart=!0,n.clipPathState=p,Sb(e,t),!0)},dragControl:function(e,t){var n,r,i,a=t.datas,o=t.originalDatas,s=t.isDragTarget;if(!a.isClipStart)return!1;var c=a,l=c.isControl,u=c.isLine,d=c.isArea,f=c.clipIndex,p=c.clipPath;if(!p)return!1;var m=ew(e.props,`clippable`),h=m.keepRatio,g=0,_=0,v=o.draggable,y=kb(t);s&&v?(n=J(v.prevBeforeDist,2),g=n[0],_=n[1]):(r=J(y,2),g=r[0],_=r[1]);var b=[g,_],x=e.state,S=x.width,C=x.height,w=!d&&!l&&!u,T=p.type,E=p.poses,D=p.splitter,O=E.map(function(e){return e.pos});w&&(g=-g,_=-_);var k=!l||E[f].direction===`nesw`,A=T===`inset`||T===`rect`,j=E.map(function(){return[0,0]});if(l&&!k){var M=E[f],N=M.horizontal,ee=M.vertical;j=NT(E,f,[g*Q(N),_*Q(ee)],A,h)}else k&&(j=O.map(function(){return[g,_]}));var P=O.map(function(e,t){return sv(e,j[t])}),F=Y([],J(P),!1);x.snapBoundInfos=null;var te=p.type===`circle`,I=p.type===`ellipse`;if(te||I){var ne=KC(P),re=Q(ne.bottom-ne.top),ie=Q(I?ne.right-ne.left:re),ae=P[0][1]+re,oe=P[0][0]-ie,se=P[0][0]+ie;te&&(F.push([se,ne.bottom]),j.push([1,0])),F.push([ne.left,ae]),j.push([0,1]),F.push([oe,ne.bottom]),j.push([1,0])}var ce=sC((m.clipHorizontalGuidelines||[]).map(function(e){return w_(`${e}`,C)}),(m.clipVerticalGuidelines||[]).map(function(e){return w_(`${e}`,S)}),S,C),L=[],le=[];if(te||I)L=[F[4][0],F[2][0]],le=[F[1][1],F[3][1]];else if(A){var ue=[F[0],F[2],F[4],F[6]],de=[j[0],j[2],j[4],j[6]];L=ue.filter(function(e,t){return de[t][0]}).map(function(e){return e[0]}),le=ue.filter(function(e,t){return de[t][1]}).map(function(e){return e[1]})}else L=F.filter(function(e,t){return j[t][0]}).map(function(e){return e[0]}),le=F.filter(function(e,t){return j[t][1]}).map(function(e){return e[1]});var fe=[0,0],pe=DS(ce,m.clipTargetBounds&&{left:0,top:0,right:S,bottom:C},L,le,5,5),me=pe.horizontal,he=pe.vertical,ge=me.offset,_e=he.offset;if(me.isBound&&(fe[1]+=ge),he.isBound&&(fe[0]+=_e),(I||te)&&j[0][0]===0&&j[0][1]===0){var ne=KC(P),ve=ne.bottom-ne.top,ye=I?ne.right-ne.left:ve,be=he.isBound?Q(_e):he.snapIndex===0?-_e:_e,xe=me.isBound?Q(ge):me.snapIndex===0?-ge:ge;ye-=be,ve-=xe,te&&(ve=rS(he,me)>0?ve:ye,ye=ve);var Se=F[0];F[1][1]=Se[1]-ve,F[2][0]=Se[0]+ye,F[3][1]=Se[1]+ve,F[4][0]=Se[0]-ye}else if(A&&h&&l){var Ce=J(jT(E),2),we=Ce[0],Te=Ce[1],Ee=we&&Te?we/Te:0,De=E[f].direction||``,Oe=F[1][1],ae=F[5][1],oe=F[7][0],se=F[3][0];Q(ge)<=Q(_e)?ge=qw(ge)*Q(_e)/Ee:_e=qw(_e)*Q(ge)*Ee,De.indexOf(`w`)>-1?oe-=_e:De.indexOf(`e`)>-1?se-=_e:(oe+=_e/2,se-=_e/2),De.indexOf(`n`)>-1?Oe-=ge:De.indexOf(`s`)>-1?ae-=ge:(Oe+=ge/2,ae-=ge/2);var R=AT(Oe,se,ae,oe);F.forEach(function(e,t){var n=J(R[t].pos,2);e[0]=n[0],e[1]=n[1]})}else F.forEach(function(e,t){var n=j[t];n[0]&&(e[0]-=_e),n[1]&&(e[1]-=ge)});var ke=kT(e,p,P),Ae=`${T}(${ke.join(D)})`;if(x.clipPathState=Ae,te||I)L=[F[4][0],F[2][0]],le=[F[1][1],F[3][1]];else if(A){var ue=[F[0],F[2],F[4],F[6]];L=ue.map(function(e){return e[0]}),le=ue.map(function(e){return e[1]})}else L=F.map(function(e){return e[0]}),le=F.map(function(e){return e[1]});if(x.snapBoundInfos=DS(ce,m.clipTargetBounds&&{left:0,top:0,right:S,bottom:C},L,le,1,1),v){var je=x.is3d,Me=x.allMatrix,Ne=je?4:3,z=fe;s&&(z=[b[0]+fe[0]-y[0],b[1]+fe[1]-y[1]]),v.deltaOffset=ov(Me,[z[0],z[1],0,0],Ne)}return Z(e,`onClip`,gw(e,t,q({clipEventType:`changed`,clipType:T,poses:P,clipStyle:Ae,clipStyles:ke,distX:g,distY:_},mw((i={},i[T===`rect`?`clip`:`clipPath`]=Ae,i),t)))),!0},dragControlEnd:function(e,t){this.unset(e);var n=t.isDrag,r=t.datas,i=t.isDouble,a=r.isLine,o=r.isClipStart,s=r.isControl;return o?(Z(e,`onClipEnd`,_w(e,t,{})),i&&(s?FT(e,t):a&&PT(e,t)),i||n):!1},unset:function(e){e.state.clipPathState=``,e.state.snapBoundInfos=null}},LT={name:`originDraggable`,props:[`originDraggable`,`originRelative`],events:[`dragOriginStart`,`dragOrigin`,`dragOriginEnd`],css:[`:host[data-able-origindraggable] .control.origin {
362
- pointer-events: auto;
363
- }`],dragControlCondition:function(e,t){return t.isRequest?t.requestAble===`originDraggable`:R_(t.inputEvent.target,X(`origin`))},dragControlStart:function(e,t){var n=t.datas;Sb(e,t);var r=gw(e,t,{dragStart:NS.dragStart(e,new yb().dragStart([0,0],t))}),i=Z(e,`onDragOriginStart`,r);return n.startOrigin=e.state.transformOrigin,n.startTargetOrigin=e.state.targetOrigin,n.prevOrigin=[0,0],n.isDragOrigin=!0,i===!1?(n.isDragOrigin=!1,!1):r},dragControl:function(e,t){var n=t.datas,r=t.isPinch,i=t.isRequest;if(!n.isDragOrigin)return!1;var a=J(kb(t),2),o=a[0],s=a[1],c=e.state,l=c.width,u=c.height,d=c.offsetMatrix,f=c.targetMatrix,p=c.is3d,m=e.props.originRelative,h=m===void 0?!0:m,g=p?4:3,_=[o,s];if(i){var v=t.distOrigin;(v[0]||v[1])&&(_=v)}var y=sv(n.startOrigin,_),b=sv(n.startTargetOrigin,_),x=K(_,n.prevOrigin),S=Lb(d,f,y,g),C=e.getRect(),w=KC(GC(S,l,u,g)),T=[C.left-w.left,C.top-w.top];n.prevOrigin=_;var E=[Aw(b[0],l,h),Aw(b[1],u,h)].join(` `),D=NS.drag(e,vb(t,e.state,T,!!r,!1)),O=gw(e,t,q(q({width:l,height:u,origin:y,dist:_,delta:x,transformOrigin:E,drag:D},mw({transformOrigin:E,transform:D.transform},t)),{afterTransform:D.transform}));return Z(e,`onDragOrigin`,O),O},dragControlEnd:function(e,t){return t.datas.isDragOrigin?(Z(e,`onDragOriginEnd`,_w(e,t,{})),!0):!1},dragGroupControlCondition:function(e,t){return this.dragControlCondition(e,t)},dragGroupControlStart:function(e,t){return!!this.dragControlStart(e,t)},dragGroupControl:function(e,t){var n=this.dragControl(e,t);return n?(e.transformOrigin=n.transformOrigin,!0):!1},request:function(e){var t={},n=e.getRect(),r=0,i=0,a=n.transformOrigin,o=[0,0];return{isControl:!0,requestStart:function(){return{datas:t}},request:function(e){return`deltaOrigin`in e?(o[0]+=e.deltaOrigin[0],o[1]+=e.deltaOrigin[1]):`origin`in e?(o[0]=e.origin[0]-a[0],o[1]=e.origin[1]-a[1]):(`x`in e?r=e.x-n.left:`deltaX`in e&&(r+=e.deltaX),`y`in e?i=e.y-n.top:`deltaY`in e&&(i+=e.deltaY)),{datas:t,distX:r,distY:i,distOrigin:o}},requestEnd:function(){return{datas:t,isDrag:!0}}}}};function RT(e,t,n,r){var i=e.filter(function(e){var t=e.virtual;return e.horizontal&&!t}).length,a=e.filter(function(e){var t=e.virtual;return e.vertical&&!t}).length,o=-1;if(t===0&&(i===0?o=0:i===1&&(o=1)),t===2&&(i<=2?o=2:i<=3&&(o=3)),t===3&&(a===0?o=4:a<4&&(o=7)),t===1&&(a<=1?o=5:a<=2&&(o=6)),!(o===-1||!e[o].virtual)){var s=e[o];zT(e,o),o<4?s.pos[0]=n:s.pos[1]=r}}function zT(e,t){t<4?e.slice(0,t+1).forEach(function(e){e.virtual=!1}):(e[0].virtual&&(e[0].virtual=!1),e.slice(4,t+1).forEach(function(e){e.virtual=!1}))}function BT(e,t){t<4?e.slice(t,4).forEach(function(e){e.virtual=!0}):e.slice(t).forEach(function(e){e.virtual=!0})}function VT(e,t,n,r,i){r===void 0&&(r=[0,0]);var a=[];return a=!e||e===`0px`?[]:p_(e),CT(a,t,n,0,0,r,i)}function HT(e,t,n,r,i){var a=e.state,o=a.width,s=a.height,c=xT(i,e.props.roundRelative,o,s),l=c.raws,u=c.styles,d=c.radiusPoses,f=ET(d,l),p=f.horizontals,m=f.verticals,h=u.join(` `);a.borderRadiusState=h;var g=gw(e,t,q({horizontals:p,verticals:m,borderRadius:h,width:o,height:s,delta:r,dist:n},mw({borderRadius:h},t)));return Z(e,`onRound`,g),g}function UT(e){var t=e.getState().style,n=t.borderRadius||``;if(!n&&e.props.groupable){var r=e.moveables[0],i=e.getTargets()[0];i&&(r?.props.target===i?(n=e.moveables[0]?.state.style.borderRadius??``,t.borderRadius=n):(n=yw(i).borderRadius,t.borderRadius=n))}return n}var WT={name:`roundable`,props:[`roundable`,`roundRelative`,`minRoundControls`,`maxRoundControls`,`roundClickable`,`roundPadding`,`isDisplayShadowRoundControls`],events:[`roundStart`,`round`,`roundEnd`,`roundGroupStart`,`roundGroup`,`roundGroupEnd`],css:[`.control.border-radius {
364
- background: #d66;
365
- cursor: pointer;
366
- z-index: 3;
367
- }`,`.control.border-radius.vertical {
368
- background: #d6d;
369
- z-index: 2;
370
- }`,`.control.border-radius.virtual {
371
- opacity: 0.5;
372
- z-index: 1;
373
- }`,`:host.round-line-clickable .line.direction {
374
- cursor: pointer;
375
- }`],className:function(e){var t=e.props.roundClickable;return t===!0||t===`line`?X(`round-line-clickable`):``},requestStyle:function(){return[`borderRadius`]},requestChildStyle:function(){return[`borderRadius`]},render:function(e,t){var n=e.getState(),r=n.target,i=n.width,a=n.height,o=n.allMatrix,s=n.is3d,c=n.left,l=n.top,u=n.borderRadiusState,d=e.props,f=d.minRoundControls,p=f===void 0?[0,0]:f,m=d.maxRoundControls,h=m===void 0?[4,4]:m,g=d.zoom,_=d.roundPadding,v=_===void 0?0:_,y=d.isDisplayShadowRoundControls,b=d.groupable;if(!r)return null;var x=u||UT(e),S=s?4:3,C=VT(x,i,a,p,!0);if(!C)return null;var w=0,T=0,E=b?[0,0]:[c,l];return C.map(function(e,n){var r=e.horizontal,i=e.vertical,a=e.direction||``,s=Y([],J(e.pos),!1);T+=Math.abs(r),w+=Math.abs(i),r&&a.indexOf(`n`)>-1&&(s[1]-=v),i&&a.indexOf(`w`)>-1&&(s[0]-=v),r&&a.indexOf(`s`)>-1&&(s[1]+=v),i&&a.indexOf(`e`)>-1&&(s[0]+=v);var c=K(WC(o,s,S),E),l=y&&y!==`horizontal`,u=e.vertical?w<=h[1]&&(l||!e.virtual):T<=h[0]&&(y||!e.virtual);return t.createElement(`div`,{key:`borderRadiusControl${n}`,className:X(`control`,`border-radius`,e.vertical?`vertical`:``,e.virtual?`virtual`:``),"data-radius-index":n,style:{display:u?`block`:`none`,transform:`translate(${c[0]}px, ${c[1]}px) scale(${g})`}})})},dragControlCondition:function(e,t){if(!t.inputEvent||t.isRequest)return!1;var n=t.inputEvent.target.getAttribute(`class`)||``;return n.indexOf(`border-radius`)>-1||n.indexOf(`moveable-line`)>-1&&n.indexOf(`moveable-direction`)>-1},dragGroupControlCondition:function(e,t){return this.dragControlCondition(e,t)},dragControlStart:function(e,t){var n=t.inputEvent,r=t.datas,i=n.target,a=i.getAttribute(`class`)||``,o=a.indexOf(`border-radius`)>-1,s=a.indexOf(`moveable-line`)>-1&&a.indexOf(`moveable-direction`)>-1,c=o?parseInt(i.getAttribute(`data-radius-index`),10):-1,l=-1;if(s){var u=i.getAttribute(`data-line-key`)||``;u&&(l=parseInt(u.replace(/render-line-/g,``),10),isNaN(l)&&(l=-1))}if(!o&&!s)return!1;var d=gw(e,t,{});if(Z(e,`onRoundStart`,d)===!1)return!1;r.lineIndex=l,r.controlIndex=c,r.isControl=o,r.isLine=s,Sb(e,t);var f=e.props,p=f.roundRelative,m=f.minRoundControls,h=m===void 0?[0,0]:m,g=e.state,_=g.width,v=g.height;r.isRound=!0,r.prevDist=[0,0];var y=VT(UT(e)||``,_,v,h,!0)||[];return r.controlPoses=y,g.borderRadiusState=xT(y,p,_,v).styles.join(` `),d},dragControl:function(e,t){var n=t.datas,r=n.controlPoses;if(!n.isRound||!n.isControl||!r.length)return!1;var i=n.controlIndex,a=J(kb(t),2),o=a[0],s=a[1],c=[o,s],l=K(c,n.prevDist),u=e.props.maxRoundControls,d=u===void 0?[4,4]:u,f=e.state,p=f.width,m=f.height,h=r[i],g=h.vertical,_=h.horizontal,v=r.map(function(e){var t=e.horizontal,n=e.vertical,r=[t*_*c[0],n*g*c[1]];if(t){if(d[0]===1||d[0]<4&&t!==_)return r}else if(d[1]===0)return r[1]=n*_*c[0]/p*m,r;else if(g&&(d[1]===1||d[1]<4&&n!==g))return r;return[0,0]});v[i]=c;var y=r.map(function(e,t){return q(q({},e),{pos:sv(e.pos,v[t])})});return i<4?y.slice(0,i+1).forEach(function(e){e.virtual=!1}):y.slice(4,i+1).forEach(function(e){e.virtual=!1}),n.prevDist=[o,s],HT(e,t,c,l,y)},dragControlEnd:function(e,t){var n=e.state;n.borderRadiusState=``;var r=t.datas,i=t.isDouble;if(!r.isRound)return!1;var a=r.isControl,o=r.controlIndex,s=r.isLine,c=r.lineIndex,l=r.controlPoses,u=l.filter(function(e){return e.virtual}).length,d=e.props.roundClickable,f=d===void 0?!0:d;if(i&&f){if(a&&(f===!0||f===`control`))BT(l,o);else if(s&&(f===!0||f===`line`)){var p=J(xb(e,t),2),m=p[0],h=p[1];RT(l,c,m,h)}u!==l.filter(function(e){return e.virtual}).length&&HT(e,t,[0,0],[0,0],l)}var g=_w(e,t,{});return Z(e,`onRoundEnd`,g),n.borderRadiusState=``,g},dragGroupControlStart:function(e,t){var n=this.dragControlStart(e,t);if(!n)return!1;var r=e.moveables,i=e.props.targets,a=mx(e,`roundable`,t);return Z(e,`onRoundGroupStart`,q({targets:e.props.targets,events:a.map(function(e,t){return q(q({},e),{target:i[t],moveable:r[t],currentTarget:r[t]})})},n)),n},dragGroupControl:function(e,t){var n=this.dragControl(e,t);if(!n)return!1;var r=e.moveables,i=e.props.targets,a=mx(e,`roundable`,t),o=q({targets:e.props.targets,events:a.map(function(e,t){return q(q(q({},e),{target:i[t],moveable:r[t],currentTarget:r[t]}),mw({borderRadius:n.borderRadius},e))})},n);return Z(e,`onRoundGroup`,o),o},dragGroupControlEnd:function(e,t){var n=e.moveables,r=e.props.targets,i=mx(e,`roundable`,t);vw(e,`onRound`,function(t){Z(e,`onRoundGroup`,q({targets:e.props.targets,events:i.map(function(e,i){return q(q(q({},e),{target:r[i],moveable:n[i],currentTarget:n[i]}),mw({borderRadius:t.borderRadius},e))})},t))});var a=this.dragControlEnd(e,t);if(!a)return!1;var o=q({targets:e.props.targets,events:i.map(function(e,t){return q(q({},e),{target:r[t],moveable:n[t],currentTarget:n[t],lastEvent:e.datas?.lastEvent})})},a);return Z(e,`onRoundGroupEnd`,o),o},unset:function(e){e.state.borderRadiusState=``}};function GT(e,t){var n=yv(t?4:3);return e===`matrix${t?`3d`:``}(${n.join(`,`)})`||e===`matrix(1,0,0,1,0,0)`}var KT={isPinch:!0,name:`beforeRenderable`,props:[],events:[`beforeRenderStart`,`beforeRender`,`beforeRenderEnd`,`beforeRenderGroupStart`,`beforeRenderGroup`,`beforeRenderGroupEnd`],dragRelation:`weak`,setTransform:function(e,t){var n=e.state,r=n.is3d,i=n.targetMatrix,a=n.inlineTransform,o=r?`matrix3d(${i.join(`,`)})`:`matrix(${lv(i,!0)})`,s=!a||a===`none`?o:a;t.datas.startTransforms=GT(s,r)?[]:p_(s)},resetStyle:function(e){var t=e.datas;t.nextStyle={},t.nextTransforms=e.datas.startTransforms,t.nextTransformAppendedIndexes=[]},fillDragStartParams:function(e,t){return gw(e,t,{setTransform:function(e){t.datas.startTransforms=i_(e)?e:p_(e)},isPinch:!!t.isPinch})},fillDragParams:function(e,t){return gw(e,t,{isPinch:!!t.isPinch})},dragStart:function(e,t){this.setTransform(e,t),this.resetStyle(t),Z(e,`onBeforeRenderStart`,this.fillDragStartParams(e,t))},drag:function(e,t){t.datas.startTransforms||this.setTransform(e,t),this.resetStyle(t),Z(e,`onBeforeRender`,gw(e,t,{isPinch:!!t.isPinch}))},dragEnd:function(e,t){t.datas.startTransforms||(this.setTransform(e,t),this.resetStyle(t)),Z(e,`onBeforeRenderEnd`,gw(e,t,{isPinch:!!t.isPinch,isDrag:t.isDrag}))},dragGroupStart:function(e,t){var n=this;this.dragStart(e,t);var r=mx(e,`beforeRenderable`,t),i=e.moveables,a=r.map(function(e,t){var r=i[t];return n.setTransform(r,e),n.resetStyle(e),n.fillDragStartParams(r,e)});Z(e,`onBeforeRenderGroupStart`,gw(e,t,{isPinch:!!t.isPinch,targets:e.props.targets,setTransform:function(){},events:a}))},dragGroup:function(e,t){var n=this;this.drag(e,t);var r=mx(e,`beforeRenderable`,t),i=e.moveables,a=r.map(function(e,t){var r=i[t];return n.resetStyle(e),n.fillDragParams(r,e)});Z(e,`onBeforeRenderGroup`,gw(e,t,{isPinch:!!t.isPinch,targets:e.props.targets,events:a}))},dragGroupEnd:function(e,t){this.dragEnd(e,t),Z(e,`onBeforeRenderGroupEnd`,gw(e,t,{isPinch:!!t.isPinch,isDrag:t.isDrag,targets:e.props.targets}))},dragControlStart:function(e,t){return this.dragStart(e,t)},dragControl:function(e,t){return this.drag(e,t)},dragControlEnd:function(e,t){return this.dragEnd(e,t)},dragGroupControlStart:function(e,t){return this.dragGroupStart(e,t)},dragGroupControl:function(e,t){return this.dragGroup(e,t)},dragGroupControlEnd:function(e,t){return this.dragGroupEnd(e,t)}},qT={name:`renderable`,props:[],events:[`renderStart`,`render`,`renderEnd`,`renderGroupStart`,`renderGroup`,`renderGroupEnd`],dragRelation:`weak`,dragStart:function(e,t){Z(e,`onRenderStart`,gw(e,t,{isPinch:!!t.isPinch}))},drag:function(e,t){Z(e,`onRender`,this.fillDragParams(e,t))},dragAfter:function(e,t){return this.drag(e,t)},dragEnd:function(e,t){Z(e,`onRenderEnd`,this.fillDragEndParams(e,t))},dragGroupStart:function(e,t){Z(e,`onRenderGroupStart`,gw(e,t,{isPinch:!!t.isPinch,targets:e.props.targets}))},dragGroup:function(e,t){var n=this,r=mx(e,`beforeRenderable`,t),i=e.moveables,a=r.map(function(e,t){var r=i[t];return n.fillDragParams(r,e)});Z(e,`onRenderGroup`,gw(e,t,q(q({isPinch:!!t.isPinch,targets:e.props.targets,transform:Kb(t),transformObject:{}},mw(qb(t))),{events:a})))},dragGroupEnd:function(e,t){var n=this,r=mx(e,`beforeRenderable`,t),i=e.moveables,a=r.map(function(e,t){var r=i[t];return n.fillDragEndParams(r,e)});Z(e,`onRenderGroupEnd`,gw(e,t,q({isPinch:!!t.isPinch,isDrag:t.isDrag,targets:e.props.targets,events:a,transformObject:{},transform:Kb(t)},mw(qb(t)))))},dragControlStart:function(e,t){return this.dragStart(e,t)},dragControl:function(e,t){return this.drag(e,t)},dragControlAfter:function(e,t){return this.dragAfter(e,t)},dragControlEnd:function(e,t){return this.dragEnd(e,t)},dragGroupControlStart:function(e,t){return this.dragGroupStart(e,t)},dragGroupControl:function(e,t){return this.dragGroup(e,t)},dragGroupControlEnd:function(e,t){return this.dragGroupEnd(e,t)},fillDragParams:function(e,t){var n={};return Ov(Gb(t)||[]).forEach(function(e){n[e.name]=e.functionValue}),gw(e,t,q({isPinch:!!t.isPinch,transformObject:n,transform:Kb(t)},mw(qb(t))))},fillDragEndParams:function(e,t){var n={};return Ov(Gb(t)||[]).forEach(function(e){n[e.name]=e.functionValue}),gw(e,t,q({isPinch:!!t.isPinch,isDrag:t.isDrag,transformObject:n,transform:Kb(t)},mw(qb(t))))}};function JT(e,t,n,r,i,a,o){a.clientDistX=a.distX,a.clientDistY=a.distY;var s=i===`Start`,c=i===`End`,l=i===`After`,u=e.state.target,d=a.isRequest,f=r.indexOf(`Control`)>-1;if(!u||s&&f&&!d&&e.areaElement===a.inputEvent.target)return!1;var p=Y([],J(t),!1);if(d){var m=a.requestAble;p.some(function(e){return e.name===m})||p.push.apply(p,Y([],J(e.props.ables.filter(function(e){return e.name===m})),!1))}if(!p.length||p.every(function(e){return e.dragRelation}))return!1;var h=a.inputEvent,g;c&&h&&(g=document.elementFromPoint(a.clientX,a.clientY)||h.target);var _=!1,v=function(){var e;_=!0,(e=a.stop)==null||e.call(a)},y=s&&(!e.targetGesto||!e.controlGesto||!e.targetGesto.isFlag()||!e.controlGesto.isFlag());y&&e.updateRect(i,!0,!1);var b=a.datas,x=f?`controlGesto`:`targetGesto`,S=e[x],C=function(t,n,r){if(!(n in t)||S!==e[x])return!1;var i=t.name,o=b[i]||(b[i]={});if(s&&(o.isEventStart=!r||!t[r]||t[r](e,a)),!o.isEventStart)return!1;var c=t[n](e,q(q({},a),{stop:v,datas:o,originalDatas:b,inputTarget:g}));return e._emitter.off(),s&&c===!1&&(o.isEventStart=!1),c};y&&p.forEach(function(t){t.unset&&t.unset(e)}),C(KT,`drag${r}${i}`);var w=0,T=0;n.forEach(function(t){if(_)return!1;var n=`${t}${r}${i}`,o=`${t}${r}Condition`;i===``&&!d&&Ow(e.state,a);var c=p.filter(function(e){return e[n]});c=c.filter(function(e,t){return e.name&&c.indexOf(e)===t});var l=c.filter(function(e){return C(e,n,o)}).length;_&&++w,l&&++T,!_&&s&&c.length&&!l&&(w+=+!!c.filter(function(e){return b[e.name].isEventStart?e.dragRelation!==`strong`:!1}).length)}),(!l||T)&&C(qT,`drag${r}${i}`);var E=S!==e[x]||w===n.length;return(c||_||E)&&(e.state.gestos={},e.moveables&&e.moveables.forEach(function(e){e.state.gestos={}}),p.forEach(function(t){t.unset&&t.unset(e)})),s&&!E&&!d&&T&&e.props.preventDefault&&a?.preventDefault(),e.isUnmounted||E?!1:((!s&&T&&!o||c)&&(e.props.flushSync||DC)(function(){e.updateRect(c?i:``,!0,!1),e.forceUpdate()}),!s&&!c&&!l&&T&&!o&&JT(e,t,n,r,i+`After`,a),!0)}function YT(e,t){return function(n,r){r===void 0&&(r=n.inputEvent.target);var i=r,a=e.areaElement,o=e._dragTarget;return!o||!t&&e.controlGesto?.isFlag()?!1:i===o||o.contains(i)||i===a||!e.isMoveableElement(i)&&!e.controlBox.contains(i)||R_(i,`moveable-area`)||R_(i,`moveable-padding`)||R_(i,`moveable-edgeDraggable`)}}function XT(e,t,n){var r=e.controlBox,i=[],a=e.props,o=a.dragArea,s=e.state.target,c=a.dragTarget;i.push(r),(!o||c)&&i.push(t),!o&&c&&s&&t!==s&&a.dragTargetSelf&&i.push(s);var l=YT(e);return QT(e,i,`targetAbles`,n,{dragStart:l,pinchStart:l})}function ZT(e,t){var n=e.controlBox,r=[];r.push(n);var i=YT(e,!0),a=function(e,t){return t===void 0&&(t=e.inputEvent.target),t===n?!0:!i(e,t)};return QT(e,r,`controlAbles`,t,{dragStart:a,pinchStart:a})}function QT(e,t,n,r,i){i===void 0&&(i={});var a=n===`targetAbles`,o=e.props,s=o.pinchOutside,c=o.pinchThreshold,l=o.preventClickEventOnDrag,u=o.preventClickDefault,d=o.checkInput,f=o.dragFocusedInput,p=o.preventDefault,m=p===void 0?!0:p,h=o.preventRightClick,g=h===void 0?!0:h,_=o.preventWheelClick,v=_===void 0?!0:_,y=o.dragContainer,b=new Oy(t,{preventDefault:m,preventRightClick:g,preventWheelClick:v,container:Iw(y,!0)||K_(e.getControlBoxElement()),pinchThreshold:c,pinchOutside:s,preventClickEventOnDrag:a?l:!1,preventClickEventOnDragStart:a?u:!1,preventClickEventByCondition:a?null:function(t){return e.controlBox.contains(t.target)},checkInput:a?d:!1,dragFocusedInput:f}),x=r===`Control`;return[`drag`,`pinch`].forEach(function(t){[`Start`,``,`End`].forEach(function(a){b.on(`${t}${a}`,function(o){var s,c=o.eventType,l=t===`drag`&&o.isPinch;if(i[c]&&!i[c](o)){o.stop();return}if(!l){var u=t===`drag`?[t]:[`drag`,t];JT(e,Y([],J(e[n]),!1),u,r,a,o)?(e.props.stopPropagation||a===`Start`&&x)&&((s=o?.inputEvent)==null||s.stopPropagation()):o.stop()}})})}),b}var $T=function(){function e(e,t,n){var r=this;this.target=e,this.moveable=t,this.eventName=n,this.ables=[],this._onEvent=function(e){var t=r.eventName,n=r.moveable;n.state.disableNativeEvent||r.ables.forEach(function(r){r[t](n,{inputEvent:e})})},e.addEventListener(n.toLowerCase(),this._onEvent)}return e.prototype.setAbles=function(e){this.ables=e},e.prototype.destroy=function(){this.target.removeEventListener(this.eventName.toLowerCase(),this._onEvent),this.target=null,this.moveable=null},e}();function eE(e,t,n,r){n===void 0&&(n=t);var i=ox(e,t),a=i.matrixes,o=i.is3d,s=i.targetMatrix,c=i.transformOrigin,l=i.targetOrigin,u=i.offsetContainer,d=i.hasFixed,f=i.zoom,p=fx(u,n),m=p.matrixes,h=p.is3d,g=p.offsetContainer,_=p.zoom,v=r||h||o,y=v?4:3,b=e.tagName.toLowerCase()!==`svg`&&`ownerSVGElement`in e,x=s,S=yv(y),C=yv(y),w=yv(y),T=yv(y),E=a.length,D=m.map(function(e){return q(q({},e),{matrix:e.matrix?Y([],J(e.matrix),!1):void 0})}).reverse();a.reverse(),!o&&v&&(x=iv(x,3,4),RC(a)),!h&&v&&RC(D),D.forEach(function(e){C=ov(C,e.matrix,y)});var O=n||G_(e),k=D[0]?.target||FC(O,O,!0).offsetParent,A=D.slice(1).reduce(function(e,t){return ov(e,t.matrix,y)},yv(y));a.forEach(function(e,t){if(E-2===t&&(w=S.slice()),E-1===t&&(T=S.slice()),!e.matrix){var n=a[t+1];e.matrix=xv(JC(e,n,k,y,ov(A,S,y)),y)}S=ov(S,e.matrix,y)});var j=!b&&o;x||=yv(j?4:3);var M=BC(b&&x.length===16?iv(x,4,3):x,j),N=C;return C=Q_(C,y,y),{hasZoom:f!==1||_!==1,hasFixed:d,matrixes:a,rootMatrix:C,originalRootMatrix:N,beforeMatrix:w,offsetMatrix:T,allMatrix:S,targetMatrix:x,targetTransform:M,inlineTransform:e.style.transform,transformOrigin:c,targetOrigin:l,is3d:v,offsetContainer:u,offsetRootContainer:g}}function tE(e,t,n,r){n===void 0&&(n=t);var i=0,a=0,o=0,s={},c=tw(e);if(e&&(i=c.offsetWidth,a=c.offsetHeight),e){var l=eE(e,t,n,r),u=bb(l.allMatrix,l.transformOrigin,i,a);s=q(q({},l),u);var d=bb(l.allMatrix,[50,50],100,100);o=nw([d.pos1,d.pos2],d.direction)}var f=r?4:3;return q(q(q({hasZoom:!1,width:i,height:a,rotation:o},c),{originalRootMatrix:yv(f),rootMatrix:yv(f),beforeMatrix:yv(f),offsetMatrix:yv(f),allMatrix:yv(f),targetMatrix:yv(f),targetTransform:``,inlineTransform:``,transformOrigin:[0,0],targetOrigin:[0,0],is3d:!!r,left:0,top:0,right:0,bottom:0,origin:[0,0],pos1:[0,0],pos2:[0,0],pos3:[0,0],pos4:[0,0],direction:1,hasFixed:!1,offsetContainer:null,offsetRootContainer:null,matrixes:[]}),s)}function nE(e,t,n,r,i,a){a===void 0&&(a=[]);var o=1,s=[0,0],c=rw(),l=rw(),u=rw(),d=rw(),f=[0,0],p={},m=tE(t,n,i,!0);if(t){var h=px(t);a.forEach(function(e){p[e]=h(e)});var g=m.is3d?4:3,_=bb(m.offsetMatrix,sv(m.transformOrigin,tv(m.targetMatrix,g)),m.width,m.height);o=_.direction,s=sv(_.origin,[_.left-m.left,_.top-m.top]),d=ow(m.offsetRootContainer);var v=FC(r,r,!0).offsetParent||m.offsetRootContainer;if(m.hasZoom){var y=bb(ov(m.originalRootMatrix,m.allMatrix),m.transformOrigin,m.width,m.height),b=bb(m.originalRootMatrix,MC(px(v)(`transformOrigin`)).map(function(e){return parseFloat(e)}),v.offsetWidth,v.offsetHeight);if(c=aw(y,d),u=aw(b,d,v,!0),e){var x=y.left,S=y.top;l=aw({left:x,top:S,bottom:S,right:S},d)}}else{c=ow(t),u=dx(v),e&&(l=ow(e));var C=u.left,w=u.top,T=u.clientLeft,E=u.clientTop,D=[c.left-C,c.top-w];f=K(Dw(m.rootMatrix,D,4),[T+m.left,E+m.top])}}return q({targetClientRect:c,containerClientRect:u,moveableClientRect:l,rootContainerClientRect:d,beforeDirection:o,beforeOrigin:s,originalBeforeOrigin:s,target:t,style:p,offsetDelta:f},m)}function rE(e){var t=e.pos1,n=e.pos2,r=e.pos3,i=e.pos4;if(!t||!n||!r||!i)return null;var a=iy([t,n,r,i]),o=[a.minX,a.minY],s=K(e.origin,o);return t=K(t,o),n=K(n,o),r=K(r,o),i=K(i,o),q(q({},e),{left:e.left,top:e.top,posDelta:o,pos1:t,pos2:n,pos3:r,pos4:i,origin:s,beforeOrigin:s,isPersisted:!0})}var iE=function(e){By(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.state=q({container:null,gestos:{},renderLines:[[[0,0],[0,0]],[[0,0],[0,0]],[[0,0],[0,0]],[[0,0],[0,0]]],renderPoses:[[0,0],[0,0],[0,0],[0,0]],disableNativeEvent:!1,posDelta:[0,0]},nE(null)),t.renderState={},t.enabledAbles=[],t.targetAbles=[],t.controlAbles=[],t.rotation=0,t.scale=[1,1],t.isMoveableMounted=!1,t.isUnmounted=!1,t.events={mouseEnter:null,mouseLeave:null},t._emitter=new Wv,t._prevOriginalDragTarget=null,t._originalDragTarget=null,t._prevDragTarget=null,t._dragTarget=null,t._prevPropTarget=null,t._propTarget=null,t._prevDragArea=!1,t._isPropTargetChanged=!1,t._hasFirstTarget=!1,t._reiszeObserver=null,t._observerId=0,t._mutationObserver=null,t._rootContainer=null,t._viewContainer=null,t._viewClassNames=[],t._store={},t.checkUpdateRect=function(){if(!t.isDragging()){var e=t.props.parentMoveable;if(e){e.checkUpdateRect();return}S_(t._observerId),t._observerId=x_(function(){t.isDragging()||t.updateRect()})}},t._onPreventClick=function(e){e.stopPropagation(),e.preventDefault()},t}return t.prototype.render=function(){var e=this.props,t=this.getState(),n=e.parentPosition,r=e.className,i=e.target,a=e.zoom,o=e.cspNonce,s=e.translateZ,c=e.cssStyled,l=e.groupable,u=e.linePadding,d=e.controlPadding;this._checkUpdateRootContainer(),this.checkUpdate(),this.updateRenderPoses();var f=J(n||[0,0],2),p=f[0],m=f[1],h=t.left,g=t.top,_=t.target,v=t.direction,y=t.hasFixed,b=t.offsetDelta,x=e.targets,S=this.isDragging(),C={};this.getEnabledAbles().forEach(function(e){C[`data-able-${e.name.toLowerCase()}`]=!0});var w=this._getAbleClassName(),T=x&&x.length&&(_||l)||i||!this._hasFirstTarget&&this.state.isPersisted,E=this.controlBox||this.props.firstRenderState||this.props.persistData,D=[h-p,g-m];!l&&e.useAccuratePosition&&(D[0]+=b[0],D[1]+=b[1]);var O={position:y?`fixed`:`absolute`,display:T?`block`:`none`,visibility:E?`visible`:`hidden`,transform:`translate3d(${D[0]}px, ${D[1]}px, ${s})`,"--zoom":a,"--zoompx":`${a}px`};return u&&(O[`--moveable-line-padding`]=u),d&&(O[`--moveable-control-padding`]=d),U.createElement(c,q({cspNonce:o,ref:Hg(this,`controlBox`),className:`${X(`control-box`,v===-1?`reverse`:``,S?`dragging`:``)} ${w} ${r}`},C,{onClick:this._onPreventClick,style:O}),this.renderAbles(),this._renderLines())},t.prototype.componentDidMount=function(){this.isMoveableMounted=!0,this.isUnmounted=!1;var e=this.props,t=e.parentMoveable,n=e.container;this._checkUpdateRootContainer(),this._checkUpdateViewContainer(),this._updateTargets(),this._updateNativeEvents(),this._updateEvents(),this.updateCheckInput(),this._updateObserver(this.props),!n&&!t&&!this.state.isPersisted&&(this.updateRect(``,!1,!1),this.forceUpdate())},t.prototype.componentDidUpdate=function(e){this._checkUpdateRootContainer(),this._checkUpdateViewContainer(),this._updateNativeEvents(),this._updateTargets(),this._updateEvents(),this.updateCheckInput(),this._updateObserver(e)},t.prototype.componentWillUnmount=function(){var e,t;this.isMoveableMounted=!1,this.isUnmounted=!0,this._emitter.off(),(e=this._reiszeObserver)==null||e.disconnect(),(t=this._mutationObserver)==null||t.disconnect(),this._viewContainer&&this._changeAbleViewClassNames([]),pw(this,!1),pw(this,!0);var n=this.events;for(var r in n){var i=n[r];i&&i.destroy()}},t.prototype.getTargets=function(){var e=this.props.target;return e?[e]:[]},t.prototype.getAble=function(e){return b_(this.props.ables||[],function(t){return t.name===e})},t.prototype.getContainer=function(){var e=this.props,t=e.parentMoveable,n=e.wrapperMoveable;return e.container||n&&n.getContainer()||t&&t.getContainer()||this.controlBox.parentElement},t.prototype.getControlBoxElement=function(){return this.controlBox},t.prototype.getDragElement=function(){return this._dragTarget},t.prototype.isMoveableElement=function(e){return e&&(e.getAttribute?.call(e,`class`)||``).indexOf(ob)>-1},t.prototype.dragStart=function(e,t){t===void 0&&(t=e.target);var n=this.targetGesto,r=this.controlGesto;return n&&YT(this)({inputEvent:e},t)?n.isFlag()||n.triggerDragStart(e):r&&this.isMoveableElement(t)&&(r.isFlag()||r.triggerDragStart(e)),this},t.prototype.hitTest=function(e){var t=this.state,n=t.target,r=t.pos1,i=t.pos2,a=t.pos3,o=t.pos4,s=t.targetClientRect;if(!n)return 0;var c;if(J_(e)){var l=e.getBoundingClientRect();c={left:l.left,top:l.top,width:l.width,height:l.height}}else c=q({width:0,height:0},e);var u=c.left,d=c.top,f=c.width,p=c.height,m=ry([r,i,o,a],s),h=fy(m,[[u,d],[u+f,d],[u+f,d+p],[u,d+p]]),g=ny(m);return!h||!g?0:Math.min(100,h/g*100)},t.prototype.isInside=function(e,t){var n=this.state,r=n.target,i=n.pos1,a=n.pos2,o=n.pos3,s=n.pos4,c=n.targetClientRect;return r?ay([e,t],ry([i,a,s,o],c)):!1},t.prototype.updateRect=function(e,t,n){n===void 0&&(n=!0);var r=this.props,i=!r.parentPosition&&!r.wrapperMoveable;i&&ux(!0);var a=r.parentMoveable,o=this.state.target||r.target,s=this.getContainer(),c=a?a._rootContainer:this._rootContainer,l=nE(this.controlBox,o,s,s,c||s,this._getRequestStyles());if(!o&&this._hasFirstTarget&&r.persistData){var u=rE(r.persistData);for(var d in u)l[d]=u[d]}i&&ux(),this.updateState(l,a?!1:n)},t.prototype.isDragging=function(e){var t=this.targetGesto,n=this.controlGesto;if(t?.isFlag()){if(!e)return!0;var r=t.getEventData();return!!r[e]?.isEventStart}if(n?.isFlag()){if(!e)return!0;var r=n.getEventData();return!!r[e]?.isEventStart}return!1},t.prototype.updateTarget=function(e){this.updateRect(e,!0)},t.prototype.getRect=function(){var e=this.state,t=dw(this.state),n=J(t,4),r=n[0],i=n[1],a=n[2],o=n[3],s=KC(t),c=e.width,l=e.height,u=s.width,d=s.height,f=s.left,p=s.top,m=[e.left,e.top],h=sv(m,e.origin);return{width:u,height:d,left:f,top:p,pos1:r,pos2:i,pos3:a,pos4:o,offsetWidth:c,offsetHeight:l,beforeOrigin:sv(m,e.beforeOrigin),origin:h,transformOrigin:e.transformOrigin,rotation:this.getRotation()}},t.prototype.getManager=function(){return this},t.prototype.stopDrag=function(e){if(!e||e===`target`){var t=this.targetGesto;t?.isIdle()===!1&&fw(this,!1),t?.stop()}if(!e||e===`control`){var t=this.controlGesto;t?.isIdle()===!1&&fw(this,!0),t?.stop()}},t.prototype.getRotation=function(){var e=this.state,t=e.pos1,n=e.pos2,r=e.direction;return Rw(t,n,r)},t.prototype.request=function(e,t,n){t===void 0&&(t={});var r=this,i=r.props,a=i.parentMoveable||i.wrapperMoveable||r,o=a.props.ables,s=i.groupable,c=b_(o,function(t){return t.name===e});if(this.isDragging()||!c||!c.request)return{request:function(){return this},requestEnd:function(){return this}};var l=c.request(r),u=n||t.isInstant,d=l.isControl?`controlAbles`:`targetAbles`,f=`${s?`Group`:``}${l.isControl?`Control`:``}`,p=Y([],J(a[d]),!1),m={request:function(t){return JT(r,p,[`drag`],f,``,q(q({},l.request(t)),{requestAble:e,isRequest:!0}),u),m},requestEnd:function(){return JT(r,p,[`drag`],f,`End`,q(q({},l.requestEnd()),{requestAble:e,isRequest:!0}),u),m}};return JT(r,p,[`drag`],f,`Start`,q(q({},l.requestStart(t)),{requestAble:e,isRequest:!0}),u),u?m.request(t).requestEnd():m},t.prototype.getMoveables=function(){return[this]},t.prototype.destroy=function(){this.componentWillUnmount()},t.prototype.updateRenderPoses=function(){var e=this.getState(),t=this.props,n=t.padding,r=e.originalBeforeOrigin,i=e.transformOrigin,a=e.allMatrix,o=e.is3d,s=e.pos1,c=e.pos2,l=e.pos3,u=e.pos4,d=e.left,f=e.top,p=e.isPersisted,m=t.zoom||1;if(!n&&m<=1){e.renderPoses=[s,c,l,u],e.renderLines=[[s,c],[c,u],[u,l],[l,s]];return}var h=Yw(n||{}),g=h.left,_=h.top,v=h.bottom,y=h.right,b=o?4:3,x=[];x=p?i:this.controlBox&&t.groupable?r:sv(r,[d,f]);var S=av(b,xv(x.map(function(e){return-e}),b),a,xv(i,b)),C=kw(S,s,[-g,-_],b),w=kw(S,c,[y,-_],b),T=kw(S,l,[-g,v],b),E=kw(S,u,[y,v],b);if(e.renderPoses=[C,w,T,E],e.renderLines=[[C,w],[w,E],[E,T],[T,C]],m){var D=m/2;e.renderLines=[[kw(S,s,[-g-D,-_],b),kw(S,c,[y+D,-_],b)],[kw(S,c,[y,-_-D],b),kw(S,u,[y,v+D],b)],[kw(S,u,[y+D,v],b),kw(S,l,[-g-D,v],b)],[kw(S,l,[-g,v+D],b),kw(S,s,[-g,-_-D],b)]]}},t.prototype.checkUpdate=function(){this._isPropTargetChanged=!1;var e=this.props,t=e.target,n=e.container,r=e.parentMoveable,i=this.state,a=i.target,o=i.container;if(!(!a&&!t)){this.updateAbles();var s=!xw(a,t);if(s||!xw(o,n)){var c=n||this.controlBox;c&&this.unsetAbles(),this.updateState({target:t,container:n}),!r&&c&&this.updateRect(`End`,!1,!1),this._isPropTargetChanged=s}}},t.prototype.waitToChangeTarget=function(){return new Promise(function(){})},t.prototype.triggerEvent=function(e,t){var n=this.props;if(this._emitter.trigger(e,t),n.parentMoveable&&t.isRequest&&!t.isRequestChild)return n.parentMoveable.triggerEvent(e,t,!0);var r=n[e];return r&&r(t)},t.prototype.useCSS=function(e,t){var n=this.props.customStyledMap,r=e+t;return n[r]||(n[r]=Ry(e,t)),n[r]},t.prototype.getState=function(){var e=this.props;(e.target||e.targets?.length)&&(this._hasFirstTarget=!0);var t=this.controlBox,n=e.persistData,r=e.firstRenderState;if(r&&!t)return r;if(!this._hasFirstTarget&&n){var i=rE(n);if(i)return this.updateState(i,!1),this.state}return this.state.isPersisted=!1,this.state},t.prototype.updateSelectors=function(){},t.prototype.unsetAbles=function(){var e=this;this.targetAbles.forEach(function(t){t.unset&&t.unset(e)})},t.prototype.updateAbles=function(e,t){e===void 0&&(e=this.props.ables),t===void 0&&(t=``);var n=this.props.triggerAblesSimultaneously,r=this.getEnabledAbles(e),i=`drag${t}Start`,a=`pinch${t}Start`,o=`drag${t}ControlStart`,s=bw(r,[i,a],n),c=bw(r,[o],n);this.enabledAbles=r,this.targetAbles=s,this.controlAbles=c},t.prototype.updateState=function(e,t){if(t){if(this.isUnmounted)return;this.setState(e)}else{var n=this.state;for(var r in e)n[r]=e[r]}},t.prototype.getEnabledAbles=function(e){e===void 0&&(e=this.props.ables);var t=this.props;return e.filter(function(e){return e&&(e.always&&t[e.name]!==!1||t[e.name])})},t.prototype.renderAbles=function(){var e=this,t=this.props.triggerAblesSimultaneously,n={createElement:U.createElement};return this.renderState={},ww(Tw(bw(this.getEnabledAbles(),[`render`],t).map(function(t){var r=t.render;return r(e,n)||[]})).filter(function(e){return e}),function(e){return e.key}).map(function(e){return e[0]})},t.prototype.updateCheckInput=function(){this.targetGesto&&(this.targetGesto.options.checkInput=this.props.checkInput)},t.prototype._getRequestStyles=function(){return this.getEnabledAbles().reduce(function(e,t){var n=t.requestStyle?.call(t)??[];return Y(Y([],J(e),!1),J(n),!1)},Y([],J(this.props.requestStyles||[]),!1))},t.prototype._updateObserver=function(e){this._updateResizeObserver(e),this._updateMutationObserver(e)},t.prototype._updateEvents=function(){var e=this.targetAbles.length,t=this.controlAbles.length,n=this._dragTarget;(!e&&this.targetGesto||this._isTargetChanged(!0))&&(pw(this,!1),this.updateState({gestos:{}})),t||pw(this,!0),n&&e&&!this.targetGesto&&(this.targetGesto=XT(this,n,``)),!this.controlGesto&&t&&(this.controlGesto=ZT(this,`Control`))},t.prototype._updateTargets=function(){var e=this.props;this._prevPropTarget=this._propTarget,this._prevDragTarget=this._dragTarget,this._prevOriginalDragTarget=this._originalDragTarget,this._prevDragArea=e.dragArea,this._propTarget=e.target,this._originalDragTarget=e.dragTarget||e.target,this._dragTarget=Iw(this._originalDragTarget,!0)},t.prototype._renderLines=function(){var e=this.props,t=e.zoom,n=e.hideDefaultLines,r=e.hideChildMoveableDefaultLines,i=e.parentMoveable;if(n||i&&r)return[];var a=this.getState(),o={createElement:U.createElement};return a.renderLines.map(function(e,n){return bx(o,``,e[0],e[1],t,`render-line-${n}`)})},t.prototype._isTargetChanged=function(e){var t=this.props,n=t.dragTarget||t.target,r=this._prevOriginalDragTarget,i=this._prevDragArea,a=t.dragArea;return!a&&r!==n||(e||a)&&i!==a||this._prevPropTarget!=this._propTarget},t.prototype._updateNativeEvents=function(){var e=this,t=this.props.dragArea?this.areaElement:this.state.target,n=this.events,r=C_(n);if(this._isTargetChanged())for(var i in n){var a=n[i];a&&a.destroy(),n[i]=null}if(t){var o=this.enabledAbles;r.forEach(function(r){var i=bw(o,[r]),a=i.length>0,s=n[r];if(!a){s&&(s.destroy(),n[r]=null);return}s||(s=new $T(t,e,r),n[r]=s),s.setAbles(i)})}},t.prototype._checkUpdateRootContainer=function(){var e=this.props.rootContainer;!this._rootContainer&&e&&(this._rootContainer=Iw(e,!0))},t.prototype._checkUpdateViewContainer=function(){var e=this.props.viewContainer;!this._viewContainer&&e&&(this._viewContainer=Iw(e,!0)),this._viewContainer&&this._changeAbleViewClassNames(Y(Y([],J(this._getAbleViewClassNames()),!1),[this.isDragging()?oT:``],!1))},t.prototype._changeAbleViewClassNames=function(e){var t=this._viewContainer,n=Cw(e.filter(Boolean),function(e){return e}).map(function(e){return J(e,1)[0]}),r=this._viewClassNames,i=Fv(r,n),a=i.removed,o=i.added;a.forEach(function(e){B_(t,r[e])}),o.forEach(function(e){z_(t,n[e])}),this._viewClassNames=n},t.prototype._getAbleViewClassNames=function(){var e=this;return(this.getEnabledAbles().map(function(t){return t.viewClassName?.call(t,e)||``}).join(` `)+` ${this._getAbleClassName(`-view`)}`).split(/\s+/g)},t.prototype._getAbleClassName=function(e){var t=this;e===void 0&&(e=``);var n=this.getEnabledAbles(),r=this.targetGesto,i=this.controlGesto,a=r?.isFlag()?r.getEventData():{},o=i?.isFlag()?i.getEventData():{};return n.map(function(n){var r=n.name,i=n.className?.call(n,t)||``;return(a[r]?.isEventStart||o[r]?.isEventStart)&&(i+=` ${X(`${r}${e}-dragging`)}`),i.trim()}).filter(Boolean).join(` `)},t.prototype._updateResizeObserver=function(e){var t,n=this.props,r=n.target,i=K_(this.getControlBoxElement());if(!i.ResizeObserver||!r||!n.useResizeObserver){(t=this._reiszeObserver)==null||t.disconnect();return}if(!(e.target===r&&this._reiszeObserver)){var a=new i.ResizeObserver(this.checkUpdateRect);a.observe(r,{box:`border-box`}),this._reiszeObserver=a}},t.prototype._updateMutationObserver=function(e){var t=this,n,r=this.props,i=r.target,a=K_(this.getControlBoxElement());if(!a.MutationObserver||!i||!r.useMutationObserver){(n=this._mutationObserver)==null||n.disconnect();return}if(!(e.target===i&&this._mutationObserver)){var o=new a.MutationObserver(function(e){var n,r;try{for(var i=Uy(e),a=i.next();!a.done;a=i.next()){var o=a.value;o.type===`attributes`&&o.attributeName===`style`&&t.checkUpdateRect()}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}});o.observe(i,{attributes:!0}),this._mutationObserver=o}},t.defaultProps={dragTargetSelf:!1,target:null,dragTarget:null,container:null,rootContainer:null,origin:!0,parentMoveable:null,wrapperMoveable:null,isWrapperMounted:!1,parentPosition:null,warpSelf:!1,svgOrigin:``,dragContainer:null,useResizeObserver:!1,useMutationObserver:!1,preventDefault:!0,preventRightClick:!0,preventWheelClick:!0,linePadding:0,controlPadding:0,ables:[],pinchThreshold:20,dragArea:!1,passDragArea:!1,transformOrigin:``,className:``,zoom:1,triggerAblesSimultaneously:!1,padding:{},pinchOutside:!0,checkInput:!1,dragFocusedInput:!1,groupable:!1,hideDefaultLines:!1,cspNonce:``,translateZ:0,cssStyled:null,customStyledMap:{},props:{},stopPropagation:!1,preventClickDefault:!1,preventClickEventOnDrag:!0,flushSync:DC,firstRenderState:null,persistData:null,viewContainer:null,requestStyles:[],useAccuratePosition:!1},t}(U.PureComponent),aE={name:`groupable`,props:[`defaultGroupRotate`,`useDefaultGroupRotate`,`defaultGroupOrigin`,`groupable`,`groupableProps`,`targetGroups`,`hideChildMoveableDefaultLines`],events:[],render:function(e,t){var n=e.props,r=n.targets||[],i=e.getState(),a=i.left,o=i.top,s=i.isPersisted,c=n.zoom||1,l=e.renderGroupRects,u=n.persistData?.children||[];s?r=u.map(function(){return null}):u=[];var d=Kw(e,`parentPosition`,[a,o],function(e){return e.join(`,`)}),f=Kw(e,`requestStyles`,e.getRequestChildStyles(),function(e){return e.join(`,`)});return e.moveables=e.moveables.slice(0,r.length),Y(Y([],J(r.map(function(r,i){return t.createElement(iE,{key:`moveable`+i,ref:Ug(e,`moveables`,i),target:r,origin:!1,requestStyles:f,cssStyled:n.cssStyled,customStyledMap:n.customStyledMap,useResizeObserver:n.useResizeObserver,useMutationObserver:n.useMutationObserver,hideChildMoveableDefaultLines:n.hideChildMoveableDefaultLines,parentMoveable:e,parentPosition:[a,o],persistData:u[i],zoom:c})})),!1),J(Tw(l.map(function(e,n){var r=[e.pos1,e.pos2,e.pos3,e.pos4];return[[0,1],[1,3],[3,2],[2,0]].map(function(e,i){var a=J(e,2),o=a[0],s=a[1];return bx(t,``,K(r[o],d),K(r[s],d),c,`group-rect-${n}-${i}`)})}))),!1)}},oE=Wy(`clickable`,{props:[`clickable`],events:[`click`,`clickGroup`],always:!0,dragRelation:`weak`,dragStart:function(){},dragControlStart:function(){},dragGroupStart:function(e,t){t.datas.inputTarget=t.inputEvent&&t.inputEvent.target},dragEnd:function(e,t){var n=e.props.target,r=t.inputEvent,i=t.inputTarget,a=!e.isMoveableElement(i)&&e.controlBox.contains(i);if(!(!r||!i||t.isDrag||e.isMoveableElement(i)||a)){var o=n.contains(i);Z(e,`onClick`,gw(e,t,{isDouble:t.isDouble,inputTarget:i,isTarget:n===i,moveableTarget:e.props.target,containsTarget:o}))}},dragGroupEnd:function(e,t){var n=t.inputEvent,r=t.inputTarget;if(!(!n||!r||t.isDrag||e.isMoveableElement(r)||t.datas.inputTarget===r)){var i=e.props.targets,a=i.indexOf(r),o=a>-1,s=!1;a===-1&&(a=y_(i,function(e){return e.contains(r)}),s=a>-1),Z(e,`onClickGroup`,gw(e,t,{isDouble:t.isDouble,targets:i,inputTarget:r,targetIndex:a,isTarget:o,containsTarget:s,moveableTarget:i[a]}))}},dragControlEnd:function(e,t){this.dragEnd(e,t)},dragGroupControlEnd:function(e,t){this.dragEnd(e,t)}});function sE(e){var t=e.originalDatas.draggable;return t||=(e.originalDatas.draggable={},e.originalDatas.draggable),q(q({},e),{datas:t})}var cE=Wy(`edgeDraggable`,{css:[`.edge.edgeDraggable.line {
376
- cursor: move;
377
- }`],render:function(e,t){var n=e.props,r=n.edgeDraggable;return r?xx(t,`edgeDraggable`,r,e.getState().renderPoses,n.zoom):[]},dragCondition:function(e,t){var n=e.props,r=t.inputEvent?.target;return!n.edgeDraggable||!r?!1:!n.draggable&&R_(r,X(`direction`))&&R_(r,X(`edge`))&&R_(r,X(`edgeDraggable`))},dragStart:function(e,t){return NS.dragStart(e,sE(t))},drag:function(e,t){return NS.drag(e,sE(t))},dragEnd:function(e,t){return NS.dragEnd(e,sE(t))},dragGroupCondition:function(e,t){var n=e.props,r=t.inputEvent?.target;return!n.edgeDraggable||!r?!1:!n.draggable&&R_(r,X(`direction`))&&R_(r,X(`line`))},dragGroupStart:function(e,t){return NS.dragGroupStart(e,sE(t))},dragGroup:function(e,t){return NS.dragGroup(e,sE(t))},dragGroupEnd:function(e,t){return NS.dragGroupEnd(e,sE(t))},unset:function(e){return NS.unset(e)}}),lE={name:`individualGroupable`,props:[`individualGroupable`,`individualGroupableProps`],events:[]},uE=[KT,pT,TC,Xw,NS,cE,RS,Qw,nT,GS,fT,mT,uT,LT,IT,WT,aE,lE,oE,lT,qT];function dE(e,t){var n=J(e,3),r=n[0],i=n[1],a=n[2];return(r*t[0]+i*t[1]+a)/Math.sqrt(r*r+i*i)}function fE(e,t){var n=J(e,2),r=n[0],i=n[1];return-r*t[0]-i*t[1]}function pE(e,t){return Math.max.apply(Math,Y([],J(e.map(function(e){var n=J(e,4),r=n[0],i=n[1],a=n[2],o=n[3];return Math.max(r[t],i[t],a[t],o[t])})),!1))}function mE(e,t){return Math.min.apply(Math,Y([],J(e.map(function(e){var n=J(e,4),r=n[0],i=n[1],a=n[2],o=n[3];return Math.min(r[t],i[t],a[t],o[t])})),!1))}function hE(e,t){var n,r,i,a=[0,0],o=[0,0],s=[0,0],c=[0,0],l=0,u=0;if(!e.length)return{pos1:a,pos2:o,pos3:s,pos4:c,minX:0,minY:0,maxX:0,maxY:0,width:l,height:u,rotation:t};var d=P_(t,ub);if(d%90){var f=d/180*Math.PI,p=Math.tan(f),m=-1/p,h=[fb,pb],g=[[0,0],[0,0]],_=[fb,pb],v=[[0,0],[0,0]];e.forEach(function(e){e.forEach(function(e){var t=dE([-p,1,0],e),n=dE([-m,1,0],e);h[0]>t&&(g[0]=e,h[0]=t),h[1]<t&&(g[1]=e,h[1]=t),_[0]>n&&(v[0]=e,_[0]=n),_[1]<n&&(v[1]=e,_[1]=n)})});var y=J(g,2),b=y[0],x=y[1],S=J(v,2),C=S[0],w=S[1],T=[-p,1,fE([-p,1],b)],E=[-p,1,fE([-p,1],x)],D=[-m,1,fE([-m,1],C)],O=[-m,1,fE([-m,1],w)];n=J([[T,D],[T,O],[E,D],[E,O]].map(function(e){var t=J(e,2),n=t[0],r=t[1];return sy(n,r)[0]}),4),a=n[0],o=n[1],s=n[2],c=n[3],l=_[1]-_[0],u=h[1]-h[0]}else{var k=mE(e,0),A=mE(e,1),j=pE(e,0),M=pE(e,1);if(a=[k,A],o=[j,A],s=[k,M],c=[j,M],l=j-k,u=M-A,d%180){var N=[s,a,c,o];r=J(N,4),a=r[0],o=r[1],s=r[2],c=r[3],l=M-A,u=j-k}}if(d%360>180){var N=[c,s,o,a];i=J(N,4),a=i[0],o=i[1],s=i[2],c=i[3]}var ee=iy([a,o,s,c]),P=ee.minX,F=ee.minY,te=ee.maxX,I=ee.maxY;return{pos1:a,pos2:o,pos3:s,pos4:c,width:l,height:u,minX:P,minY:F,maxX:te,maxY:I,rotation:t}}function gE(e,t){var n=t.map(function(t){if(i_(t)){var n=gE(e,t),r=n.length;return r>1?n:r===1?n[0]:null}else{var i=b_(e,function(e){return e.manager.props.target===t});return i?(i.finded=!0,i.manager):null}}).filter(Boolean);return n.length===1&&i_(n[0])?n[0]:n}var _E=function(e){By(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.differ=new Bv,t.moveables=[],t.transformOrigin=`50% 50%`,t.renderGroupRects=[],t._targetGroups=[],t._hasFirstTargets=!1,t}return t.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this)},t.prototype.checkUpdate=function(){this._isPropTargetChanged=!1,this.updateAbles()},t.prototype.getTargets=function(){return this.props.targets},t.prototype.updateRect=function(e,t,n){n===void 0&&(n=!0);var r=this.state;if(!this.controlBox||r.isPersisted)return;ux(!0),this.moveables.forEach(function(t){t.updateRect(e,!1,!1)});var i=this.props,a=this.moveables,o=r.target||i.target,s=a.map(function(e){return{finded:!1,manager:e}}),c=this.props.targetGroups||[],l=gE(s,c),u=i.useDefaultGroupRotate;l.push.apply(l,Y([],J(s.filter(function(e){return!e.finded}).map(function(e){return e.manager})),!1));var d=[],f=!t||e!==``&&i.updateGroup,p=i.defaultGroupRotate||0;if(!this._hasFirstTargets){var m=i.persistData?.rotation;m!=null&&(p=m)}function h(e,t,n){var r=e.map(function(e){if(i_(e)){var n=h(e,t),r=[n.pos1,n.pos2,n.pos3,n.pos4];return d.push(n),{poses:r,rotation:n.rotation}}else return{poses:dw(e.state),rotation:e.getRotation()}}),i=r.map(function(e){return e.rotation}),a=0,o=i[0],s=i.every(function(e){return Math.abs(o-e)<.1});return a=f?!u&&s?o:p:!u&&!n&&s?o:t,hE(r.map(function(e){return e.poses}),a)}var g=h(l,this.rotation,!0);f&&(this.rotation=g.rotation,this.transformOrigin=i.defaultGroupOrigin||`50% 50%`,this.scale=[1,1]),this._targetGroups=c,this.renderGroupRects=d;var _=this.transformOrigin,v=this.rotation,y=this.scale,b=g.width,x=g.height,S=g.minX,C=g.minY,w=iy(Ww([[0,0],[b,0],[0,x],[b,x]],Uw(_,b,x),this.rotation/180*Math.PI).result),T=w.minX,E=w.minY,D=` rotate(${v}deg) scale(${qw(y[0])}, ${qw(y[1])})`,O=`translate(${-T}px, ${-E}px)${D}`;this.controlBox.style.transform=`translate3d(${S}px, ${C}px, ${this.props.translateZ||0})`,o.style.cssText+=`left:0px;top:0px;transform-origin:${_};width:${b}px;height:${x}px;transform: ${O}`,r.width=b,r.height=x;var k=this.getContainer(),A=nE(this.controlBox,o,this.controlBox,this.getContainer(),this._rootContainer||k,[]),j=[A.left,A.top],M=J(dw(A),4),N=M[0],ee=M[1],P=M[2],F=M[3],te=iy([N,ee,P,F]),I=[te.minX,te.minY],ne=qw(y[0]*y[1]);A.pos1=K(N,I),A.pos2=K(ee,I),A.pos3=K(P,I),A.pos4=K(F,I),A.left=S-A.left+I[0],A.top=C-A.top+I[1],A.origin=K(sv(j,A.origin),I),A.beforeOrigin=K(sv(j,A.beforeOrigin),I),A.originalBeforeOrigin=sv(j,A.originalBeforeOrigin),A.transformOrigin=K(sv(j,A.transformOrigin),I),o.style.transform=`translate(${-T-I[0]}px, ${-E-I[1]}px)`+D,ux(),this.updateState(q(q({},A),{posDelta:I,direction:ne,beforeDirection:ne}),n)},t.prototype.getRect=function(){return q(q({},e.prototype.getRect.call(this)),{children:this.moveables.map(function(e){return e.getRect()})})},t.prototype.triggerEvent=function(t,n,r){if(r||t.indexOf(`Group`)>-1)return e.prototype.triggerEvent.call(this,t,n);this._emitter.trigger(t,n)},t.prototype.getRequestChildStyles=function(){return this.getEnabledAbles().reduce(function(e,t){var n=t.requestChildStyle?.call(t)??[];return Y(Y([],J(e),!1),J(n),!1)},[])},t.prototype.getMoveables=function(){return Y([],J(this.moveables),!1)},t.prototype.updateAbles=function(){e.prototype.updateAbles.call(this,Y(Y([],J(this.props.ables),!1),[aE],!1),`Group`)},t.prototype._updateTargets=function(){e.prototype._updateTargets.call(this),this._originalDragTarget=this.props.dragTarget||this.areaElement,this._dragTarget=Iw(this._originalDragTarget,!0)},t.prototype._updateEvents=function(){var e=this.state,t=this.props,n=this._prevDragTarget,r=t.dragTarget||this.areaElement,i=t.targets,a=this.differ.update(i),o=a.added,s=a.changed,c=a.removed,l=o.length||c.length;(l||this._prevOriginalDragTarget!==this._originalDragTarget)&&(pw(this,!1),pw(this,!0),this.updateState({gestos:{}})),n!==r&&(e.target=null),e.target||(e.target=this.areaElement,this.controlBox.style.display=`block`),e.target&&(this.targetGesto||=XT(this,this._dragTarget,`Group`),this.controlGesto||=ZT(this,`GroupControl`));var u=!xw(e.container,t.container);u&&(e.container=t.container),(u||l||this.transformOrigin!==(t.defaultGroupOrigin||`50% 50%`)||s.length||i.length&&!Gw(this._targetGroups,t.targetGroups||[]))&&(this.updateRect(),this._hasFirstTargets=!0),this._isPropTargetChanged=!!l},t.prototype._updateObserver=function(){},t.defaultProps=q(q({},iE.defaultProps),{transformOrigin:[`50%`,`50%`],groupable:!0,dragArea:!0,keepRatio:!0,targets:[],defaultGroupRotate:0,defaultGroupOrigin:`50% 50%`}),t}(iE),vE=function(e){By(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.moveables=[],t}return t.prototype.render=function(){var e=this,t=this.props,n=t.cspNonce,r=t.cssStyled,i=t.persistData,a=t.targets||[],o=a.length,s=this.isUnmounted||!o,c=i?.children??[];return s&&!o&&c.length?a=c.map(function(){return null}):s||(c=[]),U.createElement(r,{cspNonce:n,ref:Hg(this,`controlBox`),className:X(`control-box`)},a.map(function(n,r){var i=t.individualGroupableProps?.call(t,n,r)??{};return U.createElement(iE,q({key:`moveable`+r,ref:Ug(e,`moveables`,r)},t,i,{target:n,wrapperMoveable:e,isWrapperMounted:e.isMoveableMounted,persistData:c[r]}))}))},t.prototype.componentDidMount=function(){},t.prototype.componentDidUpdate=function(){},t.prototype.getTargets=function(){return this.props.targets},t.prototype.updateRect=function(e,t,n){n===void 0&&(n=!0),ux(!0),this.moveables.forEach(function(r){r.updateRect(e,t,n)}),ux()},t.prototype.getRect=function(){return q(q({},e.prototype.getRect.call(this)),{children:this.moveables.map(function(e){return e.getRect()})})},t.prototype.request=function(e,t,n){t===void 0&&(t={});var r=this.moveables.map(function(n){return n.request(e,q(q({},t),{isInstant:!1}),!1)}),i=n||t.isInstant,a={request:function(e){return r.forEach(function(t){return t.request(e)}),this},requestEnd:function(){return r.forEach(function(e){return e.requestEnd()}),this}};return i?a.request(t).requestEnd():a},t.prototype.dragStart=function(e,t){t===void 0&&(t=e.target);var n=t,r=b_(this.moveables,function(e){var t=e.getTargets()[0],r=e.getControlBoxElement(),i=e.getDragElement();return!t||!i?!1:i===n||i.contains(n)||i!==t&&t===n||t.contains(n)||r===n||r.contains(n)});return r&&r.dragStart(e,t),this},t.prototype.hitTest=function(){return 0},t.prototype.isInside=function(){return!1},t.prototype.isDragging=function(){return!1},t.prototype.getDragElement=function(){return null},t.prototype.getMoveables=function(){return Y([],J(this.moveables),!1)},t.prototype.updateRenderPoses=function(){},t.prototype.checkUpdate=function(){},t.prototype.triggerEvent=function(){},t.prototype.updateAbles=function(){},t.prototype._updateEvents=function(){},t.prototype._updateObserver=function(){},t}(iE);function yE(e,t){var n=[];return e.forEach(function(e){if(e){if(a_(e)){t[e]&&n.push.apply(n,Y([],J(t[e]),!1));return}i_(e)?n.push.apply(n,Y([],J(yE(e,t)),!1)):n.push(e)}}),n}function bE(e,t){var n=[];return e.forEach(function(e){if(e){if(a_(e)){t[e]&&n.push.apply(n,Y([],J(t[e]),!1));return}i_(e)?n.push(bE(e,t)):n.push(e)}}),n}function xE(e,t){return e.length!==t.length||e.some(function(e,n){var r=t[n];return!e&&!r||e==r?!1:i_(e)&&i_(r)?xE(e,r):!0})}var SE=function(e){By(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.defaultAbles=uE,t}(function(e){By(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.refTargets=[],t.selectorMap={},t._differ=new Bv,t._elementTargets=[],t._tmpRefTargets=[],t._tmpSelectorMap={},t._onChangeTargets=null,t}return t.makeStyled=function(){var e={};this.getTotalAbles().forEach(function(t){var n=t.css;n&&n.forEach(function(t){e[t]=!0})});var t=C_(e).join(`
378
- `);this.defaultStyled=Ry(`div`,Vg(ob,sb+t))},t.getTotalAbles=function(){return Y([pT,aE,lE,lT],J(this.defaultAbles),!1)},t.prototype.render=function(){var e=this.constructor;e.defaultStyled||e.makeStyled();var t=this.props,n=t.ables,r=t.props,i=Vy(t,[`ables`,`props`]),a=J(this._updateRefs(!0),2),o=a[0],s=a[1],c=yE(o,s),l=c.length>1,u=Y(Y([],J(e.getTotalAbles()),!1),J(n||[]),!1),d=q(q(q({},i),r||{}),{ables:u,cssStyled:e.defaultStyled,customStyledMap:e.customStyledMap});this._elementTargets=c;var f=null,p=this.moveable;if(i.persistData?.children&&(l=!0),i.individualGroupable)return U.createElement(vE,q({key:`individual-group`,ref:Hg(this,`moveable`)},d,{target:null,targets:c}));if(l){var m=bE(o,s);if(p&&!p.props.groupable&&!p.props.individualGroupable){var h=p.props.target;h&&c.indexOf(h)>-1&&(f=q({},p.state))}return U.createElement(_E,q({key:`group`,ref:Hg(this,`moveable`)},d,i.groupableProps??{},{target:null,targets:c,targetGroups:m,firstRenderState:f}))}else{var g=c[0];if(p&&(p.props.groupable||p.props.individualGroupable)){var _=b_(p.moveables||[],function(e){return e.props.target===g});_&&(f=q({},_.state))}return U.createElement(iE,q({key:`single`,ref:Hg(this,`moveable`)},d,{target:g,firstRenderState:f}))}},t.prototype.componentDidMount=function(){this._checkChangeTargets()},t.prototype.componentDidUpdate=function(){this._checkChangeTargets()},t.prototype.componentWillUnmount=function(){this.selectorMap={},this.refTargets=[]},t.prototype.getTargets=function(){return this.moveable?.getTargets()??[]},t.prototype.updateSelectors=function(){this.selectorMap={},this._updateRefs(),this.forceUpdate()},t.prototype.waitToChangeTarget=function(){var e=this,t;return this._onChangeTargets=function(){e._onChangeTargets=null,t()},new Promise(function(e){t=e})},t.prototype.waitToChangeTargets=function(){return this.waitToChangeTarget()},t.prototype.getManager=function(){return this.moveable},t.prototype.getMoveables=function(){return this.moveable.getMoveables()},t.prototype.getDragElement=function(){return this.moveable.getDragElement()},t.prototype._updateRefs=function(e){var t=this.refTargets,n=Lw(this.props.target||this.props.targets),r=typeof document<`u`,i=xE(t,n),a=this.selectorMap,o={};return this.refTargets.forEach(function e(t){a_(t)?a[t]?o[t]=a[t]:r&&(i=!0,o[t]=[].slice.call(document.querySelectorAll(t))):i_(t)&&t.forEach(e)}),this._tmpRefTargets=n,this._tmpSelectorMap=o,[n,o,!e&&i]},t.prototype._checkChangeTargets=function(){var e,t,n;this.refTargets=this._tmpRefTargets,this.selectorMap=this._tmpSelectorMap;var r=this._differ.update(this._elementTargets),i=r.added,a=r.removed;(i.length||a.length)&&((t=(e=this.props).onChangeTargets)==null||t.call(e,{moveable:this.moveable,targets:this._elementTargets}),(n=this._onChangeTargets)==null||n.call(this));var o=J(this._updateRefs(),3),s=o[0],c=o[1],l=o[2];this.refTargets=s,this.selectorMap=c,l&&this.forceUpdate()},t.defaultAbles=[],t.customStyledMap={},t.defaultStyled=null,Hy([Wg(_b)],t.prototype,`moveable`,void 0),t}(U.PureComponent)),CE=()=>{let e=(0,gc.c)(2),{editor:t}=Vm();if(!t?.isActive(`image`))return null;let n;if(e[0]!==t){let r=()=>{let e=document.querySelector(`.ProseMirror-selectednode`);if(e){let n=t.state.selection,r=t.commands.setImage;r({src:e.src,width:Number(e.style.width.replace(`px`,``)),height:Number(e.style.height.replace(`px`,``))}),t.commands.setNodeSelection(n.from)}};n=(0,W.jsx)(SE,{target:document.querySelector(`.ProseMirror-selectednode`),container:null,origin:!1,edge:!1,throttleDrag:0,keepRatio:!0,resizable:!0,throttleResize:0,onResize:wE,onResizeEnd:()=>{r()},scalable:!0,throttleScale:0,renderDirections:[`w`,`e`],onScale:TE}),e[0]=t,e[1]=n}else n=e[1];return n};function wE(e){let{target:t,width:n,height:r,delta:i}=e;i[0]&&(t.style.width=`${n}px`),i[1]&&(t.style.height=`${r}px`)}function TE(e){let{target:t,transform:n}=e;t.style.transform=n}function EE(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=dp(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function DE(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
379
- `);return/\s/.test(n)}):!1}var OE=new jr(`suggestion`);function kE({pluginKey:e=OE,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=EE,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!DE(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new Or({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),_s.create(e.doc,[ms.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var AE=kE,jE=`bottom`,ME=`right`,NE=`left`,PE=`auto`,FE=[`top`,jE,ME,NE],IE=`start`,LE=`clippingParents`,RE=`viewport`,zE=`popper`,BE=`reference`,VE=FE.reduce(function(e,t){return e.concat([t+`-`+IE,t+`-end`])},[]),HE=[].concat(FE,[PE]).reduce(function(e,t){return e.concat([t,t+`-`+IE,t+`-end`])},[]),UE=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function WE(e){return e?(e.nodeName||``).toLowerCase():null}function GE(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function KE(e){return e instanceof GE(e).Element||e instanceof Element}function qE(e){return e instanceof GE(e).HTMLElement||e instanceof HTMLElement}function JE(e){return typeof ShadowRoot>`u`?!1:e instanceof GE(e).ShadowRoot||e instanceof ShadowRoot}function YE(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!qE(i)||!WE(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function XE(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!qE(r)||!WE(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var ZE={name:`applyStyles`,enabled:!0,phase:`write`,fn:YE,effect:XE,requires:[`computeStyles`]};function QE(e){return e.split(`-`)[0]}var $E=Math.max,eD=Math.min,tD=Math.round;function nD(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function rD(){return!/^((?!chrome|android).)*safari/i.test(nD())}function iD(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&qE(e)&&(i=e.offsetWidth>0&&tD(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&tD(r.height)/e.offsetHeight||1);var o=(KE(e)?GE(e):window).visualViewport,s=!rD()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function aD(e){var t=iD(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function oD(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&JE(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function sD(e){return GE(e).getComputedStyle(e)}function cD(e){return[`table`,`td`,`th`].indexOf(WE(e))>=0}function lD(e){return((KE(e)?e.ownerDocument:e.document)||window.document).documentElement}function uD(e){return WE(e)===`html`?e:e.assignedSlot||e.parentNode||(JE(e)?e.host:null)||lD(e)}function dD(e){return!qE(e)||sD(e).position===`fixed`?null:e.offsetParent}function fD(e){var t=/firefox/i.test(nD());if(/Trident/i.test(nD())&&qE(e)&&sD(e).position===`fixed`)return null;var n=uD(e);for(JE(n)&&(n=n.host);qE(n)&&[`html`,`body`].indexOf(WE(n))<0;){var r=sD(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function pD(e){for(var t=GE(e),n=dD(e);n&&cD(n)&&sD(n).position===`static`;)n=dD(n);return n&&(WE(n)===`html`||WE(n)===`body`&&sD(n).position===`static`)?t:n||fD(e)||t}function mD(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function hD(e,t,n){return $E(e,eD(t,n))}function gD(e,t,n){var r=hD(e,t,n);return r>n?n:r}function _D(){return{top:0,right:0,bottom:0,left:0}}function vD(e){return Object.assign({},_D(),e)}function yD(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var bD=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,vD(typeof e==`number`?yD(e,FE):e)};function xD(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=QE(n.placement),c=mD(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=bD(i.padding,n),d=aD(a),f=c===`y`?`top`:NE,p=c===`y`?jE:ME,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=pD(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=hD(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function SD(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||oD(t.elements.popper,r)&&(t.elements.arrow=r))}var CD={name:`arrow`,enabled:!0,phase:`main`,fn:xD,effect:SD,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function wD(e){return e.split(`-`)[1]}var TD={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function ED(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:tD(n*i)/i||0,y:tD(r*i)/i||0}}function DD(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=NE,b=`top`,x=window;if(l){var S=pD(n),C=`clientHeight`,w=`clientWidth`;if(S===GE(n)&&(S=lD(n),sD(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=jE;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=ME;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&TD),O=u===!0?ED({x:p,y:h},GE(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var k;return Object.assign({},D,(k={},k[b]=v?`0`:``,k[y]=_?`0`:``,k.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,k))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function OD(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,a=n.adaptive,o=a===void 0?!0:a,s=n.roundOffsets,c=s===void 0?!0:s,l={placement:QE(t.placement),variation:wD(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,DD(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,DD(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var kD={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:OD,data:{}},AD={passive:!0};function jD(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0?!0:i,o=r.resize,s=o===void 0?!0:o,c=GE(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,AD)}),s&&c.addEventListener(`resize`,n.update,AD),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,AD)}),s&&c.removeEventListener(`resize`,n.update,AD)}}var MD={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:jD,data:{}},ND={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function PD(e){return e.replace(/left|right|bottom|top/g,function(e){return ND[e]})}var FD={start:`end`,end:`start`};function ID(e){return e.replace(/start|end/g,function(e){return FD[e]})}function LD(e){var t=GE(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function RD(e){return iD(lD(e)).left+LD(e).scrollLeft}function zD(e,t){var n=GE(e),r=lD(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=rD();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+RD(e),y:c}}function BD(e){var t=lD(e),n=LD(e),r=e.ownerDocument?.body,i=$E(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=$E(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+RD(e),s=-n.scrollTop;return sD(r||t).direction===`rtl`&&(o+=$E(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function VD(e){var t=sD(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function HD(e){return[`html`,`body`,`#document`].indexOf(WE(e))>=0?e.ownerDocument.body:qE(e)&&VD(e)?e:HD(uD(e))}function UD(e,t){t===void 0&&(t=[]);var n=HD(e),r=n===e.ownerDocument?.body,i=GE(n),a=r?[i].concat(i.visualViewport||[],VD(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(UD(uD(a)))}function WD(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function GD(e,t){var n=iD(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function KD(e,t,n){return t===`viewport`?WD(zD(e,n)):KE(t)?GD(t,n):WD(BD(lD(e)))}function qD(e){var t=UD(uD(e)),n=[`absolute`,`fixed`].indexOf(sD(e).position)>=0&&qE(e)?pD(e):e;return KE(n)?t.filter(function(e){return KE(e)&&oD(e,n)&&WE(e)!==`body`}):[]}function JD(e,t,n,r){var i=t===`clippingParents`?qD(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=KD(e,n,r);return t.top=$E(i.top,t.top),t.right=eD(i.right,t.right),t.bottom=eD(i.bottom,t.bottom),t.left=$E(i.left,t.left),t},KD(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function YD(e){var t=e.reference,n=e.element,r=e.placement,i=r?QE(r):null,a=r?wD(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case jE:c={x:o,y:t.y+t.height};break;case ME:c={x:t.x+t.width,y:s};break;case NE:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?mD(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case IE:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2);break;default:}}return c}function XD(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?LE:s,l=n.rootBoundary,u=l===void 0?RE:l,d=n.elementContext,f=d===void 0?zE:d,p=n.altBoundary,m=p===void 0?!1:p,h=n.padding,g=h===void 0?0:h,_=vD(typeof g==`number`?yD(g,FE):g),v=f===`popper`?BE:zE,y=e.rects.popper,b=e.elements[m?v:f],x=JD(KE(b)?b:b.contextElement||lD(e.elements.popper),c,u,o),S=iD(e.elements.reference),C=YD({reference:S,element:y,strategy:`absolute`,placement:i}),w=WD(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function ZD(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?HE:c,u=wD(r),d=u?s?VE:VE.filter(function(e){return wD(e)===u}):FE,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=XD(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[QE(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function QD(e){if(QE(e)===`auto`)return[];var t=PD(e);return[ID(e),t,ID(t)]}function $D(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!0:o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,h=n.allowedAutoPlacements,g=t.options.placement,_=QE(g)===g,v=c||(_||!m?[PD(g)]:QD(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(QE(n)===`auto`?ZD(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=QE(E),O=wD(E)===IE,k=[`top`,jE].indexOf(D)>=0,A=k?`width`:`height`,j=XD(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),M=k?O?ME:NE:O?jE:`top`;b[A]>x[A]&&(M=PD(M));var N=PD(M),ee=[];if(a&&ee.push(j[D]<=0),s&&ee.push(j[M]<=0,j[N]<=0),ee.every(function(e){return e})){w=E,C=!1;break}S.set(E,ee)}if(C)for(var P=m?3:1,F=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},te=P;te>0&&F(te)!==`break`;te--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var eO={name:`flip`,enabled:!0,phase:`main`,fn:$D,requiresIfExists:[`offset`],data:{_skip:!1}};function tO(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function nO(e){return[`top`,ME,jE,NE].some(function(t){return e[t]>=0})}function rO(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=XD(t,{elementContext:`reference`}),s=XD(t,{altBoundary:!0}),c=tO(o,r),l=tO(s,i,a),u=nO(c),d=nO(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var iO={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:rO};function aO(e,t,n){var r=QE(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function oO(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=HE.reduce(function(e,n){return e[n]=aO(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var sO={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:oO};function cO(e){var t=e.state,n=e.name;t.modifiersData[n]=YD({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var lO={name:`popperOffsets`,enabled:!0,phase:`read`,fn:cO,data:{}};function uO(e){return e===`x`?`y`:`x`}function dO(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!1:o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,m=n.tetherOffset,h=m===void 0?0:m,g=XD(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=QE(t.placement),v=wD(t.placement),y=!v,b=mD(_),x=uO(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var k=b===`y`?`top`:NE,A=b===`y`?jE:ME,j=b===`y`?`height`:`width`,M=S[b],N=M+g[k],ee=M-g[A],P=p?-w[j]/2:0,F=v===`start`?C[j]:w[j],te=v===`start`?-w[j]:-C[j],I=t.elements.arrow,ne=p&&I?aD(I):{width:0,height:0},re=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:_D(),ie=re[k],ae=re[A],oe=hD(0,C[j],ne[j]),se=y?C[j]/2-P-oe-ie-E.mainAxis:F-oe-ie-E.mainAxis,ce=y?-C[j]/2+P+oe+ae+E.mainAxis:te+oe+ae+E.mainAxis,L=t.elements.arrow&&pD(t.elements.arrow),le=L?b===`y`?L.clientTop||0:L.clientLeft||0:0,ue=D?.[b]??0,de=M+se-ue-le,fe=M+ce-ue,pe=hD(p?eD(N,de):N,M,p?$E(ee,fe):ee);S[b]=pe,O[b]=pe-M}if(s){var me=b===`x`?`top`:NE,he=b===`x`?jE:ME,ge=S[x],_e=x===`y`?`height`:`width`,ve=ge+g[me],ye=ge-g[he],be=[`top`,NE].indexOf(_)!==-1,xe=D?.[x]??0,Se=be?ve:ge-C[_e]-w[_e]-xe+E.altAxis,Ce=be?ge+C[_e]+w[_e]-xe-E.altAxis:ye,we=p&&be?gD(Se,ge,Ce):hD(p?Se:ve,ge,p?Ce:ye);S[x]=we,O[x]=we-ge}t.modifiersData[r]=O}}var fO={name:`preventOverflow`,enabled:!0,phase:`main`,fn:dO,requiresIfExists:[`offset`]};function pO(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function mO(e){return e===GE(e)||!qE(e)?LD(e):pO(e)}function hO(e){var t=e.getBoundingClientRect(),n=tD(t.width)/e.offsetWidth||1,r=tD(t.height)/e.offsetHeight||1;return n!==1||r!==1}function gO(e,t,n){n===void 0&&(n=!1);var r=qE(t),i=qE(t)&&hO(t),a=lD(t),o=iD(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((WE(t)!==`body`||VD(a))&&(s=mO(t)),qE(t)?(c=iD(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=RD(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function _O(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function vO(e){var t=_O(e);return UE.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function yO(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function bO(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var xO={placement:`bottom`,modifiers:[],strategy:`absolute`};function SO(){return![...arguments].some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function CO(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?xO:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},xO,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:KE(e)?UD(e):e.contextElement?UD(e.contextElement):[],popper:UD(t)};var s=vO(bO([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(SO(t,n)){i.rects={reference:gO(t,pD(n),i.options.strategy===`fixed`),popper:aD(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:yO(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!SO(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var wO=CO({defaultModifiers:[MD,lO,kD,ZE,sO,eO,fO,CD,iO]}),TO=`tippy-box`,EO=`tippy-content`,DO=`tippy-backdrop`,OO=`tippy-arrow`,kO=`tippy-svg-arrow`,AO={passive:!0,capture:!0},jO=function(){return document.body};function MO(e,t,n){return Array.isArray(e)?e[t]??(Array.isArray(n)?n[t]:n):e}function NO(e,t){var n={}.toString.call(e);return n.indexOf(`[object`)===0&&n.indexOf(t+`]`)>-1}function PO(e,t){return typeof e==`function`?e.apply(void 0,t):e}function FO(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function IO(e){return e.split(/\s+/).filter(Boolean)}function LO(e){return[].concat(e)}function RO(e,t){e.indexOf(t)===-1&&e.push(t)}function zO(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function BO(e){return e.split(`-`)[0]}function VO(e){return[].slice.call(e)}function HO(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function UO(){return document.createElement(`div`)}function WO(e){return[`Element`,`Fragment`].some(function(t){return NO(e,t)})}function GO(e){return NO(e,`NodeList`)}function KO(e){return NO(e,`MouseEvent`)}function qO(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function JO(e){return WO(e)?[e]:GO(e)?VO(e):Array.isArray(e)?e:VO(document.querySelectorAll(e))}function YO(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+`ms`)})}function XO(e,t){e.forEach(function(e){e&&e.setAttribute(`data-state`,t)})}function ZO(e){var t,n=LO(e)[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function QO(e,t){var n=t.clientX,r=t.clientY;return e.every(function(e){var t=e.popperRect,i=e.popperState,a=e.props.interactiveBorder,o=BO(i.placement),s=i.modifiersData.offset;if(!s)return!0;var c=o===`bottom`?s.top.y:0,l=o===`top`?s.bottom.y:0,u=o===`right`?s.left.x:0,d=o===`left`?s.right.x:0,f=t.top-r+c>a,p=r-t.bottom-l>a,m=t.left-n+u>a,h=n-t.right-d>a;return f||p||m||h})}function $O(e,t,n){var r=t+`EventListener`;[`transitionend`,`webkitTransitionEnd`].forEach(function(t){e[r](t,n)})}function ek(e,t){for(var n=t;n;){if(e.contains(n))return!0;n=n.getRootNode==null?void 0:n.getRootNode()?.host}return!1}var tk={isTouch:!1},nk=0;function rk(){tk.isTouch||(tk.isTouch=!0,window.performance&&document.addEventListener(`mousemove`,ik))}function ik(){var e=performance.now();e-nk<20&&(tk.isTouch=!1,document.removeEventListener(`mousemove`,ik)),nk=e}function ak(){var e=document.activeElement;if(qO(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function ok(){document.addEventListener(`touchstart`,rk,AO),window.addEventListener(`blur`,ak)}var sk=typeof window<`u`&&typeof document<`u`?!!window.msCrypto:!1,ck=Object.assign({appendTo:jO,aria:{content:`auto`,expanded:`auto`},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:``,offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:`top`,plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:`mouseenter focus`,triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:`fade`,arrow:!0,content:``,inertia:!1,maxWidth:350,role:`tooltip`,theme:``,zIndex:9999}),lk=Object.keys(ck),uk=function(e){Object.keys(e).forEach(function(t){ck[t]=e[t]})};function dk(e){var t=(e.plugins||[]).reduce(function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=e[r]===void 0?ck[r]??i:e[r]),t},{});return Object.assign({},e,t)}function fk(e,t){return(t?Object.keys(dk(Object.assign({},ck,{plugins:t}))):lk).reduce(function(t,n){var r=(e.getAttribute(`data-tippy-`+n)||``).trim();if(!r)return t;if(n===`content`)t[n]=r;else try{t[n]=JSON.parse(r)}catch{t[n]=r}return t},{})}function pk(e,t){var n=Object.assign({},t,{content:PO(t.content,[e])},t.ignoreAttributes?{}:fk(e,t.plugins));return n.aria=Object.assign({},ck.aria,n.aria),n.aria={expanded:n.aria.expanded===`auto`?t.interactive:n.aria.expanded,content:n.aria.content===`auto`?t.interactive?null:`describedby`:n.aria.content},n}var mk=function(){return`innerHTML`};function hk(e,t){e[mk()]=t}function gk(e){var t=UO();return e===!0?t.className=OO:(t.className=kO,WO(e)?t.appendChild(e):hk(t,e)),t}function _k(e,t){WO(t.content)?(hk(e,``),e.appendChild(t.content)):typeof t.content!=`function`&&(t.allowHTML?hk(e,t.content):e.textContent=t.content)}function vk(e){var t=e.firstElementChild,n=VO(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(EO)}),arrow:n.find(function(e){return e.classList.contains(OO)||e.classList.contains(kO)}),backdrop:n.find(function(e){return e.classList.contains(DO)})}}function yk(e){var t=UO(),n=UO();n.className=TO,n.setAttribute(`data-state`,`hidden`),n.setAttribute(`tabindex`,`-1`);var r=UO();r.className=EO,r.setAttribute(`data-state`,`hidden`),_k(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(n,r){var i=vk(t),a=i.box,o=i.content,s=i.arrow;r.theme?a.setAttribute(`data-theme`,r.theme):a.removeAttribute(`data-theme`),typeof r.animation==`string`?a.setAttribute(`data-animation`,r.animation):a.removeAttribute(`data-animation`),r.inertia?a.setAttribute(`data-inertia`,``):a.removeAttribute(`data-inertia`),a.style.maxWidth=typeof r.maxWidth==`number`?r.maxWidth+`px`:r.maxWidth,r.role?a.setAttribute(`role`,r.role):a.removeAttribute(`role`),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&_k(o,e.props),r.arrow?s?n.arrow!==r.arrow&&(a.removeChild(s),a.appendChild(gk(r.arrow))):a.appendChild(gk(r.arrow)):s&&a.removeChild(s)}return{popper:t,onUpdate:i}}yk.$$tippy=!0;var bk=1,xk=[],Sk=[];function Ck(e,t){var n=pk(e,Object.assign({},ck,dk(HO(t)))),r,i,a,o=!1,s=!1,c=!1,l=!1,u,d,f,p=[],m=FO(de,n.interactiveDebounce),h,g=bk++,_=null,v=zO(n.plugins),y={id:g,reference:e,popper:UO(),popperInstance:_,props:n,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:Ce,setProps:we,setContent:Te,show:Ee,hide:De,hideWithInteractivity:Oe,enable:xe,disable:Se,unmount:R,destroy:ke};if(!n.render)return y;var b=n.render(y),x=b.popper,S=b.onUpdate;x.setAttribute(`data-tippy-root`,``),x.id=`tippy-`+y.id,y.popper=x,e._tippy=y,x._tippy=y;var C=v.map(function(e){return e.fn(y)}),w=e.hasAttribute(`aria-expanded`);return L(),P(),M(),N(`onCreate`,[y]),n.showOnCreate&&ye(),x.addEventListener(`mouseenter`,function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),x.addEventListener(`mouseleave`,function(){y.props.interactive&&y.props.trigger.indexOf(`mouseenter`)>=0&&k().addEventListener(`mousemove`,m)}),y;function T(){var e=y.props.touch;return Array.isArray(e)?e:[e,0]}function E(){return T()[0]===`hold`}function D(){var e;return!!((e=y.props.render)!=null&&e.$$tippy)}function O(){return h||e}function k(){var e=O().parentNode;return e?ZO(e):document}function A(){return vk(x)}function j(e){return y.state.isMounted&&!y.state.isVisible||tk.isTouch||u&&u.type===`focus`?0:MO(y.props.delay,+!e,ck.delay)}function M(e){e===void 0&&(e=!1),x.style.pointerEvents=y.props.interactive&&!e?``:`none`,x.style.zIndex=``+y.props.zIndex}function N(e,t,n){if(n===void 0&&(n=!0),C.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=y.props)[e].apply(r,t)}}function ee(){var t=y.props.aria;if(t.content){var n=`aria-`+t.content,r=x.id;LO(y.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(y.state.isVisible)e.setAttribute(n,t?t+` `+r:r);else{var i=t&&t.replace(r,``).trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function P(){w||!y.props.aria.expanded||LO(y.props.triggerTarget||e).forEach(function(e){y.props.interactive?e.setAttribute(`aria-expanded`,y.state.isVisible&&e===O()?`true`:`false`):e.removeAttribute(`aria-expanded`)})}function F(){k().removeEventListener(`mousemove`,m),xk=xk.filter(function(e){return e!==m})}function te(t){if(!(tk.isTouch&&(c||t.type===`mousedown`))){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(y.props.interactive&&ek(x,n))){if(LO(y.props.triggerTarget||e).some(function(e){return ek(e,n)})){if(tk.isTouch||y.state.isVisible&&y.props.trigger.indexOf(`click`)>=0)return}else N(`onClickOutside`,[y,t]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),s=!0,setTimeout(function(){s=!1}),y.state.isMounted||ie())}}}function I(){c=!0}function ne(){c=!1}function re(){var e=k();e.addEventListener(`mousedown`,te,!0),e.addEventListener(`touchend`,te,AO),e.addEventListener(`touchstart`,ne,AO),e.addEventListener(`touchmove`,I,AO)}function ie(){var e=k();e.removeEventListener(`mousedown`,te,!0),e.removeEventListener(`touchend`,te,AO),e.removeEventListener(`touchstart`,ne,AO),e.removeEventListener(`touchmove`,I,AO)}function ae(e,t){se(e,function(){!y.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()})}function oe(e,t){se(e,t)}function se(e,t){var n=A().box;function r(e){e.target===n&&($O(n,`remove`,r),t())}if(e===0)return t();$O(n,`remove`,d),$O(n,`add`,r),d=r}function ce(t,n,r){r===void 0&&(r=!1),LO(y.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),p.push({node:e,eventType:t,handler:n,options:r})})}function L(){E()&&(ce(`touchstart`,ue,{passive:!0}),ce(`touchend`,fe,{passive:!0})),IO(y.props.trigger).forEach(function(e){if(e!==`manual`)switch(ce(e,ue),e){case`mouseenter`:ce(`mouseleave`,fe);break;case`focus`:ce(sk?`focusout`:`blur`,pe);break;case`focusin`:ce(`focusout`,pe);break}})}function le(){p.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),p=[]}function ue(e){var t=!1;if(!(!y.state.isEnabled||me(e)||s)){var n=u?.type===`focus`;u=e,h=e.currentTarget,P(),!y.state.isVisible&&KO(e)&&xk.forEach(function(t){return t(e)}),e.type===`click`&&(y.props.trigger.indexOf(`mouseenter`)<0||o)&&y.props.hideOnClick!==!1&&y.state.isVisible?t=!0:ye(e),e.type===`click`&&(o=!t),t&&!n&&be(e)}}function de(e){var t=e.target,r=O().contains(t)||x.contains(t);e.type===`mousemove`&&r||QO(ve().concat(x).map(function(e){var t=e._tippy.popperInstance?.state;return t?{popperRect:e.getBoundingClientRect(),popperState:t,props:n}:null}).filter(Boolean),e)&&(F(),be(e))}function fe(e){if(!(me(e)||y.props.trigger.indexOf(`click`)>=0&&o)){if(y.props.interactive){y.hideWithInteractivity(e);return}be(e)}}function pe(e){y.props.trigger.indexOf(`focusin`)<0&&e.target!==O()||y.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||be(e)}function me(e){return tk.isTouch?E()!==e.type.indexOf(`touch`)>=0:!1}function he(){ge();var t=y.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,o=t.moveTransition,s=D()?vk(x).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||O()}:e,l=[{name:`offset`,options:{offset:i}},{name:`preventOverflow`,options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:`flip`,options:{padding:5}},{name:`computeStyles`,options:{adaptive:!o}},{name:`$$tippy`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;if(D()){var n=A().box;[`placement`,`reference-hidden`,`escaped`].forEach(function(e){e===`placement`?n.setAttribute(`data-placement`,t.placement):t.attributes.popper[`data-popper-`+e]?n.setAttribute(`data-`+e,``):n.removeAttribute(`data-`+e)}),t.attributes.popper={}}}}];D()&&s&&l.push({name:`arrow`,options:{element:s,padding:3}}),l.push.apply(l,n?.modifiers||[]),y.popperInstance=wO(c,x,Object.assign({},n,{placement:r,onFirstUpdate:f,modifiers:l}))}function ge(){y.popperInstance&&=(y.popperInstance.destroy(),null)}function _e(){var e=y.props.appendTo,t,n=O();t=y.props.interactive&&e===jO||e===`parent`?n.parentNode:PO(e,[n]),t.contains(x)||t.appendChild(x),y.state.isMounted=!0,he()}function ve(){return VO(x.querySelectorAll(`[data-tippy-root]`))}function ye(e){y.clearDelayTimeouts(),e&&N(`onTrigger`,[y,e]),re();var t=j(!0),n=T(),i=n[0],a=n[1];tk.isTouch&&i===`hold`&&a&&(t=a),t?r=setTimeout(function(){y.show()},t):y.show()}function be(e){if(y.clearDelayTimeouts(),N(`onUntrigger`,[y,e]),!y.state.isVisible){ie();return}if(!(y.props.trigger.indexOf(`mouseenter`)>=0&&y.props.trigger.indexOf(`click`)>=0&&[`mouseleave`,`mousemove`].indexOf(e.type)>=0&&o)){var t=j(!1);t?i=setTimeout(function(){y.state.isVisible&&y.hide()},t):a=requestAnimationFrame(function(){y.hide()})}}function xe(){y.state.isEnabled=!0}function Se(){y.hide(),y.state.isEnabled=!1}function Ce(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(a)}function we(t){if(!y.state.isDestroyed){N(`onBeforeUpdate`,[y,t]),le();var n=y.props,r=pk(e,Object.assign({},n,HO(t),{ignoreAttributes:!0}));y.props=r,L(),n.interactiveDebounce!==r.interactiveDebounce&&(F(),m=FO(de,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?LO(n.triggerTarget).forEach(function(e){e.removeAttribute(`aria-expanded`)}):r.triggerTarget&&e.removeAttribute(`aria-expanded`),P(),M(),S&&S(n,r),y.popperInstance&&(he(),ve().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),N(`onAfterUpdate`,[y,t])}}function Te(e){y.setProps({content:e})}function Ee(){var e=y.state.isVisible,t=y.state.isDestroyed,n=!y.state.isEnabled,r=tk.isTouch&&!y.props.touch,i=MO(y.props.duration,0,ck.duration);if(!(e||t||n||r)&&!O().hasAttribute(`disabled`)&&(N(`onShow`,[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,D()&&(x.style.visibility=`visible`),M(),re(),y.state.isMounted||(x.style.transition=`none`),D()){var a=A(),o=a.box,s=a.content;YO([o,s],0)}f=function(){var e;if(!(!y.state.isVisible||l)){if(l=!0,x.offsetHeight,x.style.transition=y.props.moveTransition,D()&&y.props.animation){var t=A(),n=t.box,r=t.content;YO([n,r],i),XO([n,r],`visible`)}ee(),P(),RO(Sk,y),(e=y.popperInstance)==null||e.forceUpdate(),N(`onMount`,[y]),y.props.animation&&D()&&oe(i,function(){y.state.isShown=!0,N(`onShown`,[y])})}},_e()}}function De(){var e=!y.state.isVisible,t=y.state.isDestroyed,n=!y.state.isEnabled,r=MO(y.props.duration,1,ck.duration);if(!(e||t||n)&&(N(`onHide`,[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,l=!1,o=!1,D()&&(x.style.visibility=`hidden`),F(),ie(),M(!0),D()){var i=A(),a=i.box,s=i.content;y.props.animation&&(YO([a,s],r),XO([a,s],`hidden`))}ee(),P(),y.props.animation?D()&&ae(r,y.unmount):y.unmount()}}function Oe(e){k().addEventListener(`mousemove`,m),RO(xk,m),m(e)}function R(){y.state.isVisible&&y.hide(),y.state.isMounted&&(ge(),ve().forEach(function(e){e._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Sk=Sk.filter(function(e){return e!==y}),y.state.isMounted=!1,N(`onHidden`,[y]))}function ke(){y.state.isDestroyed||(y.clearDelayTimeouts(),y.unmount(),le(),delete e._tippy,y.state.isDestroyed=!0,N(`onDestroy`,[y]))}}function wk(e,t){t===void 0&&(t={});var n=ck.plugins.concat(t.plugins||[]);ok();var r=Object.assign({},t,{plugins:n}),i=JO(e).reduce(function(e,t){var n=t&&Ck(t,r);return n&&e.push(n),e},[]);return WO(e)?i[0]:i}wk.defaultProps=ck,wk.setDefaultProps=uk,wk.currentInput=tk,Object.assign({},ZE,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),wk.setDefaultProps({render:yk});var Tk=Hf.create({name:`slash-command`,addOptions(){return{suggestion:{char:`/`,command:({editor:e,range:t,props:n})=>{n.command({editor:e,range:t})}}}},addProseMirrorPlugins(){return[AE({editor:this.editor,...this.options.suggestion})]}}),Ek=e=>{let t=null,n=null;return{onStart:r=>{t=new Xm(Cc,{props:r,editor:r.editor});let{selection:i}=r.editor.state;if(i.$from.node(i.$from.depth).type.name===`codeBlock`)return!1;n=wk(`body`,{getReferenceClientRect:r.clientRect,appendTo:()=>e?e.current:document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:`manual`,placement:`bottom-start`})},onUpdate:e=>{t?.updateProps(e),n?.[0]?.setProps({getReferenceClientRect:e.clientRect})},onKeyDown:e=>e.event.key===`Escape`?(n?.[0]?.hide(),!0):t?.ref?.onKeyDown(e),onExit:()=>{n?.[0]?.destroy(),t?.destroy()}}},Dk=e=>e,Ok=e=>{if([`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&document.querySelector(`#slash-command`))return!0},kk=Hf.create({name:`CustomKeymap`,addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:e,commands:t})=>{let{state:n}=e,{tr:r}=n,i=r.selection.$from.start(),a=r.selection.$to.end();return t.setTextSelection({from:i,to:a})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:e})=>{let{state:t}=e,{tr:n}=t,r=n.selection.from,i=n.selection.to,a=n.selection.$from.start(),o=n.selection.$to.end();return r>a||i<o?(e.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),Ak=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,jk=Cp.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,gd(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=gd(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new lp({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ap({find:Ak,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),Mk=jk.extend({name:`image`,addAttributes(){return{...this.parent?.(),width:{default:null},height:{default:null}}}}),Nk=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/,Pk=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g,Fk=Mf.create({name:`ai-highlight`,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setAIHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleAIHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetAIHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleAIHighlight()}},addInputRules(){return[ip({find:Nk,type:this.type})]},addPasteRules(){return[wp({find:Pk,type:this.type})]}}),Ik=e=>{let t=e.state.tr;t.removeMark(0,e.state.doc.nodeSize-2,e.state.schema.marks[`ai-highlight`]),e.view.dispatch(t)},Lk=(e,t)=>{e.chain().setAIHighlight({color:t??`#c1ecf970`}).run()};function Rk(e={}){return new Or({view(t){return new zk(t,e)}})}var zk=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Hn(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},Bk=class e extends B{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):B.near(r)}content(){return z.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Vk(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Uk(e)||!Wk(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!H.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};Bk.prototype.visible=!1,Bk.findFrom=Bk.findGapCursorFrom,B.jsonID(`gapcursor`,Bk);var Vk=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Bk.valid(t)?new Bk(t):B.near(t)}};function Hk(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Uk(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Hk(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Wk(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Hk(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Gk(){return new Or({props:{decorations:Xk,createSelectionBetween(e,t,n){return t.pos==n.pos&&Bk.valid(n)?new Bk(n):null},handleClick:Jk,handleKeyDown:Kk,handleDOMEvents:{beforeinput:Yk}}})}var Kk=Fl({ArrowLeft:qk(`horiz`,-1),ArrowRight:qk(`horiz`,1),ArrowUp:qk(`vert`,-1),ArrowDown:qk(`vert`,1)});function qk(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof V){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=Bk.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new Bk(c))),!0):!1}}function Jk(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Bk.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&H.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Bk(r))),!0)}function Yk(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof Bk))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=R.empty;for(let e=r.length-1;e>=0;e--)i=R.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new z(i,0,0));return a.setSelection(V.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Xk(e){if(!(e.selection instanceof Bk))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,_s.create(e.doc,[ms.widget(e.selection.head,t,{key:`gapcursor`})])}var Zk=200,Qk=function(){};Qk.prototype.append=function(e){return e.length?(e=Qk.from(e),!this.length&&e||e.length<Zk&&this.leafAppend(e)||this.length<Zk&&e.leafPrepend(this)||this.appendInner(e)):this},Qk.prototype.prepend=function(e){return e.length?Qk.from(e).append(this):this},Qk.prototype.appendInner=function(e){return new eA(this,e)},Qk.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Qk.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Qk.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Qk.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Qk.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Qk.from=function(e){return e instanceof Qk?e:e&&e.length?new $k(e):Qk.empty};var $k=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Zk)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Zk)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Qk);Qk.empty=new $k([]);var eA=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Qk),tA=500,nA=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new iA(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new iA(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new iA(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>oA&&(s=rA(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new on;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new iA(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new iA(i,o,l))}else r.push(new iA(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new iA(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>tA&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new iA(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(Qk.from(i.reverse()),a)}};nA.empty=new nA(Qk.empty,0);function rA(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var iA=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},aA=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},oA=20;function sA(e,t,n,r){let i=n.getMeta(hA),a;if(i)return i.historyState;n.getMeta(gA)&&(e=new aA(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(hA))return o.getMeta(hA).redo?new aA(e.done.addTransform(n,void 0,r,mA(t)),e.undone,lA(n.mapping.maps),e.prevTime,e.prevComposition):new aA(e.done,e.undone.addTransform(n,void 0,r,mA(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!cA(n,e.prevRanges)),s=o?uA(e.prevRanges,n.mapping):lA(n.mapping.maps);return new aA(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,mA(t)),nA.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new aA(e.done.rebased(n,a),e.undone.rebased(n,a),uA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new aA(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),uA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function cA(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function lA(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function uA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function dA(e,t,n){let r=mA(t),i=hA.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new aA(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(hA,{redo:n,historyState:c})}var fA=!1,pA=null;function mA(e){let t=e.plugins;if(pA!=t){fA=!1,pA=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){fA=!0;break}}return fA}var hA=new jr(`history`),gA=new jr(`closeHistory`);function _A(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Or({key:hA,state:{init(){return new aA(nA.empty,nA.empty,null,0,-1)},apply(t,n,r){return sA(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?yA:n==`historyRedo`?bA:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function vA(e,t){return(n,r)=>{let i=hA.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=dA(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var yA=vA(!1,!0),bA=vA(!0,!0),xA=Hf.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Or({key:new jr(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),SA=Hf.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Rk(this.options)]}});Hf.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Or({key:new jr(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return _s.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(ms.node(t,t+e.nodeSize,{class:this.options.className}))}),_s.create(e,a)}}})]}});var CA=Hf.create({name:`gapCursor`,addProseMirrorPlugins(){return[Gk()]},extendNodeSchema(e){return{allowGapCursor:ud(G(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),wA=`placeholder`,TA=new jr(`tiptap__placeholder`),EA=200;function DA(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),ms.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function OA(e,t){return typeof e==`function`?e(t):e}function kA({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Gd(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(DA({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:OA(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else{let i=TA.getState(e.state),c=i?.topPos??0,l=i?.bottomPos??r.content.size;r.nodesBetween(c,l,(r,i)=>{let c=a>=i&&a<=i+r.nodeSize,l=!r.isLeaf&&Gd(r);return r.type.isTextblock&&(c||!t.showOnlyCurrent)&&l&&o.push(DA({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:c,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:OA(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:c})},node:r,pos:i})),t.includeChildren})}return _s.create(r,o)}function AA(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function jA(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function MA(e){let t=e;for(;t;){if(jA(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function NA(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function PA({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?NA(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-EA,o=Math.min(r.bottom,i.bottom)+EA;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var FA={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(TA);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function IA(e){let t=MA(e.dom),n=()=>{let n=PA({view:e,doc:e.state.doc,scrollContainer:t}),r=TA.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(TA,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function LA({editor:e,options:t}){let n=t.dataAttribute?`data-${AA(t.dataAttribute)}`:`data-${wA}`;return new Or({key:TA,state:FA,view:IA,props:{decorations:({doc:r,selection:i})=>kA({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}var RA=Hf.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:wA,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[LA({editor:this.editor,options:this.options})]}}),zA=`.ProseMirror:not(.ProseMirror-focused) *::selection {
380
- background: transparent;
381
- }
382
-
383
- .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
384
- background: transparent;
385
- }`;Hf.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&np(zA,e.options.injectNonce,`selection`),[new Or({key:new jr(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Kd(n.selection)||e.view.dragging?null:_s.create(n.doc,[ms.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function BA({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var VA=Hf.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new jr(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Or({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!BA({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!BA({node:r,types:n})}}})]}}),HA=Hf.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>yA(e,t),redo:()=>({state:e,dispatch:t})=>bA(e,t)}},addProseMirrorPlugins(){return[_A(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),UA=xA,WA=20,GA=(e,t=0)=>{let n=[];return!e.children.length||t>WA||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...GA(e,t+1))}),n},KA=e=>{if(!e.children.length)return;let t=GA(e);t&&t.forEach(e=>{let t=e.getAttribute(`style`),n=(e.parentElement?.closest(`span`))?.getAttribute(`style`);e.setAttribute(`style`,`${n};${t}`)})},qA=Mf.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&KA(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,gd(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),JA=Hf.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(fp(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),YA=Hf.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(fp(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),XA=Hf.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>fp(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),ZA=Hf.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>fp(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),QA=Hf.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>fp(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}});Hf.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(JA.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(YA.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(XA.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(ZA.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(QA.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(qA.configure(this.options.textStyle)),e}});var $A=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,ej=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,tj=Mf.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||fp(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,gd(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ip({find:$A,type:this.type})]},addPasteRules(){return[wp({find:ej,type:this.type})]}}),nj=Cp.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,gd(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!up(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Kd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(V.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(H.create(t.doc,n.pos)):t.setSelection(V.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(V.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ap({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rj=nj,ij=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,aj=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,oj=`numeric`,sj=`ascii`,cj=`alpha`,lj=`asciinumeric`,uj=`alphanumeric`,dj=`domain`,fj=`emoji`,pj=`scheme`,mj=`slashscheme`,hj=`whitespace`;function gj(e,t){return e in t||(t[e]=[]),t[e]}function _j(e,t,n){t[oj]&&(t[lj]=!0,t[uj]=!0),t[sj]&&(t[lj]=!0,t[cj]=!0),t[lj]&&(t[uj]=!0),t[cj]&&(t[uj]=!0),t[uj]&&(t[dj]=!0),t[fj]&&(t[dj]=!0);for(let r in t){let t=gj(r,n);t.indexOf(e)<0&&t.push(e)}}function vj(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function yj(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}yj.groups={},yj.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=yj.groups;let i;return t&&t.j?i=t:(i=new yj(t),n&&r&&_j(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=yj.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new yj,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new yj,a&&(r&&(o.t&&typeof o.t==`string`?_j(a,Object.assign(vj(o.t,r),n),r):n&&_j(a,n,r)),o.t=a),i.j[e]=o,o}};var bj=(e,t,n,r,i)=>e.ta(t,n,r,i),xj=(e,t,n,r,i)=>e.tr(t,n,r,i),Sj=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),Cj=`WORD`,wj=`UWORD`,Tj=`ASCIINUMERICAL`,Ej=`ALPHANUMERICAL`,Dj=`LOCALHOST`,Oj=`TLD`,kj=`UTLD`,Aj=`SCHEME`,jj=`SLASH_SCHEME`,Mj=`NUM`,Nj=`WS`,Pj=`NL`,Fj=`OPENBRACE`,Ij=`CLOSEBRACE`,Lj=`OPENBRACKET`,Rj=`CLOSEBRACKET`,zj=`OPENPAREN`,Bj=`CLOSEPAREN`,Vj=`OPENANGLEBRACKET`,Hj=`CLOSEANGLEBRACKET`,Uj=`FULLWIDTHLEFTPAREN`,Wj=`FULLWIDTHRIGHTPAREN`,Gj=`LEFTCORNERBRACKET`,Kj=`RIGHTCORNERBRACKET`,qj=`LEFTWHITECORNERBRACKET`,Jj=`RIGHTWHITECORNERBRACKET`,Yj=`FULLWIDTHLESSTHAN`,Xj=`FULLWIDTHGREATERTHAN`,Zj=`AMPERSAND`,Qj=`APOSTROPHE`,$j=`ASTERISK`,eM=`AT`,tM=`BACKSLASH`,nM=`BACKTICK`,rM=`CARET`,iM=`COLON`,aM=`COMMA`,oM=`DOLLAR`,sM=`DOT`,cM=`EQUALS`,lM=`EXCLAMATION`,uM=`HYPHEN`,dM=`PERCENT`,fM=`PIPE`,pM=`PLUS`,mM=`POUND`,hM=`QUERY`,gM=`QUOTE`,_M=`FULLWIDTHMIDDLEDOT`,vM=`SEMI`,yM=`SLASH`,bM=`TILDE`,xM=`UNDERSCORE`,SM=`EMOJI`,CM=`SYM`,wM=Object.freeze({__proto__:null,ALPHANUMERICAL:Ej,AMPERSAND:Zj,APOSTROPHE:Qj,ASCIINUMERICAL:Tj,ASTERISK:$j,AT:eM,BACKSLASH:tM,BACKTICK:nM,CARET:rM,CLOSEANGLEBRACKET:Hj,CLOSEBRACE:Ij,CLOSEBRACKET:Rj,CLOSEPAREN:Bj,COLON:iM,COMMA:aM,DOLLAR:oM,DOT:sM,EMOJI:SM,EQUALS:cM,EXCLAMATION:lM,FULLWIDTHGREATERTHAN:Xj,FULLWIDTHLEFTPAREN:Uj,FULLWIDTHLESSTHAN:Yj,FULLWIDTHMIDDLEDOT:_M,FULLWIDTHRIGHTPAREN:Wj,HYPHEN:uM,LEFTCORNERBRACKET:Gj,LEFTWHITECORNERBRACKET:qj,LOCALHOST:Dj,NL:Pj,NUM:Mj,OPENANGLEBRACKET:Vj,OPENBRACE:Fj,OPENBRACKET:Lj,OPENPAREN:zj,PERCENT:dM,PIPE:fM,PLUS:pM,POUND:mM,QUERY:hM,QUOTE:gM,RIGHTCORNERBRACKET:Kj,RIGHTWHITECORNERBRACKET:Jj,SCHEME:Aj,SEMI:vM,SLASH:yM,SLASH_SCHEME:jj,SYM:CM,TILDE:bM,TLD:Oj,UNDERSCORE:xM,UTLD:kj,UWORD:wj,WORD:Cj,WS:Nj}),TM=/[a-z]/,EM=/\p{L}/u,DM=/\p{Emoji}/u,OM=/\d/,kM=/\s/,AM=`\r`,jM=`
386
- `,MM=`️`,NM=`‍`,PM=``,FM=null,IM=null;function LM(e=[]){let t={};yj.groups=t;let n=new yj;FM??=VM(ij),IM??=VM(aj),$(n,`'`,Qj),$(n,`{`,Fj),$(n,`}`,Ij),$(n,`[`,Lj),$(n,`]`,Rj),$(n,`(`,zj),$(n,`)`,Bj),$(n,`<`,Vj),$(n,`>`,Hj),$(n,`(`,Uj),$(n,`)`,Wj),$(n,`「`,Gj),$(n,`」`,Kj),$(n,`『`,qj),$(n,`』`,Jj),$(n,`<`,Yj),$(n,`>`,Xj),$(n,`&`,Zj),$(n,`*`,$j),$(n,`@`,eM),$(n,"`",nM),$(n,`^`,rM),$(n,`:`,iM),$(n,`,`,aM),$(n,`$`,oM),$(n,`.`,sM),$(n,`=`,cM),$(n,`!`,lM),$(n,`-`,uM),$(n,`%`,dM),$(n,`|`,fM),$(n,`+`,pM),$(n,`#`,mM),$(n,`?`,hM),$(n,`"`,gM),$(n,`/`,yM),$(n,`;`,vM),$(n,`~`,bM),$(n,`_`,xM),$(n,`\\`,tM),$(n,`・`,_M);let r=xj(n,OM,Mj,{[oj]:!0});xj(r,OM,r);let i=xj(r,TM,Tj,{[lj]:!0}),a=xj(r,EM,Ej,{[uj]:!0}),o=xj(n,TM,Cj,{[sj]:!0});xj(o,OM,i),xj(o,TM,o),xj(i,OM,i),xj(i,TM,i);let s=xj(n,EM,wj,{[cj]:!0});xj(s,TM),xj(s,OM,a),xj(s,EM,s),xj(a,OM,a),xj(a,TM),xj(a,EM,a);let c=$(n,jM,Pj,{[hj]:!0}),l=$(n,AM,Nj,{[hj]:!0}),u=xj(n,kM,Nj,{[hj]:!0});$(n,PM,u),$(l,jM,c),$(l,PM,u),xj(l,kM,u),$(u,AM),$(u,jM),xj(u,kM,u),$(u,PM,u);let d=xj(n,DM,SM,{[fj]:!0});$(d,`#`),xj(d,DM,d),$(d,MM,d);let f=$(d,NM);$(f,`#`),xj(f,DM,d);let p=[[TM,o],[OM,i]],m=[[TM,null],[EM,s],[OM,a]];for(let e=0;e<FM.length;e++)BM(n,FM[e],Oj,Cj,p);for(let e=0;e<IM.length;e++)BM(n,IM[e],kj,wj,m);_j(Oj,{tld:!0,ascii:!0},t),_j(kj,{utld:!0,alpha:!0},t),BM(n,`file`,Aj,Cj,p),BM(n,`mailto`,Aj,Cj,p),BM(n,`http`,jj,Cj,p),BM(n,`https`,jj,Cj,p),BM(n,`ftp`,jj,Cj,p),BM(n,`ftps`,jj,Cj,p),_j(Aj,{scheme:!0,ascii:!0},t),_j(jj,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[pj]:!0}:{[mj]:!0};r.indexOf(`-`)>=0?i[dj]=!0:TM.test(r)?OM.test(r)?i[lj]=!0:i[sj]=!0:i[oj]=!0,Sj(n,r,r,i)}return Sj(n,`localhost`,Dj,{ascii:!0}),n.jd=new yj(CM),{start:n,tokens:Object.assign({groups:t},wM)}}function RM(e,t){let n=zM(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function zM(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function BM(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new yj(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new yj(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function VM(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var HM={defaultProtocol:`http`,events:null,format:WM,formatHref:WM,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function UM(e,t=null){let n=Object.assign({},HM);e&&(n=Object.assign(n,e instanceof UM?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}UM.prototype={o:HM,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:HM[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function WM(e){return e}function GM(e,t){this.t=`token`,this.v=e,this.tk=t}GM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=HM.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function KM(e,t){class n extends GM{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var qM=KM(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),JM=KM(`text`),YM=KM(`nl`),XM=KM(`url`,{isLink:!0,toHref(e=HM.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Dj&&e[1].t===iM}}),ZM=e=>new yj(e);function QM({groups:e}){let t=e.domain.concat([Zj,$j,eM,tM,nM,rM,oM,cM,uM,Mj,dM,fM,pM,mM,yM,CM,bM,xM]),n=[Qj,iM,aM,sM,lM,dM,hM,gM,vM,Vj,Hj,Fj,Ij,Rj,Lj,zj,Bj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj],r=[Zj,Qj,$j,tM,nM,rM,oM,cM,uM,Fj,Ij,dM,fM,pM,mM,hM,yM,CM,bM,xM],i=ZM(),a=$(i,bM);bj(a,r,a),bj(a,e.domain,a);let o=ZM(),s=ZM(),c=ZM();bj(i,e.domain,o),bj(i,e.scheme,s),bj(i,e.slashscheme,c),bj(o,r,a),bj(o,e.domain,o);let l=$(o,eM);$(a,eM,l),$(s,eM,l),$(c,eM,l);let u=$(a,sM);bj(u,r,a),bj(u,e.domain,a);let d=ZM();bj(l,e.domain,d),bj(d,e.domain,d);let f=$(d,sM);bj(f,e.domain,d);let p=ZM(qM);bj(f,e.tld,p),bj(f,e.utld,p),$(l,Dj,p);let m=$(d,uM);$(m,uM,m),bj(m,e.domain,d),bj(p,e.domain,d),$(p,sM,f),$(p,uM,m);let h=$(o,uM),g=$(o,sM);$(h,uM,h),bj(h,e.domain,o),bj(g,r,a),bj(g,e.domain,o);let _=ZM(XM);bj(g,e.tld,_),bj(g,e.utld,_),bj(_,e.domain,o),bj(_,r,a),$(_,sM,g),$(_,uM,h),$(_,eM,l);let v=$(_,iM),y=ZM(XM);bj(v,e.numeric,y);let b=ZM(XM),x=ZM();bj(b,t,b),bj(b,n,x),bj(x,t,b),bj(x,n,x),$(_,yM,b),$(y,yM,b);let S=$(s,iM),C=$($($(c,iM),yM),yM);bj(s,e.domain,o),$(s,sM,g),$(s,uM,h),bj(c,e.domain,o),$(c,sM,g),$(c,uM,h),bj(S,e.domain,b),$(S,yM,b),$(S,hM,b),bj(C,e.domain,b),bj(C,t,b),$(C,yM,b);let w=[[Fj,Ij],[Lj,Rj],[zj,Bj],[Vj,Hj],[Uj,Wj],[Gj,Kj],[qj,Jj],[Yj,Xj]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a);let o=ZM(XM);bj(a,t,o);let s=ZM();bj(a,n,s),$(a,i,b),bj(o,t,o),bj(o,n,s),bj(s,t,o),bj(s,n,s),$(o,i,b),$(s,i,b)}return $(i,Dj,_),$(i,Pj,YM),{start:i,tokens:wM}}function $M(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(eN(JM,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(eN(e,t,r))}}return o.length>0&&a.push(eN(JM,t,o)),a}function eN(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var tN=typeof console<`u`&&console&&console.warn||(()=>{}),nN=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,rN={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function iN(){return yj.groups={},rN.scanner=null,rN.parser=null,rN.tokenQueue=[],rN.pluginQueue=[],rN.customSchemes=[],rN.initialized=!1,rN}function aN(e,t=!1){if(rN.initialized&&tN(`linkifyjs: already initialized - will not register custom scheme "${e}" ${nN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
387
- 1. Must only contain digits, lowercase ASCII letters or "-"
388
- 2. Cannot start or end with "-"
389
- 3. "-" cannot repeat`);rN.customSchemes.push([e,t])}function oN(){rN.scanner=LM(rN.customSchemes);for(let e=0;e<rN.tokenQueue.length;e++)rN.tokenQueue[e][1]({scanner:rN.scanner});rN.parser=QM(rN.scanner.tokens);for(let e=0;e<rN.pluginQueue.length;e++)rN.pluginQueue[e][1]({scanner:rN.scanner,parser:rN.parser});return rN.initialized=!0,rN}function sN(e){return rN.initialized||oN(),$M(rN.parser.start,e,RM(rN.scanner.start,e))}sN.scan=RM;function cN(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new UM(n),i=sN(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var lN=`[\0- \xA0 ᠎ -\u2029  ]`,uN=new RegExp(lN),dN=RegExp(`${lN}$`),fN=new RegExp(lN,`g`);function pN(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function mN(e){return new Or({key:new jr(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Nd(td(n.doc,[...t])).forEach(({newRange:t})=>{let n=id(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!dN.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(uN).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=sN(n).map(t=>t.toObject(e.defaultProtocol));if(!pN(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Pd(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function hN(e){return new Or({key:new jr(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=Ad(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function gN(e){return new Or({key:new jr(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=cN(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function _N(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(fN,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var vN=Mf.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){aN(e);return}aN(e.scheme,e.optionalSlashes)})},onDestroy(){iN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!_N(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!_N(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!_N(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,gd(this.options.HTMLAttributes,e),0]:[`a`,gd(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!_N(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!_N(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[wp({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=cN(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!_N(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(mN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!_N(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(hN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(gN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),yN=vN,bN=RA,xN=Object.defineProperty,SN=(e,t)=>{for(var n in t)xN(e,n,{get:t[n],enumerable:!0})},CN=`listItem`,wN=`textStyle`,TN=/^\s*([-+*])\s$/,EN=Cp.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,gd(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
390
- `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(CN,this.editor.getAttributes(wN)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=sp({find:TN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=sp({find:TN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wN),editor:this.editor})),[e]}}),DN=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},ON=(e,t,n,r)=>{let i=DN(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,R.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},kN=(e,t,n)=>ON(e.state,e.view.dispatch,t,n),AN=(e,t)=>Hf.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>kN(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}});function jN(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function MN(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var NN=Cp.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,gd(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(jN(e))return{type:`listItem`,content:[{type:`paragraph`,content:MN(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>xp(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addExtensions(){return[AN(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});SN({},{findListItemPos:()=>PN,getNextListDepth:()=>FN,handleBackspace:()=>LN,handleDelete:()=>BN,hasListBefore:()=>IN,hasListItemAfter:()=>VN,hasListItemBefore:()=>HN,listItemHasSubList:()=>UN,nextListIsDeeper:()=>RN,nextListIsHigher:()=>zN});var PN=(e,t)=>{let{$from:n}=t.selection,r=Jl(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},FN=(e,t)=>{let n=PN(e,t);if(!n)return!1;let[,r]=Fd(t,e,n.$pos.pos+4);return r},IN=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},LN=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Lu(e.state,t)&&IN(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!Lu(e.state,t)||!Hd(e.state)?!1:e.chain().liftListItem(t).run()},RN=(e,t)=>{let n=FN(e,t),r=PN(e,t);return!r||!n?!1:n>r.depth},zN=(e,t)=>{let n=FN(e,t),r=PN(e,t);return!r||!n?!1:n<r.depth},BN=(e,t)=>{if(!Lu(e.state,t)||!Vd(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:RN(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():zN(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},VN=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},HN=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},UN=(e,t,n)=>{if(!n)return!1;let r=Jl(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},WN=Hf.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&BN(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&BN(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&LN(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&LN(e,n,r)&&(t=!0)}),t}}}}),GN=/^(\s*)(\d+)\.\s+(.*)$/,KN=/^\s/;function qN(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function JN(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&qN(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function YN(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(GN);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(GN))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(KN))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
391
- `).trim(),contentLines:u,raw:f.join(`
392
- `)}),r=d,n=d}return[t,r]}function XN(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=JN(a.contentLines),c=o.join(`
393
- `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
394
- `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=XN(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
395
- `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function ZN(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var QN=`listItem`,$N=`textStyle`,eP=/^(\d+)\.\s$/,tP=Cp.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,gd(this.options.HTMLAttributes,n),0]:[`ol`,gd(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?ZN(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
396
- `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
397
- `),[i,a]=YN(r);if(i.length===0)return;let o=XN(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
398
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QN,this.editor.getAttributes($N)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=sp({find:eP,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=sp({find:eP,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($N)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),nP=/^\s*(\[([( |x])?\])\s$/,rP=Cp.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,gd(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>xp(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[AN(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=_d(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[sp({find:nP,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),iP=Cp.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,gd(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
399
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=bp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=bp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Hf.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(EN.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(NN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(WN.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(tP.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(rP.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(iP.configure(this.options.taskList)),e}});var aP=Mf.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gd(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),oP=aP,sP=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,cP=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,lP=e=>e.match(sP),uP=(e,t)=>t?`https://www.youtube-nocookie.com/embed/videoseries?list=`:e?`https://www.youtube-nocookie.com/embed/`:`https://www.youtube.com/embed/`,dP=e=>{let{url:t,allowFullscreen:n,autoplay:r,ccLanguage:i,ccLoadPolicy:a,controls:o,disableKBcontrols:s,enableIFrameApi:c,endTime:l,interfaceLanguage:u,ivLoadPolicy:d,loop:f,modestBranding:p,nocookie:m,origin:h,playlist:g,progressBarColor:_,startAt:v,rel:y}=e;if(!lP(t))return null;if(t.includes(`/embed/`))return t;if(t.includes(`youtu.be`)){let e=t.split(`/`).pop();return e?`${uP(m)}${e}`:null}let b=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(t);if(!b||!b[2])return null;let x=`${uP(m,b[1]===`list`)}${b[2]}`,S=[];return n===!1&&S.push(`fs=0`),r&&S.push(`autoplay=1`),i&&S.push(`cc_lang_pref=${i}`),a&&S.push(`cc_load_policy=1`),o||S.push(`controls=0`),s&&S.push(`disablekb=1`),c&&S.push(`enablejsapi=1`),l&&S.push(`end=${l}`),u&&S.push(`hl=${u}`),d&&S.push(`iv_load_policy=${d}`),f&&S.push(`loop=1`),p&&S.push(`modestbranding=1`),h&&S.push(`origin=${h}`),g&&S.push(`playlist=${g}`),v&&S.push(`start=${v}`),_&&S.push(`color=${_}`),y!==void 0&&S.push(`rel=${y}`),S.length&&(x+=`${b[1]===`list`?`&`:`?`}${S.join(`&`)}`),x},fP=e=>{let t;try{t=new URL(e)}catch{return null}let n=t.hostname.replace(/^www\./,``);if(n!==`youtube.com`&&n!==`youtube-nocookie.com`)return null;let r=null;if(t.pathname===`/embed/videoseries`){let e=t.searchParams.get(`list`);if(!e)return null;r=`https://www.youtube.com/playlist?list=${e}`}else{let e=t.pathname.match(/^\/embed\/([\w-]+)$/);if(!e?.[1])return null;r=`https://www.youtube.com/watch?v=${e[1]}`}if(!lP(r))return null;let i={src:r},a=t.searchParams.get(`start`);if(a){let e=Number.parseInt(a,10);Number.isNaN(e)||(i.start=e)}return i},pP=e=>{if(!e)return null;let t=Number.parseInt(e,10);return Number.isNaN(t)?null:t},mP=e=>{let t=e.getAttribute(`src`);return t?fP(t)||{src:t}:null},hP=Cp.create({name:`youtube`,addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:``,playlist:``,progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null,parseHTML:e=>mP(e)?.src},start:{default:0,parseHTML:e=>mP(e)?.start},width:{default:this.options.width,parseHTML:e=>pP(e.getAttribute(`width`))},height:{default:this.options.height,parseHTML:e=>pP(e.getAttribute(`height`))}}},parseHTML(){return[{tag:`div[data-youtube-video] iframe`}]},addCommands(){return{setYoutubeVideo:e=>({commands:t})=>lP(e.src)?t.insertContent({type:this.name,attrs:e}):!1}},addPasteRules(){return this.options.addPasteHandler?[Tp({find:cP,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return e.src=dP({url:e.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:e.start||0,rel:this.options.rel}),[`div`,{"data-youtube-video":``},[`iframe`,gd(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},e)]]},...hp({nodeName:`youtube`,allowedAttributes:[`src`,`width`,`height`,`start`]})}),gP=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function _P(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=_P(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function vP(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=vP(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var yP=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return _P(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return vP(this,e,t,n)}findIndex(e){if(e==0)return xP(0,e);if(e==this.size)return xP(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?xP(t+1,i):xP(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};yP.empty=new yP([],0);var bP={index:0,offset:0};function xP(e,t){return bP.index=e,bP.offset=t,bP}function SP(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!SP(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!SP(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var CP=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&SP(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};CP.none=[];var wP=class extends Error{},TP=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=DP(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(EP(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(yP.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};TP.empty=new TP(yP.empty,0,0);function EP(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(EP(a.content,t-i-1,n-i-1)))}function DP(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=DP(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function OP(e,t,n){if(n.openStart>e.depth)throw new wP(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new wP(`Inconsistent open depths`);return kP(e,t,n,0)}function kP(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=kP(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return PP(a,IP(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return PP(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=LP(n,e);return PP(a,FP(e,i,o,t,r))}}function AP(e,t){if(!t.type.compatibleContent(e.type))throw new wP(`Cannot join `+t.type.name+` onto `+e.type.name)}function jP(e,t,n){let r=e.node(n);return AP(r,t.node(n)),r}function MP(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function NP(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(MP(e.nodeAfter,r),a++));for(let e=a;e<o;e++)MP(i.child(e),r);t&&t.depth==n&&t.textOffset&&MP(t.nodeBefore,r)}function PP(e,t){return e.type.checkContent(t),e.copy(t)}function FP(e,t,n,r,i){let a=e.depth>i&&jP(e,t,i+1),o=r.depth>i&&jP(n,r,i+1),s=[];return NP(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(AP(a,o),MP(PP(a,FP(e,t,n,r,i+1)),s)):(a&&MP(PP(a,IP(e,t,i+1)),s),NP(t,n,i,s),o&&MP(PP(o,IP(n,r,i+1)),s)),NP(r,null,i,s),new yP(s)}function IP(e,t,n){let r=[];return NP(null,e,n,r),e.depth>n&&MP(PP(jP(e,t,n+1),IP(e,t,n+1)),r),NP(t,null,n,r),new yP(r)}function LP(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(yP.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var RP=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return CP.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new HP(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=VP.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else VP.set(t,r=new zP);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%BP,i}},zP=class{constructor(){this.elts=[],this.i=0}},BP=12,VP=new WeakMap,HP=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},UP=Object.create(null),WP=class e{constructor(e,t,n,r=CP.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||yP.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&SP(this.attrs,t||e.defaultAttrs||UP)&&CP.sameSet(this.marks,n||CP.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return TP.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new TP(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return OP(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return RP.resolveCached(this,e)}resolveNoCache(e){return RP.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),GP(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=yP.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=CP.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!CP.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=yP.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};WP.prototype.text=void 0;function GP(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var KP=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new qP(t,n);if(r.next==null)return e.empty;let i=JP(r);r.next&&r.err(`Unexpected trailing text`);let a=iF(tF(i));return aF(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return yP.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
400
- `)}};KP.empty=new KP(!0);var qP=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function JP(e){let t=[];do t.push(YP(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function YP(e){let t=[];do t.push(XP(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function XP(e){let t=eF(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=QP(e,t);else break;return t}function ZP(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function QP(e,t){let n=ZP(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ZP(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function $P(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function eF(e){if(e.eat(`(`)){let t=JP(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=$P(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function tF(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function nF(e,t){return t-e}function rF(e,t){let n=[];return r(t),n.sort(nF);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function iF(e){let t=Object.create(null);return n(rF(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);rF(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new KP(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(nF);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function aF(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var oF=65535,sF=2**16;function cF(e,t){return e+t*sF}function lF(e){return e&oF}function uF(e){return(e-(e&oF))/sF}var dF=1,fF=2,pF=4,mF=8,hF=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mF)>0}get deletedBefore(){return(this.delInfo&(dF|pF))>0}get deletedAfter(){return(this.delInfo&(fF|pF))>0}get deletedAcross(){return(this.delInfo&pF)>0}},gF=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=lF(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+uF(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:cF(o/3,e-s),f=e==s?fF:e==u?dF:pF;return(t<0?e!=s:e!=u)&&(f|=mF),new hF(a,f,d)}r+=l-c}return n?e+r:new hF(e+r,0,null)}touches(e,t){let n=0,r=lF(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};gF.empty=new gF([]);var _F=Object.create(null),vF=class{getMap(){return gF.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=_F[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in _F)throw RangeError(`Duplicate use of step JSON ID `+e);return _F[e]=t,t.prototype.jsonID=e,t}},yF=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof wP)return e.fail(t.message);throw t}}};function bF(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(bF(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return yP.fromArray(r)}var xF=class e extends vF{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new TP(bF(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return yF.fromReplace(e,this.from,this.to,i)}invert(){return new SF(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vF.jsonID(`addMark`,xF);var SF=class e extends vF{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new TP(bF(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return yF.fromReplace(e,this.from,this.to,n)}invert(){return new xF(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vF.jsonID(`removeMark`,SF);var CF=class e extends vF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yF.fromReplace(e,this.pos,this.pos+1,new TP(yP.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new wF(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vF.jsonID(`addNodeMark`,CF);var wF=class e extends vF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yF.fromReplace(e,this.pos,this.pos+1,new TP(yP.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new CF(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vF.jsonID(`removeNodeMark`,wF);var TF=class e extends vF{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&DF(e,this.from,this.to)?yF.fail(`Structure replace would overwrite content`):yF.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gF([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?TP.empty:new TP(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?TP.empty:new TP(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,TP.fromJSON(t,n.slice),!!n.structure)}};TF.MAP_BIAS=1,vF.jsonID(`replace`,TF);var EF=class e extends vF{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(DF(e,this.from,this.gapFrom)||DF(e,this.gapTo,this.to)))return yF.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yF.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?yF.fromReplace(e,this.from,this.to,n):yF.fail(`Content does not fit in gap`)}getMap(){return new gF([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,TP.fromJSON(t,n.slice),n.insert,!!n.structure)}};vF.jsonID(`replaceAround`,EF);function DF(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var OF=class e extends vF{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return yF.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return yF.fromReplace(e,this.pos,this.pos+1,new TP(yP.from(r),0,+!t.isLeaf))}getMap(){return gF.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};vF.jsonID(`attr`,OF);var kF=class e extends vF{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return yF.ok(n)}getMap(){return gF.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};vF.jsonID(`docAttr`,kF);var AF=class extends Error{};AF=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},AF.prototype=Object.create(Error.prototype),AF.prototype.constructor=AF,AF.prototype.name=`TransformError`;var jF=Object.create(null),MF=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new NF(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=TP.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?TP.empty:t),o==0&&UF(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),UF(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new IF(e):HF(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?HF(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):HF(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new BF(e.node(0))}static atStart(e){return HF(e,e,0,0,1)||new BF(e)}static atEnd(e){return HF(e,e,e.content.size,e.childCount,-1)||new BF(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=jF[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in jF)throw RangeError(`Duplicate use of selection JSON ID `+e);return jF[e]=t,t.prototype.jsonID=e,t}getBookmark(){return IF.between(this.$anchor,this.$head).getBookmark()}};MF.prototype.visible=!0;var NF=class{constructor(e,t){this.$from=e,this.$to=t}},PF=!1;function FF(e){!PF&&!e.parent.inlineContent&&(PF=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var IF=class e extends MF{constructor(e,t=e){FF(e),FF(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return MF.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=TP.empty){if(super.replace(e,t),t==TP.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new LF(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=MF.findFrom(n,r,!0)||MF.findFrom(n,-r,!0);if(e)n=e.$head;else return MF.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(MF.findFrom(t,-r,!0)||MF.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};MF.jsonID(`text`,IF);var LF=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return IF.between(e.resolve(this.anchor),e.resolve(this.head))}},RF=class e extends MF{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?MF.near(a):new e(a)}content(){return new TP(yP.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new zF(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};RF.prototype.visible=!1,MF.jsonID(`node`,RF);var zF=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new LF(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&RF.isSelectable(n)?new RF(t):MF.near(t)}},BF=class e extends MF{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=TP.empty){if(t==TP.empty){e.delete(0,e.doc.content.size);let t=MF.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return VF}};MF.jsonID(`all`,BF);var VF={map(){return this},resolve(e){return new BF(e)}};function HF(e,t,n,r,i,a=!1){if(t.inlineContent)return IF.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=HF(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&RF.isSelectable(r))return RF.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function UF(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof TF||i instanceof EF))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(MF.near(e.doc.resolve(o),n))}function WF(e,t){return!t||!e?e:e.bind(t)}var GF=class{constructor(e,t,n){this.name=e,this.init=WF(t.init,n),this.apply=WF(t.apply,n)}};new GF(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new GF(`selection`,{init(e,t){return e.selection||MF.atStart(t.doc)},apply(e){return e.selection}}),new GF(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new GF(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var KF=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(IF.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},qF=/^\s*>\s$/,JF=Cp.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return gP(`blockquote`,{...gd(this.options.HTMLAttributes,e),children:gP(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
401
- `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
402
- `))}),n.join(`
403
- >
404
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>KF(this.editor,this.type)}},addInputRules(){return[sp({find:qF,type:this.type})]}}),YF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,XF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ZF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$F=Mf.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return gP(`strong`,{...gd(this.options.HTMLAttributes,e),children:gP(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ip({find:YF,type:this.type}),ip({find:ZF,type:this.type})]},addPasteRules(){return[wp({find:XF,type:this.type}),wp({find:QF,type:this.type})]}}),eI=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},tI=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},nI=Mf.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,gd(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ip({find:eI,type:this.type})]},addPasteRules(){return[wp({find:tI,type:this.type})]}}),rI=4,iI=/^```([a-z]+)?[\s\n]$/,aI=/^~~~([a-z]+)?[\s\n]$/,oI=Cp.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:rI,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,gd(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
405
- `):`\`\`\`${r}
406
-
407
- \`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rI,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
408
- `,`
409
- `).split(`
410
- `).map(e=>o+e).join(`
411
- `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rI,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
412
- `,`
413
- `).split(`
414
- `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(V.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
415
- `,`
416
- `).split(`
417
- `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
418
- `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
419
-
420
- `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(B.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[op({find:iI,type:this.type,getAttributes:e=>({language:e[1]})}),op({find:aI,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Or({key:new jr(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
421
- `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(V.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),sI=Cp.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
422
-
423
- `):``}),cI=Cp.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,gd(this.options.HTMLAttributes,e)]},renderText(){return`
424
- `},renderMarkdown:()=>`
425
- `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),lI=Cp.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,gd(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>op({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),uI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,fI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,mI=Mf.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ip({find:uI,type:this.type}),ip({find:fI,type:this.type})]},addPasteRules(){return[wp({find:dI,type:this.type}),wp({find:pI,type:this.type})]}}),hI=`&nbsp;`,gI=`\xA0`,_I=Cp.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gd(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===hI||n[0].text===hI||n[0].raw===gI||n[0].text===gI)&&r.length===1&&r[0].type===`text`&&(r[0].text===hI||r[0].text===gI)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?hI:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),vI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,bI=Mf.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gd(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ip({find:vI,type:this.type})]},addPasteRules(){return[wp({find:yI,type:this.type})]}}),xI=Cp.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),SI=Hf.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push($F.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(JF.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(EN.configure(this.options.bulletList)),this.options.code!==!1&&e.push(nI.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(oI.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(sI.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(SA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(CA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(cI.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(lI.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(HA.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(nj.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(mI.configure(this.options.italic)),this.options.listItem!==!1&&e.push(NN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(WN.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(vN.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(tP.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(_I.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(bI.configure(this.options.strike)),this.options.text!==!1&&e.push(xI.configure(this.options.text)),this.options.underline!==!1&&e.push(aP.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(VA.configure(this.options?.trailingNode)),e}});function CI(){try{return oc}catch{return null}}function wI(e,t){if(e&&typeof e.serializeForClipboard==`function`)return e.serializeForClipboard(t);let n=CI();if(n&&typeof n?.__serializeForClipboard==`function`)return n.__serializeForClipboard(e,t);throw Error(`No supported clipboard serialization method found.`)}function TI(e){let t=e.getBoundingClientRect(),n=e.closest(`[role="dialog"]`);if(n&&window.getComputedStyle(n).transform!==`none`){let e=n.getBoundingClientRect();return{top:t.top-e.top,left:t.left-e.left,width:t.width}}return{top:t.top,left:t.left,width:t.width}}function EI(e,t){let n=[`li`,`p:not(:first-child)`,`pre`,`blockquote`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,...t.customNodes.map(e=>`[data-type=${e}]`)].join(`, `);return document.elementsFromPoint(e.x,e.y).find(e=>e.parentElement?.matches?.(`.ProseMirror`)||e.matches(n))}function DI(e,t,n){let r=e.getBoundingClientRect();return t.posAtCoords({left:r.left+50+n.dragHandleWidth,top:r.top+1})?.inside}function OI(e,t){let n=t.state.doc.resolve(e);return n.depth>1?n.before(n.depth):e}function kI(e){let t=``;function n(n,r){if(r.focus(),!n.dataTransfer)return;let i=EI({x:n.clientX+50+e.dragHandleWidth,y:n.clientY},e);if(!(i instanceof Element))return;let a=DI(i,r,e);if(a==null||a<0)return;a=OI(a,r);let{from:o,to:s}=r.state.selection,c=o-s,l=OI(o,r),u=!1,d=r.state.doc.resolve(l);if(d.node().type.name===`doc`)u=!0;else{let e=H.create(r.state.doc,d.before());u=!(a+1>=e.$from.pos&&a<=e.$to.pos)}let f=r.state.selection;if(!u&&c!==0&&!(r.state.selection instanceof H)){let e=H.create(r.state.doc,s-1);f=V.create(r.state.doc,a,e.$to.pos)}else if(f=H.create(r.state.doc,a),f.node.type.isInline||f.node.type.name===`tableRow`){let e=r.state.doc.resolve(f.from);f=H.create(r.state.doc,e.before())}r.dispatch(r.state.tr.setSelection(f)),r.state.selection instanceof H&&r.state.selection.node.type.name===`listItem`&&(t=i.parentElement.tagName);let p=r.state.selection.content(),{dom:m,text:h}=wI(r,p);n.dataTransfer.clearData(),n.dataTransfer.setData(`text/html`,m.innerHTML),n.dataTransfer.setData(`text/plain`,h),n.dataTransfer.effectAllowed=`copyMove`,n.dataTransfer.setDragImage(i,0,0),r.dragging={slice:p,move:n.ctrlKey}}let r=null;function i(){r&&r.classList.add(`hide`)}function a(){r&&r.classList.remove(`hide`)}function o(e){if(e.target instanceof Element){let t=e.relatedTarget;if(t?.classList.contains(`tiptap`)||t?.classList.contains(`drag-handle`))return}i()}return new Or({key:new jr(e.pluginKey),view:t=>{let a=e.dragHandleSelector?document.querySelector(e.dragHandleSelector):null;r=a??document.createElement(`div`),r.draggable=!0,r.dataset.dragHandle=``,r.classList.add(`drag-handle`);function s(e){n(e,t)}r.addEventListener(`dragstart`,s);function c(t){i();let n=window.scrollY;t.clientY<e.scrollTreshold?window.scrollTo({top:n-30,behavior:`smooth`}):window.innerHeight-t.clientY<e.scrollTreshold&&window.scrollTo({top:n+30,behavior:`smooth`})}return r.addEventListener(`drag`,c),i(),a||t?.dom?.parentElement?.appendChild(r),t?.dom?.parentElement?.addEventListener(`mouseout`,o),{destroy:()=>{a||r?.remove?.(),r?.removeEventListener(`drag`,c),r?.removeEventListener(`dragstart`,s),r=null,t?.dom?.parentElement?.removeEventListener(`mouseout`,o)}}},props:{handleDOMEvents:{mousemove:(t,n)=>{if(!t.editable)return;let o=EI({x:n.clientX+50+e.dragHandleWidth,y:n.clientY},e),s=o?.closest(`.not-draggable`),c=e.excludedTags.concat([`ol`,`ul`]).join(`, `);if(!(o instanceof Element)||o.matches(c)||s){i();return}let l=window.getComputedStyle(o),u=parseInt(l.lineHeight,10),d=isNaN(u)?parseInt(l.fontSize)*1.2:u,f=parseInt(l.paddingTop,10),p=TI(o);p.top+=(d-24)/2,p.top+=f,o.matches(`ul:not([data-type=taskList]) li, ol li`)&&(p.left-=e.dragHandleWidth),p.width=e.dragHandleWidth,r&&(r.style.left=`${p.left-p.width}px`,r.style.top=`${p.top}px`,a())},keydown:()=>{i()},mousewheel:()=>{i()},dragstart:e=>{e.dom.classList.add(`dragging`)},drop:(e,n)=>{e.dom.classList.remove(`dragging`),i();let r=null,a=e.posAtCoords({left:n.clientX,top:n.clientY});if(!a||(e.state.selection instanceof H&&(r=e.state.selection.node),!r))return;let o=e.state.doc.resolve(a.pos).parent.type.name===`listItem`;if(e.state.selection instanceof H&&e.state.selection.node.type.name===`listItem`&&!o&&t==`OL`){let t=e.state.schema.nodes.orderedList?.createAndFill(null,r);e.dragging={slice:new z(R.from(t),0,0),move:n.ctrlKey}}},dragend:e=>{e.dom.classList.remove(`dragging`)}}}})}var AI=Hf.create({name:`globalDragHandle`,addOptions(){return{dragHandleWidth:20,scrollTreshold:100,excludedTags:[],customNodes:[]}},addProseMirrorPlugins(){return[kI({pluginKey:`globalDragHandle`,dragHandleWidth:this.options.dragHandleWidth,scrollTreshold:this.options.scrollTreshold,dragHandleSelector:this.options.dragHandleSelector,excludedTags:this.options.excludedTags,customNodes:this.options.customNodes})]}}),jI={};function MI(e){let t=jI[e];if(t)return t;t=jI[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function NI(e,t){typeof t!=`string`&&(t=NI.defaultChars);let n=MI(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}NI.defaultChars=`;/?:@&=+$,#`,NI.componentChars=``;var PI={};function FI(e){let t=PI[e];if(t)return t;t=PI[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function II(e,t,n){typeof t!=`string`&&(n=t,t=II.defaultChars),n===void 0&&(n=!0);let r=FI(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}II.defaultChars=`;/?:@&=+$,-_.!~*'()#`,II.componentChars=`-_.!~*'()`;function LI(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function RI(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var zI=/^([a-z0-9.+-]+:)/i,BI=/:[0-9]*$/,VI=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,HI=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
426
- `,` `],UI=[`/`,`?`,`#`],WI=255,GI=/^[+a-z0-9A-Z_-]{0,63}$/,KI=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,qI={javascript:!0,"javascript:":!0},JI={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function YI(e,t){if(e&&e instanceof RI)return e;let n=new RI;return n.parse(e,t),n}RI.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=VI.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=zI.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&qI[o])&&(a=a.substr(2),this.slashes=!0)),!qI[o]&&(i||o&&!JI[o])){let e=-1;for(let t=0;t<UI.length;t++)r=a.indexOf(UI[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<HI.length;t++)r=a.indexOf(HI[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(GI)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(GI)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(KI);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>WI&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),JI[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},RI.prototype.parseHost=function(e){let t=BI.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var XI=t({decode:()=>NI,encode:()=>II,format:()=>LI,parse:()=>YI}),ZI=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,QI=/[\0-\x1F\x7F-\x9F]/,$I=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,eL=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,tL=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,nL=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,rL=t({Any:()=>ZI,Cc:()=>QI,Cf:()=>$I,P:()=>eL,S:()=>tL,Z:()=>nL}),iL=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),aL=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),oL=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),sL=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function cL(e){return e>=55296&&e<=57343||e>1114111?65533:oL.get(e)??e}var lL;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(lL||={});var uL=32,dL;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(dL||={});function fL(e){return e>=lL.ZERO&&e<=lL.NINE}function pL(e){return e>=lL.UPPER_A&&e<=lL.UPPER_F||e>=lL.LOWER_A&&e<=lL.LOWER_F}function mL(e){return e>=lL.UPPER_A&&e<=lL.UPPER_Z||e>=lL.LOWER_A&&e<=lL.LOWER_Z||fL(e)}function hL(e){return e===lL.EQUALS||mL(e)}var gL;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(gL||={});var _L;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(_L||={});var vL=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=gL.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=_L.Strict}startEntity(e){this.decodeMode=e,this.state=gL.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case gL.EntityStart:return e.charCodeAt(t)===lL.NUM?(this.state=gL.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=gL.NamedEntity,this.stateNamedEntity(e,t));case gL.NumericStart:return this.stateNumericStart(e,t);case gL.NumericDecimal:return this.stateNumericDecimal(e,t);case gL.NumericHex:return this.stateNumericHex(e,t);case gL.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|uL)===lL.LOWER_X?(this.state=gL.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=gL.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(fL(r)||pL(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(fL(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===lL.SEMI)this.consumed+=1;else if(this.decodeMode===_L.Strict)return 0;return this.emitCodePoint(cL(this.result),this.consumed),this.errors&&(e!==lL.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&dL.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=bL(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===_L.Attribute&&(i===0||hL(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&dL.VALUE_LENGTH)>>14,i!==0){if(a===lL.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==_L.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&dL.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~dL.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case gL.NamedEntity:return this.result!==0&&(this.decodeMode!==_L.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case gL.NumericDecimal:return this.emitNumericEntity(0,2);case gL.NumericHex:return this.emitNumericEntity(0,3);case gL.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case gL.EntityStart:return 0}}};function yL(e){let t=``,n=new vL(e,e=>t+=sL(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function bL(e,t,n,r){let i=(t&dL.BRANCH_LENGTH)>>7,a=t&dL.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var xL=yL(iL);yL(aL);function SL(e,t=_L.Legacy){return xL(e,t)}var CL=t({arrayReplaceAt:()=>kL,assign:()=>OL,escapeHtml:()=>HL,escapeRE:()=>WL,fromCodePoint:()=>jL,has:()=>DL,isMdAsciiPunct:()=>JL,isPunctChar:()=>qL,isSpace:()=>GL,isString:()=>TL,isValidEntityCode:()=>AL,isWhiteSpace:()=>KL,lib:()=>XL,normalizeReference:()=>YL,unescapeAll:()=>LL,unescapeMd:()=>IL});function wL(e){return Object.prototype.toString.call(e)}function TL(e){return wL(e)===`[object String]`}var EL=Object.prototype.hasOwnProperty;function DL(e,t){return EL.call(e,t)}function OL(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function kL(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function AL(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function jL(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var ML=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,NL=RegExp(ML.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),PL=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function FL(e,t){if(t.charCodeAt(0)===35&&PL.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return AL(n)?jL(n):e}let n=SL(e);return n===e?e:n}function IL(e){return e.indexOf(`\\`)<0?e:e.replace(ML,`$1`)}function LL(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(NL,function(e,t,n){return t||FL(e,n)})}var RL=/[&<>"]/,zL=/[&<>"]/g,BL={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function VL(e){return BL[e]}function HL(e){return RL.test(e)?e.replace(zL,VL):e}var UL=/[.?*+^$[\]\\(){}|-]/g;function WL(e){return e.replace(UL,`\\$&`)}function GL(e){switch(e){case 9:case 32:return!0}return!1}function KL(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function qL(e){return eL.test(e)||tL.test(e)}function JL(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function YL(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}var XL={mdurl:XI,ucmicro:rL};function ZL(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function QL(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=LL(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=LL(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function $L(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=LL(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=LL(e.slice(t,a)),o}var eR=t({parseLinkDestination:()=>QL,parseLinkLabel:()=>ZL,parseLinkTitle:()=>$L}),tR={};tR.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+HL(a.content)+`</code>`},tR.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+HL(e[t].content)+`</code></pre>
427
- `},tR.fence=function(e,t,n,r,i){let a=e[t],o=a.info?LL(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||HL(a.content),l.indexOf(`<pre`)===0)return l+`
428
- `;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},tR.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},tR.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
429
- `:`<br>
430
- `},tR.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
431
- `:`<br>
432
- `:`
433
- `},tR.text=function(e,t){return HL(e[t].content)},tR.html_block=function(e,t){return e[t].content},tR.html_inline=function(e,t){return e[t].content};function nR(){this.rules=OL({},tR)}nR.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+HL(e.attrs[t][0])+`="`+HL(e.attrs[t][1])+`"`;return r},nR.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
434
- `),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
435
- `:`>`,i},nR.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},nR.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
436
- `;break;default:}return r},nR.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function rR(){this.__rules__=[],this.__cache__=null}rR.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},rR.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},rR.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},rR.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},rR.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},rR.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},rR.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},rR.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},rR.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},rR.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function iR(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}iR.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},iR.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},iR.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},iR.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},iR.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function aR(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}aR.prototype.Token=iR;var oR=/\r\n?|\n/g,sR=/\0/g;function cR(e){let t;t=e.src.replace(oR,`
437
- `),t=t.replace(sR,`�`),e.src=t}function lR(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function uR(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function dR(e){return/^<a[>\s]/i.test(e)}function fR(e){return/^<\/a\s*>/i.test(e)}function pR(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(dR(o.content)&&i>0&&i--,fR(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=kL(r,a,c)}}}}var mR=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,hR=/\((c|tm|r)\)/i,gR=/\((c|tm|r)\)/gi,_R={c:`©`,r:`®`,tm:`™`};function vR(e,t){return _R[t.toLowerCase()]}function yR(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(gR,vR)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function bR(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&mR.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function xR(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(hR.test(e.tokens[t].content)&&yR(e.tokens[t].children),mR.test(e.tokens[t].content)&&bR(e.tokens[t].children))}var SR=/['"]/,CR=/['"]/g,wR=`’`;function TR(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function ER(e,t){let n,r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){CR.lastIndex=c;let u=CR.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=i-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=i+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=JL(m)||qL(String.fromCharCode(m)),_=JL(h)||qL(String.fromCharCode(h)),v=KL(m),y=KL(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=TR(a.content,u.index,wR));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=t.md.options.quotes[2],f=t.md.options.quotes[3]):(o=t.md.options.quotes[0],f=t.md.options.quotes[1]),a.content=TR(a.content,u.index,f),e[d.token].content=TR(e[d.token].content,d.pos,o),c+=f.length-1,d.token===i&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:i,pos:u.index,single:p,level:o}):f&&p&&(a.content=TR(a.content,u.index,wR))}}}function DR(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!SR.test(e.tokens[t].content)||ER(e.tokens[t].children,e)}function OR(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var kR=[[`normalize`,cR],[`block`,lR],[`inline`,uR],[`linkify`,pR],[`replacements`,xR],[`smartquotes`,DR],[`text_join`,OR]];function AR(){this.ruler=new rR;for(let e=0;e<kR.length;e++)this.ruler.push(kR[e][0],kR[e][1])}AR.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},AR.prototype.State=aR;function jR(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(GL(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}jR.prototype.push=function(e,t,n){let r=new iR(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},jR.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},jR.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},jR.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&GL(this.src.charCodeAt(e));e++);return e},jR.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!GL(this.src.charCodeAt(--e)))return e+1;return e},jR.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},jR.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},jR.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(GL(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},jR.prototype.Token=iR;var MR=65536;function NR(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function PR(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function FR(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!GL(s)||o===45&&GL(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!GL(t))return!1;a++}let c=NR(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=NR(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=PR(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=NR(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=PR(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>MR))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function IR(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
438
- `,a.map=[t,e.line],!0}function LR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function RR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(GL(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function zR(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!GL(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function BR(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!GL(e.src.charCodeAt(r))?-1:r}function VR(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!GL(a))?-1:i}function HR(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function UR(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=VR(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=BR(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=VR(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=BR(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&HR(e,h),!0}function WR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!GL(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!GL(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&GL(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&GL(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=YL(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var GR=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),KR=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),qR=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),JR=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+GR.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(qR.source+`\\s*$`),/^$/,!1]];function YR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<JR.length&&!JR[s][0].test(o);s++);if(s===JR.length)return!1;if(r)return JR[s][2];let c=t+1;if(!JR[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),JR[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function XR(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!GL(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&GL(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=e.src.slice(i,a).trim(),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function ZR(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return!1;let c=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function QR(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var $R=[[`table`,FR,[`paragraph`,`reference`]],[`code`,IR],[`fence`,LR,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,RR,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,zR,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,UR,[`paragraph`,`reference`,`blockquote`]],[`reference`,WR],[`html_block`,YR,[`paragraph`,`reference`,`blockquote`]],[`heading`,XR,[`paragraph`,`reference`,`blockquote`]],[`lheading`,ZR],[`paragraph`,QR]];function ez(){this.ruler=new rR;for(let e=0;e<$R.length;e++)this.ruler.push($R[e][0],$R[e][1],{alt:($R[e][2]||[]).slice()})}ez.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},ez.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},ez.prototype.State=jR;function tz(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}tz.prototype.pushPending=function(){let e=new iR(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},tz.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new iR(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},tz.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32,a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32,c=JL(i)||qL(String.fromCharCode(i)),l=JL(s)||qL(String.fromCharCode(s)),u=KL(i),d=KL(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},tz.prototype.Token=iR;function nz(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function rz(e,t){let n=e.pos;for(;n<e.posMax&&!nz(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var iz=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function az(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(iz);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function oz(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&GL(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var sz=[];for(let e=0;e<256;e++)sz.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){sz[e.charCodeAt(0)]=1});function cz(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),GL(i));)n++;return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&sz[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function lz(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function uz(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function dz(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function fz(e){let t=e.tokens_meta,n=e.tokens_meta.length;dz(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&dz(e,t[r].delimiters)}var pz={tokenize:uz,postProcess:fz};function mz(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function hz(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function gz(e){let t=e.tokens_meta,n=e.tokens_meta.length;hz(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&hz(e,t[r].delimiters)}var _z={tokenize:mz,postProcess:gz};function vz(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!GL(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!GL(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!GL(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[YL(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function yz(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!GL(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!GL(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!GL(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[YL(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var bz=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,xz=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Sz(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(xz.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(bz.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function Cz(e){return/^<a[>\s]/i.test(e)}function wz(e){return/^<\/a\s*>/i.test(e)}function Tz(e){let t=e|32;return t>=97&&t<=122}function Ez(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!Tz(i))return!1;let a=e.src.slice(r).match(KR);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],Cz(t.content)&&e.linkLevel++,wz(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var Dz=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Oz=/^&([a-z][a-z0-9]{1,31});/i;function kz(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(Dz);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=AL(t)?jL(t):jL(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(Oz);if(r){let n=SL(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function Az(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function jz(e){let t=e.tokens_meta,n=e.tokens_meta.length;Az(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&Az(t[e].delimiters)}function Mz(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var Nz=[[`text`,rz],[`linkify`,az],[`newline`,oz],[`escape`,cz],[`backticks`,lz],[`strikethrough`,pz.tokenize],[`emphasis`,_z.tokenize],[`link`,vz],[`image`,yz],[`autolink`,Sz],[`html_inline`,Ez],[`entity`,kz]],Pz=[[`balance_pairs`,jz],[`strikethrough`,pz.postProcess],[`emphasis`,_z.postProcess],[`fragments_join`,Mz]];function Fz(){this.ruler=new rR;for(let e=0;e<Nz.length;e++)this.ruler.push(Nz[e][0],Nz[e][1]);this.ruler2=new rR;for(let e=0;e<Pz.length;e++)this.ruler2.push(Pz[e][0],Pz[e][1])}Fz.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},Fz.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},Fz.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},Fz.prototype.State=tz;function Iz(e){let t={};return e||={},t.src_Any=ZI.source,t.src_Cc=QI.source,t.src_Z=nL.source,t.src_P=eL.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`),t.src_pseudo_letter=`(?:(?![><|]|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|[><|]|`+t.src_ZPCc+`)(?!`+(e[`---`]?`-(?!--)|`:`-|`)+`_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|[><|]|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`|$)|;(?!`+t.src_ZCc+`|$)|\\!+(?!`+t.src_ZCc+`|[!]|$)|\\?(?!`+t.src_ZCc+`|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|[><|]|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}function Lz(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function Rz(e){return Object.prototype.toString.call(e)}function zz(e){return Rz(e)===`[object String]`}function Bz(e){return Rz(e)===`[object Object]`}function Vz(e){return Rz(e)===`[object RegExp]`}function Hz(e){return Rz(e)===`[object Function]`}function Uz(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var Wz={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Gz(e){return Object.keys(e||{}).reduce(function(e,t){return e||Wz.hasOwnProperty(t)},!1)}var Kz={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},qz=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,Jz=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function Yz(e){e.__index__=-1,e.__text_cache__=``}function Xz(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function Zz(){return function(e,t){t.normalize(e)}}function Qz(e){let t=e.re=Iz(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(qz),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,Bz(n)){Vz(n.validate)?r.validate=Xz(n.validate):Hz(n.validate)?r.validate=n.validate:a(t,n),Hz(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=Zz();return}if(zz(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:Zz()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(Uz).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`ig`),e.re.schema_at_start=RegExp(`^`+e.re.schema_search.source,`i`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),Yz(e)}function $z(e,t){let n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function eB(e,t){let n=new $z(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function tB(e,t){if(!(this instanceof tB))return new tB(e,t);t||Gz(e)&&(t=e,e={}),this.__opts__=Lz({},Wz,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=Lz({},Kz,e),this.__compiled__={},this.__tlds__=Jz,this.__tlds_replaced__=!1,this.re={},Qz(this)}tB.prototype.add=function(e,t){return this.__schemas__[e]=t,Qz(this),this},tB.prototype.set=function(e){return this.__opts__=Lz(this.__opts__,e),this},tB.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},tB.prototype.pretest=function(e){return this.re.pretest.test(e)},tB.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},tB.prototype.match=function(e){let t=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(eB(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(eB(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},tB.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,eB(this,0)):null},tB.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),Qz(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Qz(this),this)},tB.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},tB.prototype.onCompile=function(){};var nB=2147483647,rB=36,iB=1,aB=26,oB=38,sB=700,cB=72,lB=128,uB=`-`,dB=/^xn--/,fB=/[^\0-\x7F]/,pB=/[\x2E\u3002\uFF0E\uFF61]/g,mB={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},hB=rB-iB,gB=Math.floor,_B=String.fromCharCode;function vB(e){throw RangeError(mB[e])}function yB(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function bB(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(pB,`.`);let i=yB(e.split(`.`),t).join(`.`);return r+i}function xB(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var SB=e=>String.fromCodePoint(...e),CB=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:rB},wB=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},TB=function(e,t,n){let r=0;for(e=n?gB(e/sB):e>>1,e+=gB(e/t);e>455;r+=rB)e=gB(e/hB);return gB(r+36*e/(e+oB))},EB=function(e){let t=[],n=e.length,r=0,i=lB,a=cB,o=e.lastIndexOf(uB);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&vB(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=rB;;i+=rB){s>=n&&vB(`invalid-input`);let o=CB(e.charCodeAt(s++));o>=rB&&vB(`invalid-input`),o>gB((nB-r)/t)&&vB(`overflow`),r+=o*t;let c=i<=a?iB:i>=a+aB?aB:i-a;if(o<c)break;let l=rB-c;t>gB(nB/l)&&vB(`overflow`),t*=l}let c=t.length+1;a=TB(r-o,c,o==0),gB(r/c)>nB-i&&vB(`overflow`),i+=gB(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},DB=function(e){let t=[];e=xB(e);let n=e.length,r=lB,i=0,a=cB;for(let n of e)n<128&&t.push(_B(n));let o=t.length,s=o;for(o&&t.push(uB);s<n;){let n=nB;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>gB((nB-i)/c)&&vB(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>nB&&vB(`overflow`),n===r){let e=i;for(let n=rB;;n+=rB){let r=n<=a?iB:n>=a+aB?aB:n-a;if(e<r)break;let i=e-r,o=rB-r;t.push(_B(wB(r+i%o,0))),e=gB(i/o)}t.push(_B(wB(e,0))),a=TB(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},OB={version:`2.3.1`,ucs2:{decode:xB,encode:SB},decode:EB,encode:DB,toASCII:function(e){return bB(e,function(e){return fB.test(e)?`xn--`+DB(e):e})},toUnicode:function(e){return bB(e,function(e){return dB.test(e)?EB(e.slice(4).toLowerCase()):e})}},kB={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},AB=/^(vbscript|javascript|file|data):/,jB=/^data:image\/(gif|png|jpeg|webp);/;function MB(e){let t=e.trim().toLowerCase();return AB.test(t)?jB.test(t):!0}var NB=[`http:`,`https:`,`mailto:`];function PB(e){let t=YI(e,!0);if(t.hostname&&(!t.protocol||NB.indexOf(t.protocol)>=0))try{t.hostname=OB.toASCII(t.hostname)}catch{}return II(LI(t))}function FB(e){let t=YI(e,!0);if(t.hostname&&(!t.protocol||NB.indexOf(t.protocol)>=0))try{t.hostname=OB.toUnicode(t.hostname)}catch{}return NI(LI(t),NI.defaultChars+`%`)}function IB(e,t){if(!(this instanceof IB))return new IB(e,t);t||TL(e)||(t=e||{},e=`default`),this.inline=new Fz,this.block=new ez,this.core=new AR,this.renderer=new nR,this.linkify=new tB,this.validateLink=MB,this.normalizeLink=PB,this.normalizeLinkText=FB,this.utils=CL,this.helpers=OL({},eR),this.options={},this.configure(e),t&&this.set(t)}IB.prototype.set=function(e){return OL(this.options,e),this},IB.prototype.configure=function(e){let t=this;if(TL(e)){let t=e;if(e=kB[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},IB.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},IB.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},IB.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},IB.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},IB.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},IB.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},IB.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var LB=new Ct({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function RB(e,t){if(e.isText&&t.isText&&Me.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var zB=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:Me.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=RB(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:Me.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function BB(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function VB(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function HB(e){return e[e.length-1]==`
439
- `?e.slice(0,e.length-1):e}function UB(){}function WB(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);VB(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,BB(i,n,r,a)),e.addText(HB(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,BB(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,BB(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];VB(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(BB(i,n,r,a))),e.addText(HB(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(BB(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)VB(i,r)?n[r]=UB:(n[r+`_open`]=UB,n[r+`_close`]=UB);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var GB=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=WB(e,n)}parse(e,t={}){let n=new zB(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function KB(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new GB(LB,IB(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:KB(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:KB(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var qB={open:``,close:``,mixable:!0},JB=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new ZB(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
440
- `),e.text(t.textContent,!1),e.write(`
441
- `),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,` `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order||1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`![`+e.esc(t.attrs.alt||``)+`](`+t.attrs.src.replace(/[\(\)]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
442
- `);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=XB(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return YB(n.child(r),-1)},close(e,t,n,r){return YB(n.child(r-1),1)},escape:!1}});function YB(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function XB(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var ZB=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
443
- `),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
444
- `}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=qB}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
445
- `)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
446
- `);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
447
- `)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-+!!l;outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},QB=e(n(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),$B=Object.defineProperty,eV=(e,t,n)=>t in e?$B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tV=(e,t,n)=>(eV(e,typeof t==`symbol`?t:t+``,n),n),nV=Hf.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),rV=IB();function iV(e,t){return rV.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new rV.inline.State(e,null,null,[]).scanDelims(t,!0)}function aV(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function oV(e,t,n,r){let i=n,a=e;for(;i<r&&!iV(a,i).can_open;)a=aV(a,t,i,1),i++;return{text:a,from:i,to:r}}function sV(e,t,n,r){let i=r,a=e;for(;i>n&&!iV(a,i).can_close;)a=aV(a,t,i,-1),i--;return{text:a,from:n,to:i}}function cV(e,t,n,r){let i={text:e,from:n,to:r};return i=oV(i.text,t,i.from,i.to),i=sV(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var lV=class extends ZB{constructor(e,t,n){super(e,t,n??{}),tV(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=cV(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},uV=Mf.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?dV(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?dV(t)?.[1]??``:``}},parse:{}}}}});function dV(e){let t=e.type.schema,n=t.text(` `,[e]),r=cd(R.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function fV(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function pV(e){return e?.replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function mV(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function hV(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var gV=Cp.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(_V(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function _V(e,t){let n=e.type.schema,r=cd(R.from(e),n);return e.isBlock&&(t instanceof R||t.type.name===n.topNodeType.name)?vV(r):r}function vV(e){let t=fV(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
448
- ${t.innerHTML}
449
- `:`
450
- `,t.outerHTML}var yV=Cp.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.blockquote,parse:{}}}}}),bV=Cp.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),xV=Cp.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
451
- `),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),SV=Cp.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?gV.storage.markdown.serialize.call(this,e,t,n):`\\
452
- `);return}},parse:{}}}}}),CV=Cp.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.heading,parse:{}}}}}),wV=Cp.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.horizontal_rule,parse:{}}}}}),TV=Cp.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.image,parse:{}}}}}),EV=Cp.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.list_item,parse:{}}}}}),DV=Cp.create({name:`orderedList`});function OV(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var kV=DV.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=OV(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),AV=Cp.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:JB.nodes.paragraph,parse:{}}}}});function jV(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var MV=Cp.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!PV(t)){gV.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function NV(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function PV(e){let t=jV(e),n=t[0],r=t.slice(1);return!(jV(n).some(e=>e.type.name!==`tableHeader`||NV(e)||e.childCount>1)||r.some(e=>jV(e).some(e=>e.type.name===`tableHeader`||NV(e)||e.childCount>1)))}var FV=[yV,bV,xV,SV,CV,wV,gV,TV,EV,kV,AV,MV,Cp.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),Cp.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:bV.storage.markdown.serialize,parse:{setup(e){e.use(QB.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),Cp.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(pV(t.text))},parse:{}}}}}),Mf.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:JB.marks.strong,parse:{}}}}}),Mf.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:JB.marks.code,parse:{}}}}}),uV,Mf.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:JB.marks.em,parse:{}}}}}),Mf.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:JB.marks.link,parse:{}}}}}),Mf.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function IV(e){let t=e.storage?.markdown,n=FV.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var LV=class{constructor(e){tV(this,`editor`,null),this.editor=e}serialize(e){let t=new lV(this.nodes,this.marks,{hardBreakNodeName:SV.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(gV)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(uV)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=IV(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=IV(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},RV=class{constructor(e,t){tV(this,`editor`,null),tV(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(IB({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=IV(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=fV(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=IV(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&mV(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}hV(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
453
- `?t:t[t.length-1]===`
454
- `?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},zV=Hf.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new Or({key:new jr(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return Dt.fromSchema(this.editor.schema).parseSlice(fV(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),BV=Hf.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=Vf.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new RV(this.editor,this.options),serializer:new LV(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[nV.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),zV.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),VV=bN.configure({placeholder:({node:e})=>e.type.name===`heading`?`Heading ${e.attrs.level}`:`Press '/' for commands`,includeChildren:!0}),HV=tj.configure({multicolor:!0}),UV=BV.configure({html:!1,transformCopiedText:!0}),WV=rj.extend({addInputRules(){return[new wf({find:/^(?:---|—-|___\s|\*\*\*\s)$/u,handler:({state:e,range:t})=>{let n={},{tr:r}=e,i=t.from,a=t.to;r.insert(i-1,this.type.create(n)).delete(r.mapping.map(i),r.mapping.map(a))}})]}}),GV=[{id:`abap`,name:`ABAP`,import:(()=>b(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>b(()=>import(`./actionscript-3--17pq3dv.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>b(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>b(()=>import(`./angular-html-DrvEcI8G.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>b(()=>import(`./angular-ts-D8CUV3s9.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>b(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>b(()=>import(`./apex-VAyPSnFM.js`),[]))},{id:`apl`,name:`APL`,import:(()=>b(()=>import(`./apl-PcM4Dp7k.js`),__vite__mapDeps([7,3,1,2,4,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>b(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>b(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>b(()=>import(`./asciidoc-DE70LPWp.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>b(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>b(()=>import(`./astro-B7st53oA.js`),__vite__mapDeps([11,3,1,4,8,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>b(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>b(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>b(()=>import(`./bat-Bo4NYOV-.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>b(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>b(()=>import(`./berry-DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>b(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>b(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>b(()=>import(`./bird2-C6vDhewU.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>b(()=>import(`./blade-hWl6posx.js`),__vite__mapDeps([15,3,1,16,2,4,8,17,9,10])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>b(()=>import(`./bsl-BkkzgIyY.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>b(()=>import(`./c-PpPxyn8g.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>b(()=>import(`./c3-BFHwR3_K.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>b(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>b(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>b(()=>import(`./clarity-SemFz856.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>b(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>b(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>b(()=>import(`./cobol-IOjEjPmG.js`),__vite__mapDeps([23,2,1,3,4,10])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>b(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>b(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>b(()=>import(`./coffee-B5TREocO.js`),__vite__mapDeps([24,4,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>b(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>b(()=>import(`./coq-BrsZFFmf.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>b(()=>import(`./cpp-C4ceAJBi.js`).then(e=>e.n),__vite__mapDeps([25,1,26,20,27,17])))},{id:`crystal`,name:`Crystal`,import:(()=>b(()=>import(`./crystal-CgtjlE18.js`),__vite__mapDeps([28,20,1,3,2,4,29,17])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>b(()=>import(`./csharp-oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>b(()=>import(`./css-Dflf0SUa.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`csv`,name:`CSV`,import:(()=>b(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>b(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>b(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>b(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>b(()=>import(`./dart-CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>b(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>b(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>b(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>b(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>b(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>b(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>b(()=>import(`./edge-CwSzunxI.js`),__vite__mapDeps([30,16,1,2,3,4,14])))},{id:`elixir`,name:`Elixir`,import:(()=>b(()=>import(`./elixir-CzgPtVDf.js`),__vite__mapDeps([31,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>b(()=>import(`./elm-Cm7sFdI1.js`),__vite__mapDeps([32,26,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>b(()=>import(`./emacs-lisp-B4R74twV.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>b(()=>import(`./erb-p0q977En.js`),__vite__mapDeps([33,2,1,3,4,34,20,25,26,27,17,35,36,13,14,37,38,29,9,10,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>b(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>b(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>b(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>b(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>b(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>b(()=>import(`./fortran-free-form-CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>b(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>b(()=>import(`./gdresource-C0sCabJj.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>b(()=>import(`./gdscript-Cp2uCuqX.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>b(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>b(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>b(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>b(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>b(()=>import(`./git-rebase-D2tSwjJb.js`),__vite__mapDeps([50,29,1])))},{id:`gleam`,name:`Gleam`,import:(()=>b(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>b(()=>import(`./glimmer-js-JMWzPMQ2.js`),__vite__mapDeps([51,3,1,2,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>b(()=>import(`./glimmer-ts-DG5GCT78.js`),__vite__mapDeps([52,3,1,2,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>b(()=>import(`./glsl-MPwHyiXQ.js`).then(e=>e.n),__vite__mapDeps([26,1,20])))},{id:`gn`,name:`GN`,import:(()=>b(()=>import(`./gn-ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>b(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>b(()=>import(`./go-rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>b(()=>import(`./graphql-NW854Khs.js`).then(e=>e.n),__vite__mapDeps([35,1,4,36,13,14])))},{id:`groovy`,name:`Groovy`,import:(()=>b(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>b(()=>import(`./hack-C4J_0T1S.js`),__vite__mapDeps([53,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>b(()=>import(`./haml-qGg_91I2.js`).then(e=>e.n),__vite__mapDeps([37,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>b(()=>import(`./handlebars-BU7OV8YS.js`),__vite__mapDeps([54,3,1,2,4,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>b(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>b(()=>import(`./haxe-OTjmBuCE.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>b(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>b(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>b(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>b(()=>import(`./html-x4KE3xEi.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>b(()=>import(`./html-derivative-BtLlF_VL.js`).then(e=>e.n),__vite__mapDeps([16,1,2,3,4])))},{id:`http`,name:`HTTP`,import:(()=>b(()=>import(`./http-HvMG3K54.js`),__vite__mapDeps([55,35,1,4,36,13,14,8,29,9,10])))},{id:`hurl`,name:`Hurl`,import:(()=>b(()=>import(`./hurl-CLh1t2ES.js`),__vite__mapDeps([56,57,35,1,4,36,13,14,9,10])))},{id:`hxml`,name:`HXML`,import:(()=>b(()=>import(`./hxml-B0Qn7Nwc.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>b(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>b(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>b(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>b(()=>import(`./java-Cst_eZTE.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>b(()=>import(`./javascript-i_rUTyCW.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`jinja`,name:`Jinja`,import:(()=>b(()=>import(`./jinja-ISwn25cN.js`),__vite__mapDeps([60,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>b(()=>import(`./jison-D9Fg2JgN.js`),__vite__mapDeps([61,4,1])))},{id:`json`,name:`JSON`,import:(()=>b(()=>import(`./json-DS5j4FfK.js`).then(e=>e.n),__vite__mapDeps([8,1])))},{id:`json5`,name:`JSON5`,import:(()=>b(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>b(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>b(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>b(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>b(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>b(()=>import(`./jsx-CFyhNHav.js`).then(e=>e.n),__vite__mapDeps([36,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>b(()=>import(`./julia-BRnC1exM.js`),__vite__mapDeps([62,25,1,26,20,27,17,4,22,63])))},{id:`just`,name:`Just`,import:(()=>b(()=>import(`./just-BWbKChh7.js`),__vite__mapDeps([64,4,1,65,3,2,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39])))},{id:`kdl`,name:`KDL`,import:(()=>b(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>b(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>b(()=>import(`./kusto-C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>b(()=>import(`./latex-DoFV6f5B.js`),__vite__mapDeps([66,67,63,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>b(()=>import(`./lean-CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>b(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>b(()=>import(`./liquid-BGxpJKqJ.js`),__vite__mapDeps([68,3,1,2,4,8])))},{id:`llvm`,name:`LLVM IR`,import:(()=>b(()=>import(`./llvm-Cm23YOpf.js`),[]))},{id:`log`,name:`Log file`,import:(()=>b(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>b(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>b(()=>import(`./lua-VoGSg0xb.js`).then(e=>e.n),__vite__mapDeps([38,1,20])))},{id:`luau`,name:`Luau`,import:(()=>b(()=>import(`./luau-FMPmPwt6.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>b(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>b(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>b(()=>import(`./marko-E8KxKzjy.js`),__vite__mapDeps([69,3,1,70,6,14])))},{id:`matlab`,name:`MATLAB`,import:(()=>b(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>b(()=>import(`./mdc-CVMbNqUi.js`),__vite__mapDeps([71,16,1,2,3,4,41,39])))},{id:`mdx`,name:`MDX`,import:(()=>b(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>b(()=>import(`./mermaid-Bk4SNUv9.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>b(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>b(()=>import(`./mojo-BgCJLMeH.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>b(()=>import(`./moonbit-CaWjb8XO.js`),[]))},{id:`move`,name:`Move`,import:(()=>b(()=>import(`./move-B1IS1UjX.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>b(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>b(()=>import(`./nextflow-BJtWHP5T.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>b(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>b(()=>import(`./nginx-CgHaWcsO.js`),__vite__mapDeps([74,38,1,20])))},{id:`nim`,name:`Nim`,import:(()=>b(()=>import(`./nim-xKCzf2o0.js`),__vite__mapDeps([75,20,1,3,26,2,4,41,9,10])))},{id:`nix`,name:`Nix`,import:(()=>b(()=>import(`./nix-IvuFDN5E.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>b(()=>import(`./nushell-DcLAeLz5.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>b(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>b(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>b(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>b(()=>import(`./odin-B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>b(()=>import(`./openscad-BUDT5pXO.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>b(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>b(()=>import(`./perl-CAUsHq6V.js`),__vite__mapDeps([65,3,1,2,4,17,9,10])))},{id:`php`,name:`PHP`,import:(()=>b(()=>import(`./php-Cn4rjz2P.js`),__vite__mapDeps([76,3,1,2,4,8,17,9,10])))},{id:`pkl`,name:`Pkl`,import:(()=>b(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>b(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>b(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>b(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>b(()=>import(`./postcss-DUGWwNEu.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`powerquery`,name:`PowerQuery`,import:(()=>b(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>b(()=>import(`./powershell-DshXNtvi.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>b(()=>import(`./prisma-BsRQq5mF.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>b(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>b(()=>import(`./proto-DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>b(()=>import(`./pug-DD9HHTGS.js`),__vite__mapDeps([77,3,1,2,4])))},{id:`puppet`,name:`Puppet`,import:(()=>b(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>b(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>b(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>b(()=>import(`./qml-DcW_sT3t.js`),__vite__mapDeps([78,4,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>b(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>b(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>b(()=>import(`./r-D2d3McyU.js`).then(e=>e.n),__vite__mapDeps([63,1])))},{id:`racket`,name:`Racket`,import:(()=>b(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>b(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>b(()=>import(`./razor-30Cugjh2.js`),__vite__mapDeps([79,80,2,1,3,4])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>b(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>b(()=>import(`./regexp-Bu0flJgP.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>b(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>b(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>b(()=>import(`./ron-VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>b(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>b(()=>import(`./rst-wHa0wzHl.js`),__vite__mapDeps([81,82,25,1,26,20,27,17,16,2,3,4,22,34,35,36,13,14,37,38,29,9,10,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>b(()=>import(`./ruby-BA7kcl5p.js`),__vite__mapDeps([34,20,1,25,26,27,17,3,35,4,36,13,14,37,2,38,29,9,10,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>b(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>b(()=>import(`./sas-BHVT2N5I.js`),__vite__mapDeps([83,17,1])))},{id:`sass`,name:`Sass`,import:(()=>b(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>b(()=>import(`./scala-DKOlJaKm.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>b(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>b(()=>import(`./scss-DdIrFDxD.js`).then(e=>e.n),__vite__mapDeps([6,1,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>b(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>b(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([84,85])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>b(()=>import(`./shellscript-BbTp1yjG.js`).then(e=>e.n),__vite__mapDeps([29,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>b(()=>import(`./shellsession-BmAC8SMF.js`),__vite__mapDeps([86,29,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>b(()=>import(`./smalltalk-B16xEiuN.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>b(()=>import(`./solidity-CKzVLygQ.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>b(()=>import(`./soy-B5vCsGAN.js`),__vite__mapDeps([87,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>b(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([88,89])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>b(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>b(()=>import(`./sql-DCFvu5RM.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>b(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>b(()=>import(`./stata-h02h04e7.js`),__vite__mapDeps([90,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>b(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>b(()=>import(`./surrealql-DxccxuMd.js`),__vite__mapDeps([91,4,1])))},{id:`svelte`,name:`Svelte`,import:(()=>b(()=>import(`./svelte-BFzQ4R1i.js`),__vite__mapDeps([92,3,1,4,12,14])))},{id:`swift`,name:`Swift`,import:(()=>b(()=>import(`./swift-DonLKvLd.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>b(()=>import(`./system-verilog-DJ5XKQeo.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>b(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>b(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>b(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>b(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>b(()=>import(`./templ-DmkwoHql.js`),__vite__mapDeps([93,3,1,94,4])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>b(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>b(()=>import(`./tex-B0f_hYr8.js`),__vite__mapDeps([67,63,1])))},{id:`toml`,name:`TOML`,import:(()=>b(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>b(()=>import(`./ts-tags-CTs7_HT0.js`),__vite__mapDeps([95,3,1,26,20,2,4,17,14,9,10])))},{id:`tsv`,name:`TSV`,import:(()=>b(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>b(()=>import(`./tsx-DFvk7AwW.js`).then(e=>e.n),__vite__mapDeps([13,1])))},{id:`turtle`,name:`Turtle`,import:(()=>b(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>b(()=>import(`./twig-DgtEA5Er.js`),__vite__mapDeps([96,3,1,4,76,2,8,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39,6])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>b(()=>import(`./typescript-DHTLvXzV.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>b(()=>import(`./typespec-BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>b(()=>import(`./typst-DI99ib-x.js`),[]))},{id:`v`,name:`V`,import:(()=>b(()=>import(`./v-DETTlOr0.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>b(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>b(()=>import(`./vb-Djn5o6TS.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>b(()=>import(`./verilog-CiiDBU1e.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>b(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>b(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>b(()=>import(`./vue-C6J2sE8U.js`),__vite__mapDeps([97,3,1,16,2,4,8,14])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>b(()=>import(`./vue-html-DQch_7VQ.js`),__vite__mapDeps([98,4,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>b(()=>import(`./vue-vine-MFjXkeBm.js`),__vite__mapDeps([99,3,1,4,70,12,6,100])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>b(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>b(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>b(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>b(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>b(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>b(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>b(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>b(()=>import(`./xml-C33zriiW.js`).then(e=>e.n),__vite__mapDeps([9,1,10])))},{id:`xsl`,name:`XSL`,import:(()=>b(()=>import(`./xsl-BFS2wyMt.js`),__vite__mapDeps([101,9,1,10])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>b(()=>import(`./yaml-w0rMsuN4.js`).then(e=>e.n),__vite__mapDeps([39,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>b(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>b(()=>import(`./zig-CMLA9XwU.js`),[]))}],KV=Object.fromEntries(GV.map(e=>[e.id,e.import])),qV=Object.fromEntries(GV.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),JV={...KV,...qV},YV=ne({langs:JV,themes:I,engine:()=>(0,P.createOnigurumaEngine)(b(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:XV,codeToHast:ZV,codeToTokens:QV,codeToTokensBase:$V,codeToTokensWithThemes:eH,getSingletonHighlighter:tH,getLastGrammarState:nH}=F(YV,{guessEmbeddedLanguages:te}),rH=4,iH=/^```([a-z]+)?[\s\n]$/,aH=/^~~~([a-z]+)?[\s\n]$/,oH=Cp.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:rH,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,gd(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
455
- `):`\`\`\`${r}
456
-
457
- \`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rH,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
458
- `,`
459
- `).split(`
460
- `).map(e=>o+e).join(`
461
- `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rH,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
462
- `,`
463
- `).split(`
464
- `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(V.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
465
- `,`
466
- `).split(`
467
- `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
468
- `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
469
-
470
- `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(B.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[op({find:iH,type:this.type,getAttributes:e=>({language:e[1]})}),op({find:aH,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Or({key:new jr(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
471
- `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(V.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),sH,cH,lH=new Set,uH=new Set,dH=new Map;function fH(e){return e in I||dH.has(e)}function pH(){return sH}function mH(e){if(!sH&&!cH){if(e.customThemes)for(let t of e.customThemes)t.name&&dH.set(t.name,t);let t=e.themes.filter(e=>!!e&&e in I),n=e.languages.filter(e=>!!e&&e in JV);return cH=YV({themes:[...t,...dH.values()],langs:n}).then(e=>{sH=e}),cH}if(cH)return cH}async function hH(e){if(sH&&!sH.getLoadedThemes().includes(e)&&!uH.has(e)&&fH(e)){uH.add(e);let t=dH.get(e)??e;return await sH.loadTheme(t),uH.delete(e),!0}return!1}async function gH(e){return sH&&!sH.getLoadedLanguages().includes(e)&&!lH.has(e)&&e in JV?(lH.add(e),await sH.loadLanguage(e),lH.delete(e),!0):!1}async function _H({doc:e,name:t,defaultTheme:n,defaultLanguage:r,themeModes:i,customThemes:a}){let o=rd(e,e=>e.type.name===t),s=[...o.map(e=>e.node.attrs.theme),n],c=[...o.map(e=>e.node.attrs.language),r];if(sH)await Promise.all([...s.flatMap(e=>hH(e)),...c.flatMap(e=>!!e&&gH(e))]);else{let e=[...s];i&&(i.light&&!e.includes(i.light)&&e.push(i.light),i.dark&&!e.includes(i.dark)&&e.push(i.dark)),await mH({languages:c,themes:e,customThemes:a})}}function vH(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function yH({doc:e,name:t,defaultTheme:n,defaultLanguage:r,themes:i}){let a=[];return rd(e,e=>e.type.name===t).forEach(e=>{let t=e.pos+1,o=e.node.attrs.language||r,s=e.node.attrs.theme||n,c=e.node.attrs.themes?.light||i?.light,l=e.node.attrs.themes?.dark||i?.dark,u=pH();if(!u)return;u.getLoadedLanguages().includes(o)||(o=`plaintext`);let d=e=>u.getLoadedThemes().includes(e)?e:u.getLoadedThemes()[0],f;if(i){f=u.codeToTokens(e.node.textContent,{lang:o,themes:{light:d(c),dark:d(l)}});let t={};f.bg&&(t[`background-color`]=f.bg),f.fg&&(t.color=f.fg),a.push(ms.node(e.pos,e.pos+e.node.nodeSize,{style:vH(t),class:`shiki`}))}else{f=u.codeToTokens(e.node.textContent,{lang:o,theme:d(s)});let t=u.getLoadedThemes().includes(s)?s:u.getLoadedThemes()[0],n=u.getTheme(t);a.push(ms.node(e.pos,e.pos+e.node.nodeSize,{style:vH({"background-color":n.bg})}))}for(let e of f.tokens){for(let n of e){let e=t+n.content.length,r=``;r=vH(i?n.htmlStyle||{}:{color:n.color||`inherit`});let o=ms.inline(t,e,{style:r});a.push(o),t=e}t+=1}}),_s.create(e,a)}function bH({name:e,defaultLanguage:t,defaultTheme:n,themes:r,customThemes:i}){let a=new Or({key:new jr(`shiki`),view(a){class o{constructor(){this.initDecorations()}update(){this.checkUndecoratedBlocks()}destroy(){}async initDecorations(){let o=a.state.doc;await _H({doc:o,name:e,defaultLanguage:t,defaultTheme:n,themeModes:r,customThemes:i??void 0});let s=a.state.tr.setMeta(`shikiPluginForceDecoration`,!0);a.dispatch(s)}async checkUndecoratedBlocks(){let t=rd(a.state.doc,t=>t.type.name===e),n=e=>{let t=[gH(e.node.attrs.language)];return r?(t.push(hH(e.node.attrs.themes?.light||r.light)),t.push(hH(e.node.attrs.themes?.dark||r.dark))):t.push(hH(e.node.attrs.theme)),t};if((await Promise.all(t.flatMap(e=>n(e)))).includes(!0)){let e=a.state.tr.setMeta(`shikiPluginForceDecoration`,!0);a.dispatch(e)}}}return new o},state:{init:(i,{doc:a})=>yH({doc:a,name:e,defaultLanguage:t,defaultTheme:n,themes:r}),apply:(i,a,o,s)=>{let c=o.selection.$head.parent.type.name,l=s.selection.$head.parent.type.name,u=rd(o.doc,t=>t.type.name===e),d=rd(s.doc,t=>t.type.name===e),f=i.docChanged&&([c,l].includes(e)||d.length!==u.length||i.steps.some(e=>e.from!==void 0&&e.to!==void 0&&u.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)));return i.getMeta(`shikiPluginForceDecoration`)||f?yH({doc:i.doc,name:e,defaultLanguage:t,defaultTheme:n,themes:r}):a.map(i.mapping,i.doc)}},props:{decorations(e){return a.getState(e)}}});return a}var xH=oH.extend({addOptions(){return{...this.parent?.(),defaultLanguage:null,defaultTheme:`github-dark`,themes:null,customThemes:null}},markdownTokenName:`code`,parseMarkdown(e,t){return e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown(e,t,n){let r=e.attrs?.language||``;return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
472
- `):`\`\`\`${r}
473
-
474
- \`\`\``},addProseMirrorPlugins(){return[...this.parent?.()||[],bH({name:this.name,defaultLanguage:this.options.defaultLanguage,defaultTheme:this.options.defaultTheme,themes:this.options.themes,customThemes:this.options.customThemes})]}}),SH=Fk,CH=yN.configure({HTMLAttributes:{class:_(`text-muted-foreground underline underline-offset-[3px] hover:text-primary transition-colors cursor-pointer`)}}),wH=jk.extend({addProseMirrorPlugins(){return[cc({imageClass:_(`opacity-40 rounded-lg border border-stone-200`)})]}}).configure({allowBase64:!0,HTMLAttributes:{class:_(`rounded-lg border border-muted`)}}),TH=Mk.configure({HTMLAttributes:{class:_(`rounded-lg border border-muted`)}}),EH=iP.configure({HTMLAttributes:{class:_(`not-prose pl-2`)}}),DH=rP.configure({HTMLAttributes:{class:_(`flex gap-2 items-start my-4`)},nested:!0}),OH=WV.configure({HTMLAttributes:{class:_(`mt-4 mb-6 border-t border-muted-foreground`)}}),kH=[SI.configure({bulletList:{HTMLAttributes:{class:_(`list-disc list-outside leading-3 -mt-2`)}},orderedList:{HTMLAttributes:{class:_(`list-decimal list-outside leading-3 -mt-2`)}},listItem:{HTMLAttributes:{class:_(`leading-normal -mb-2`)}},blockquote:{HTMLAttributes:{class:_(`border-l-4 border-primary`)}},codeBlock:!1,code:{HTMLAttributes:{class:_(`rounded-md bg-muted px-1.5 py-1 font-mono font-medium`),spellcheck:`false`}},horizontalRule:!1,dropcursor:{color:`#DBEAFE`,width:4},gapcursor:!1}),VV,CH,wH,TH,EH,DH,OH,SH,xH.configure({defaultLanguage:null,defaultTheme:`github-light`,themes:{light:`github-light`,dark:`github-dark`},HTMLAttributes:{class:_(`rounded-md bg-muted text-muted-foreground border p-5 font-mono font-medium`)}}),hP.configure({HTMLAttributes:{class:_(`rounded-lg border border-muted`)},inline:!1}),UA.configure(),oP,UV.configure({html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}),HV,qA,YA,kk,AI],AH=({children:e,asChild:t,onSelect:n,ref:r,...i})=>{let{editor:a}=Vm(),o=t?ee:`div`;return a?(0,W.jsx)(o,{ref:r,...i,onClick:()=>n?.(a),children:e}):null},jH=e=>{let t=(0,gc.c)(13),{completion:n,onDiscard:r}=e,{editor:i}=Vm(),a=d(`markdown-editor`);if(!i)return null;let o;if(t[0]!==n||t[1]!==a.discard||t[2]!==a.insertBelow||t[3]!==a.replaceSelection||t[4]!==i||t[5]!==r){let e;t[7]!==n||t[8]!==i?(e=()=>{let{selection:e}=i.view.state;i.chain().focus().insertContentAt({from:e.from,to:e.to},n).run()},t[7]=n,t[8]=i,t[9]=e):e=t[9];let s;t[10]!==n||t[11]!==i?(s=()=>{let{selection:e}=i.view.state;i.chain().focus().insertContentAt(e.to+1,n).run()},t[10]=n,t[11]=i,t[12]=s):s=t[12],o=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(w.Group,{children:[(0,W.jsxs)(w.Item,{value:`replace`,className:`gap-2 px-4`,onSelect:e,children:[(0,W.jsx)(l,{className:`size-4 text-muted-foreground`}),a.replaceSelection]}),(0,W.jsxs)(w.Item,{value:`insert`,className:`gap-2 px-4`,onSelect:s,children:[(0,W.jsx)(xe,{className:`size-4 text-muted-foreground`}),a.insertBelow]})]}),(0,W.jsx)(w.Separator,{}),(0,W.jsx)(w.Group,{children:(0,W.jsxs)(w.Item,{value:`discard`,className:`gap-2 px-4`,onSelect:r,children:[(0,W.jsx)(h,{className:`size-4 text-muted-foreground`}),a.discard]})})]}),t[0]=n,t[1]=a.discard,t[2]=a.insertBelow,t[3]=a.replaceSelection,t[4]=i,t[5]=r,t[6]=o}else o=t[6];return o},MH=e=>{try{return new URL(e),!0}catch{return!1}},NH=e=>{if(MH(e))return e;try{if(e.includes(`.`)&&!e.includes(` `))return new URL(`https://${e}`).toString()}catch{return null}},PH=(e,t)=>{let n=[];e.state.doc.forEach((e,r)=>{r>=t||n.push(e)});let r=R.fromArray(n),i=e.state.doc.copy(r);return e.storage.markdown.serializer.serialize(i)},FH=[{value:`improve`,label:`Improve writing`,icon:he},{value:`fix`,label:`Fix grammar`,icon:oe},{value:`shorter`,label:`Make shorter`,icon:re},{value:`longer`,label:`Make longer`,icon:Se}],IH=e=>{let t=(0,gc.c)(19),{onSelect:n}=e,{editor:r}=Vm(),i=d(`markdown-editor`);if(!r)return null;let a;t[0]!==i.fixGrammar||t[1]!==i.improveWriting||t[2]!==i.makeLonger||t[3]!==i.makeShorter?(a=e=>{switch(e){case`improve`:return i.improveWriting.value;case`fix`:return i.fixGrammar.value;case`shorter`:return i.makeShorter.value;case`longer`:return i.makeLonger.value;default:return e}},t[0]=i.fixGrammar,t[1]=i.improveWriting,t[2]=i.makeLonger,t[3]=i.makeShorter,t[4]=a):a=t[4];let o=a,s;if(t[5]!==i.continueWriting||t[6]!==i.editHeading.value||t[7]!==i.moreHeading.value||t[8]!==r||t[9]!==o||t[10]!==n){let e;t[12]!==r||t[13]!==o||t[14]!==n?(e=e=>(0,W.jsxs)(w.Item,{value:e.value,className:`flex gap-2 px-4`,onSelect:e=>{let t=r.state.selection.content();n(r.storage.markdown.serializer.serialize(t.content),e)},children:[(0,W.jsx)(e.icon,{className:`size-4 text-text`}),o(e.value)]},e.value),t[12]=r,t[13]=o,t[14]=n,t[15]=e):e=t[15];let a;t[16]!==r||t[17]!==n?(a=()=>{let e=r.state.selection.from;n(PH(r,e),`continue`)},t[16]=r,t[17]=n,t[18]=a):a=t[18],s=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(w.Group,{heading:i.editHeading.value,children:FH.map(e)}),(0,W.jsx)(w.Separator,{}),(0,W.jsx)(w.Group,{heading:i.moreHeading.value,children:(0,W.jsxs)(w.Item,{value:`continue`,className:`gap-2 px-4`,onSelect:a,children:[(0,W.jsx)(ve,{className:`size-4 text-text`}),i.continueWriting]})})]}),t[5]=i.continueWriting,t[6]=i.editHeading.value,t[7]=i.moreHeading.value,t[8]=r,t[9]=o,t[10]=n,t[11]=s}else s=t[11];return s},LH=(e,t,n)=>{switch(e){case`continue`:return{system:`You are an AI writing assistant that continues existing text based on context from prior text. Give more weight/priority to the later characters than the beginning ones. Limit your response to no more than 200 characters, but make sure to construct complete sentences. Use Markdown formatting when appropriate.`,userContent:t};case`improve`:return{system:`You are an AI writing assistant that improves existing text. Limit your response to no more than 200 characters, but make sure to construct complete sentences. Use Markdown formatting when appropriate.`,userContent:`The existing text is: ${t}`};case`shorter`:return{system:`You are an AI writing assistant that shortens existing text. Use Markdown formatting when appropriate.`,userContent:`The existing text is: ${t}`};case`longer`:return{system:`You are an AI writing assistant that lengthens existing text. Use Markdown formatting when appropriate.`,userContent:`The existing text is: ${t}`};case`fix`:return{system:`You are an AI writing assistant that fixes grammar and spelling errors in existing text. Limit your response to no more than 200 characters, but make sure to construct complete sentences. Use Markdown formatting when appropriate.`,userContent:`The existing text is: ${t}`};case`zap`:return{system:`You are an AI writing assistant that generates text based on a prompt. You take an input from the user and a command for manipulating the text. Use Markdown formatting when appropriate.`,userContent:`For this text: ${t}. You have to respect the command: ${n??``}`};default:return{system:``,userContent:t}}},RH=e=>{let{mutateAsync:t,isPending:n}=m(),[r,i]=(0,U.useState)(``);return{completion:r,complete:(0,U.useCallback)(async(n,r)=>{let{option:a,command:o}=r.body,{system:s,userContent:c}=LH(a,n,o);try{let e=(await t({system:s,messages:[{role:`user`,content:c}]}))?.data?.fileContent??``;return i(e),e}catch(t){return e?.(t instanceof Error?t:Error(`AI request failed`)),``}},[t,e]),isLoading:n,reset:(0,U.useCallback)(()=>i(``),[])}},zH=({onOpenChange:e,sendButtonVariant:t=`default`,sendButtonColor:n=`text`})=>{let{editor:r}=Vm(),[o,s]=(0,U.useState)(``),c=d(`markdown-editor`),{completion:l,complete:u,isLoading:f,reset:p}=RH(e=>x({variant:`error`,title:c.aiError.value,description:e.message}));if(!r)return null;let m=l.length>0,h=()=>{let e=r.state.selection.content();return r.storage.markdown.serializer.serialize(e.content)};return(0,W.jsxs)(T,{className:`w-[350px]`,children:[m&&(0,W.jsx)(`div`,{className:`flex max-h-[400px]`,children:(0,W.jsx)(`div`,{className:`relative overflow-y-auto`,children:(0,W.jsx)(`div`,{className:`prose prose-sm dark:prose-invert p-2 px-4`,children:(0,W.jsx)(i,{children:l})})})}),f&&(0,W.jsxs)(`div`,{className:`flex h-12 w-full items-center px-4 font-medium text-sm text-text`,children:[(0,W.jsx)(ge,{className:`mr-2 size-4 shrink-0`}),c.aiThinking,(0,W.jsx)(`div`,{className:`mt-1 ml-2`,children:(0,W.jsx)(D,{})})]}),!f&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3`,children:[(0,W.jsx)(w.Input,{value:o,onValueChange:s,autoFocus:!0,placeholder:m?c.tellAI.value:c.askAIToEdit.value,onFocus:()=>Lk(r)}),(0,W.jsx)(a,{label:c.send.value,size:`icon-sm`,roundedSize:`full`,variant:t,color:n,className:`size-7 shrink-0`,Icon:ie,onClick:()=>{u(l||h(),{body:{option:`zap`,command:o}}).then(()=>s(``))}})]}),m?(0,W.jsx)(jH,{completion:l,onDiscard:()=>{r.chain().unsetHighlight().focus().run(),p(),e(!1)}}):(0,W.jsx)(IH,{onSelect:(e,t)=>u(e,{body:{option:t}})})]})]})},BH=e=>{let t=(0,gc.c)(12),{children:n,open:r,onOpenChange:i,sendButtonVariant:o,sendButtonColor:s}=e,{editor:c}=Vm(),l=d(`markdown-editor`),u,f;t[0]!==c||t[1]!==r?(u=()=>{!r&&c&&Ik(c)},f=[r,c],t[0]=c,t[1]=r,t[2]=u,t[3]=f):(u=t[2],f=t[3]),(0,U.useEffect)(u,f);let p=r?`bottom-start`:`top`,m;return t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s||t[9]!==o||t[10]!==p?(m=(0,W.jsxs)(vg,{options:{placement:p},className:`flex w-fit max-w-[90vw] rounded-lg border-[1.3px] border-neutral/20 bg-card/95 text-text shadow-xl backdrop-blur [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl`,children:[r&&(0,W.jsx)(zH,{onOpenChange:i,sendButtonVariant:o,sendButtonColor:s}),!r&&(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(a,{label:l.askAI.value,variant:`hoverable`,color:`text`,size:`sm`,roundedSize:`none`,className:`gap-1 text-text`,Icon:ge,onClick:()=>i(!0),children:l.askAI}),n]})]}),t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=o,t[10]=p,t[11]=m):m=t[11],m},VH=[{name:`Default`,color:`var(--color-text)`},{name:`Primary`,color:`var(--color-primary-500)`},{name:`Secondary`,color:`var(--color-secondary)`},{name:`Success`,color:`var(--color-success)`},{name:`Warning`,color:`var(--color-warning)`},{name:`Error`,color:`var(--color-error)`},{name:`Neutral`,color:`var(--color-neutral)`}],HH=[{name:`Default`,color:`transparent`},{name:`Primary`,color:`var(--color-primary-100)`},{name:`Secondary`,color:`var(--color-secondary-100)`},{name:`Success`,color:`var(--color-success-100)`},{name:`Warning`,color:`var(--color-warning-50)`},{name:`Error`,color:`var(--color-error-100)`},{name:`Neutral`,color:`var(--color-neutral-100)`}],UH=()=>{let{editor:e}=Vm(),[t,n]=(0,U.useState)(!1),r=(0,U.useRef)(null),i=d(`markdown-editor`);if((0,U.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),!e)return null;let a=VH.find(({color:t})=>e.isActive(`textStyle`,{color:t})),o=HH.find(({color:t})=>e.isActive(`highlight`,{color:t})),s=e=>{switch(e){case`Default`:return i.colorDefault.value;case`Primary`:return i.colorPrimary.value;case`Secondary`:return i.colorSecondary.value;case`Success`:return i.colorSuccess.value;case`Warning`:return i.colorWarning.value;case`Error`:return i.colorError.value;case`Neutral`:return i.colorNeutral.value;default:return e}};return(0,W.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault(),n(e=>!e)},className:`flex items-center gap-1 whitespace-nowrap rounded-none px-3 py-1.5 text-sm hover:bg-accent`,children:[(0,W.jsx)(`span`,{className:`rounded-sm px-1 font-medium`,style:{color:a?.color,backgroundColor:o?.color},children:`A`}),(0,W.jsx)(g,{className:`size-3`})]}),t&&(0,W.jsxs)(`div`,{className:`absolute top-[calc(100%+0.5rem)] left-0 z-50 flex w-40 flex-col rounded-md border bg-popover p-1 shadow-md`,children:[(0,W.jsx)(`div`,{className:`mb-1 px-2 font-semibold text-muted-foreground text-xs`,children:i.colorHeading.value}),VH.map(({name:t,color:r})=>(0,W.jsxs)(`button`,{type:`button`,onMouseDown:i=>{i.preventDefault(),e.commands.unsetColor(),t!==`Default`&&e.chain().focus().setColor(r).run(),n(!1)},className:`flex w-full cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`rounded-sm border px-1.5 font-medium`,style:{color:r},children:`A`}),(0,W.jsx)(`span`,{children:s(t)})]}),e.isActive(`textStyle`,{color:r})&&(0,W.jsx)(l,{className:`size-3`})]},t)),(0,W.jsx)(`div`,{className:`mt-2 mb-1 px-2 font-semibold text-muted-foreground text-xs`,children:i.highlightHeading.value}),HH.map(({name:t,color:r})=>(0,W.jsxs)(`button`,{type:`button`,onMouseDown:i=>{i.preventDefault(),e.commands.unsetHighlight(),t!==`Default`&&e.chain().focus().setHighlight({color:r}).run(),n(!1)},className:`flex w-full cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`rounded-sm border px-1.5 font-medium`,style:{backgroundColor:r},children:`A`}),(0,W.jsx)(`span`,{children:s(t)})]}),e.isActive(`highlight`,{color:r})&&(0,W.jsx)(l,{className:`size-3`})]},t))]})]})},WH=()=>{let{editor:e}=Vm(),[t,n]=(0,U.useState)(!1),r=(0,U.useRef)(null),i=(0,U.useRef)(null),s=d(`markdown-editor`);if((0,U.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),i.current?.focus(),()=>document.removeEventListener(`mousedown`,e)},[t]),!e)return null;let c=e.getAttributes(`link`).href;return(0,W.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault(),n(e=>!e)},className:o(`flex items-center gap-1 whitespace-nowrap rounded-none px-3 py-1.5 text-sm hover:bg-accent`,e.isActive(`link`)&&`text-blue-500`),children:[(0,W.jsx)(fe,{className:`size-4`}),(0,W.jsx)(`span`,{className:`underline decoration-stone-400 underline-offset-4`,children:s.link.value})]}),t&&(0,W.jsx)(`div`,{className:`absolute top-[calc(100%+0.5rem)] left-0 z-50`,children:(0,W.jsxs)(`form`,{className:`flex w-60 gap-1 rounded-md border bg-popover p-1 shadow-md`,onSubmit:t=>{t.preventDefault();let r=t.currentTarget[0],i=NH(r.value);i&&e.chain().focus().setLink({href:i}).run(),n(!1)},children:[(0,W.jsx)(`input`,{ref:i,type:`text`,placeholder:s.linkPlaceholder.value,className:`flex-1 bg-transparent p-1 text-sm outline-none`,defaultValue:c??``}),c?(0,W.jsx)(a,{label:s.removeLink.value,type:`button`,size:`icon-sm`,variant:`outline`,color:`error`,Icon:h,onClick:()=>{e.chain().focus().unsetLink().run(),i.current&&(i.current.value=``),n(!1)}}):(0,W.jsx)(a,{label:s.applyLink.value,type:`submit`,size:`icon-sm`,color:`text`,Icon:l})]},c??`no-link`)})]})},GH=[{name:`Text`,icon:be,command:e=>e.chain().focus().clearNodes().run(),isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`bulletList`)&&!e.isActive(`orderedList`)},{name:`Heading 1`,icon:ce,command:e=>e.chain().focus().clearNodes().toggleHeading({level:1}).run(),isActive:e=>e.isActive(`heading`,{level:1})},{name:`Heading 2`,icon:L,command:e=>e.chain().focus().clearNodes().toggleHeading({level:2}).run(),isActive:e=>e.isActive(`heading`,{level:2})},{name:`Heading 3`,icon:le,command:e=>e.chain().focus().clearNodes().toggleHeading({level:3}).run(),isActive:e=>e.isActive(`heading`,{level:3})},{name:`To-do List`,icon:_e,command:e=>e.chain().focus().clearNodes().toggleTaskList().run(),isActive:e=>e.isActive(`taskItem`)},{name:`Bullet List`,icon:pe,command:e=>e.chain().focus().clearNodes().toggleBulletList().run(),isActive:e=>e.isActive(`bulletList`)},{name:`Numbered List`,icon:pe,command:e=>e.chain().focus().clearNodes().toggleOrderedList().run(),isActive:e=>e.isActive(`orderedList`)},{name:`Quote`,icon:xe,command:e=>e.chain().focus().clearNodes().toggleBlockquote().run(),isActive:e=>e.isActive(`blockquote`)},{name:`Code`,icon:se,command:e=>e.chain().focus().clearNodes().toggleCodeBlock().run(),isActive:e=>e.isActive(`codeBlock`)}],KH=()=>{let{editor:e}=Vm(),[t,n]=(0,U.useState)(!1),r=(0,U.useRef)(null),i=d(`markdown-editor`);if((0,U.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),!e)return null;let a=GH.filter(t=>t.isActive(e)).pop()??{name:`Multiple`},s=e=>{switch(e){case`Text`:return i.text.value;case`Heading 1`:return i.heading1.value;case`Heading 2`:return i.heading2.value;case`Heading 3`:return i.heading3.value;case`To-do List`:return i.todoList.value;case`Bullet List`:return i.bulletList.value;case`Numbered List`:return i.numberedList.value;case`Quote`:return i.quote.value;case`Code`:return i.code.value;case`Multiple`:return i.multiple.value;default:return e}};return(0,W.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault(),n(e=>!e)},className:`flex items-center gap-1 whitespace-nowrap rounded-none px-3 py-1.5 text-sm hover:bg-accent`,children:[(0,W.jsx)(`span`,{children:s(a.name)}),(0,W.jsx)(g,{className:o(`size-3 transition-transform`,t&&`rotate-180`)})]}),t&&(0,W.jsx)(`div`,{className:`absolute top-[calc(100%+0.5rem)] left-0 z-50 w-48 rounded-md border bg-popover p-1 shadow-md`,children:GH.map(t=>(0,W.jsxs)(`button`,{type:`button`,onMouseDown:r=>{r.preventDefault(),t.command(e),n(!1)},className:`flex w-full cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent`,children:[(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(`div`,{className:`rounded-sm border p-1`,children:(0,W.jsx)(t.icon,{className:`size-3`})}),(0,W.jsx)(`span`,{children:s(t.name)})]}),a.name===t.name&&(0,W.jsx)(l,{className:`size-4`})]},t.name))})]})},qH=()=>{let e=(0,gc.c)(5),{editor:t}=Vm(),n=d(`markdown-editor`);if(!t)return null;let r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=JH,i=YH,e[0]=r,e[1]=i):(r=e[0],i=e[1]);let s;if(e[2]!==n||e[3]!==t){let c=[{name:`bold`,isActive:r,command:i,icon:ae},{name:`italic`,isActive:XH,command:ZH,icon:de},{name:`underline`,isActive:QH,command:$H,icon:Ce},{name:`strike`,isActive:eU,command:tU,icon:ye},{name:`code`,isActive:nU,command:rU,icon:se}],l=e=>{switch(e){case`bold`:return n.bold.value;case`italic`:return n.italic.value;case`underline`:return n.underline.value;case`strike`:return n.strike.value;case`code`:return n.code.value;default:return e}};s=(0,W.jsx)(`div`,{className:`flex`,children:c.map(e=>(0,W.jsx)(AH,{onSelect:t=>e.command(t),children:(0,W.jsx)(a,{label:l(e.name),size:`icon-sm`,variant:`hoverable`,color:`text`,roundedSize:`none`,Icon:e.icon,iconClassName:o(e.isActive(t)&&`text-blue-500`)})},e.name))}),e[2]=n,e[3]=t,e[4]=s}else s=e[4];return s};function JH(e){return e.isActive(`bold`)}function YH(e){return e.chain().focus().toggleBold().run()}function XH(e){return e.isActive(`italic`)}function ZH(e){return e.chain().focus().toggleItalic().run()}function QH(e){return e.isActive(`underline`)}function $H(e){return e.chain().focus().toggleUnderline().run()}function eU(e){return e.isActive(`strike`)}function tU(e){return e.chain().focus().toggleStrike().run()}function nU(e){return e.isActive(`code`)}function rU(e){return e.chain().focus().toggleCode().run()}var iU=e=>(0,W.jsx)(`svg`,{fill:`currentColor`,width:`800px`,height:`800px`,viewBox:`0 0 32 32`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Youtube logo`,...e,children:(0,W.jsx)(`path`,{d:`M12.932 20.459v-8.917l7.839 4.459zM30.368 8.735c-0.354-1.301-1.354-2.307-2.625-2.663l-0.027-0.006c-3.193-0.406-6.886-0.638-10.634-0.638-0.381 0-0.761 0.002-1.14 0.007l0.058-0.001c-0.322-0.004-0.701-0.007-1.082-0.007-3.748 0-7.443 0.232-11.070 0.681l0.434-0.044c-1.297 0.363-2.297 1.368-2.644 2.643l-0.006 0.026c-0.4 2.109-0.628 4.536-0.628 7.016 0 0.088 0 0.176 0.001 0.263l-0-0.014c-0 0.074-0.001 0.162-0.001 0.25 0 2.48 0.229 4.906 0.666 7.259l-0.038-0.244c0.354 1.301 1.354 2.307 2.625 2.663l0.027 0.006c3.193 0.406 6.886 0.638 10.634 0.638 0.38 0 0.76-0.002 1.14-0.007l-0.058 0.001c0.322 0.004 0.702 0.007 1.082 0.007 3.749 0 7.443-0.232 11.070-0.681l-0.434 0.044c1.298-0.362 2.298-1.368 2.646-2.643l0.006-0.026c0.399-2.109 0.627-4.536 0.627-7.015 0-0.088-0-0.176-0.001-0.263l0 0.013c0-0.074 0.001-0.162 0.001-0.25 0-2.48-0.229-4.906-0.666-7.259l0.038 0.244z`})}),aU=(e,t)=>Dk([{title:t.text.value,description:t.textDesc.value,searchTerms:[`p`,`paragraph`],icon:(0,W.jsx)(be,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleNode(`paragraph`,`paragraph`).run()}},{title:t.todoList.value,description:t.todoListDesc.value,searchTerms:[`todo`,`task`,`list`,`check`,`checkbox`],icon:(0,W.jsx)(_e,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:t.heading1.value,description:t.heading1Desc.value,searchTerms:[`title`,`big`,`large`],icon:(0,W.jsx)(ce,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode(`heading`,{level:1}).run()}},{title:t.heading2.value,description:t.heading2Desc.value,searchTerms:[`subtitle`,`medium`],icon:(0,W.jsx)(L,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode(`heading`,{level:2}).run()}},{title:t.heading3.value,description:t.heading3Desc.value,searchTerms:[`subtitle`,`small`],icon:(0,W.jsx)(le,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode(`heading`,{level:3}).run()}},{title:t.bulletList.value,description:t.bulletListDesc.value,searchTerms:[`unordered`,`point`],icon:(0,W.jsx)(me,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:t.numberedList.value,description:t.numberedListDesc.value,searchTerms:[`ordered`],icon:(0,W.jsx)(pe,{className:`size-10`}),command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:t.quote.value,description:t.quoteDesc.value,searchTerms:[`blockquote`],icon:(0,W.jsx)(xe,{className:`size-10`}),command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleNode(`paragraph`,`paragraph`).toggleBlockquote().run()},{title:t.code.value,description:t.codeDesc.value,searchTerms:[`codeblock`],icon:(0,W.jsx)(se,{className:`size-10`}),command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleCodeBlock().run()},{title:t.image.value,description:t.imageDesc.value,searchTerms:[`photo`,`picture`,`media`],icon:(0,W.jsx)(ue,{className:`size-10`}),command:({editor:t,range:n})=>{t.chain().focus().deleteRange(n).run();let r=document.createElement(`input`);r.type=`file`,r.accept=`image/*`,r.onchange=()=>{if(r.files?.length){let n=r.files[0],i=t.view.state.selection.from;e(n,t.view,i)}},r.click()}},{title:t.youtube.value,description:t.youtubeDesc.value,searchTerms:[`video`,`youtube`,`embed`],icon:(0,W.jsx)(iU,{className:`size-10`}),command:({editor:e,range:n})=>{let r=prompt(t.youtubePrompt.value);r&&/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/.test(r)?e.chain().focus().deleteRange(n).setYoutubeVideo({src:r}).run():r!==null&&alert(t.youtubeError.value)}}]),oU=(e,t)=>{let n=aU(e,t);return{slashCommand:Tk.configure({suggestion:{items:()=>n,render:Ek}}),suggestionItems:n}},sU=()=>(0,W.jsx)(`div`,{className:`h-full w-px shrink-0 bg-border`}),cU=({defaultValue:e,onChange:t,editable:n=!0,enableAI:r=!0,uploadImage:i,maxImageSizeMb:a,className:s})=>{let[c,l]=(0,U.useState)(!1),u=d(`markdown-editor`),f=(0,U.useMemo)(()=>hc({uploadImage:i,maxSizeMb:a}),[i,a]),{extensions:p,suggestionItems:m}=(0,U.useMemo)(()=>{let{slashCommand:e,suggestionItems:t}=oU(f,u);return{extensions:[...kH,e],suggestionItems:t}},[f,u]),h=e??``,g=({editor:e})=>{t?.(e.storage.markdown.getMarkdown())},_=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(KH,{}),(0,W.jsx)(sU,{}),(0,W.jsx)(WH,{}),(0,W.jsx)(sU,{}),(0,W.jsx)(qH,{}),(0,W.jsx)(sU,{}),(0,W.jsx)(UH,{})]});return(0,W.jsx)(`div`,{className:`relative w-full`,children:(0,W.jsx)(fh,{children:(0,W.jsxs)(ph,{immediatelyRender:!1,editable:n,initialContent:h,extensions:p,className:o(`min-h-[350px] w-full max-w-full`,s),editorProps:{handleDOMEvents:{keydown:(e,t)=>Ok(t)},handlePaste:(e,t)=>dc(e,t,f),handleDrop:(e,t,n,r)=>fc(e,t,r,f),attributes:{class:`max-w-full pl-6 focus:outline-none`}},onUpdate:g,slotAfter:(0,W.jsx)(CE,{}),children:[(0,W.jsxs)(wc,{className:`z-50 h-auto max-h-[330px] overflow-y-auto px-1 py-2 shadow-md transition-all`,children:[(0,W.jsx)(bg,{className:`px-2 text-muted-foreground`,children:u.noResults.value}),(0,W.jsx)(Tc,{children:m.map(e=>(0,W.jsxs)(yg,{value:e.title,onCommand:t=>e.command?.(t),className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent`,children:[(0,W.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-md border border-card bg-background`,children:e.icon}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]})]},e.title))})]}),r?(0,W.jsx)(BH,{open:c,onOpenChange:l,children:_}):(0,W.jsx)(vg,{options:{placement:`top`},className:`flex w-fit max-w-[90vw] rounded-lg border-[1.3px] border-neutral/20 bg-card/95 text-text shadow-xl backdrop-blur [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl`,children:_})]})})})};export{cU as MarkdownEditor};