@stlite/desktop 0.42.5 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +79 -74
  3. package/build/index.html +1 -1
  4. package/build/static/css/8050.c24b25fa.chunk.css +1 -0
  5. package/build/static/css/9699.7ce51b75.chunk.css +1 -0
  6. package/build/static/css/main.fb5f4d99.css +1 -0
  7. package/build/static/js/1046.ea522608.chunk.js +1 -0
  8. package/build/static/js/1122.422f58fc.chunk.js +1 -0
  9. package/build/static/js/1189.71b89117.chunk.js +1 -0
  10. package/build/static/js/1261.242b7386.chunk.js +1 -0
  11. package/build/static/js/142.dbf9ec20.chunk.js +1 -0
  12. package/build/static/js/144.046792d9.chunk.js +1 -0
  13. package/build/static/js/1729.d59ed152.chunk.js +1 -0
  14. package/build/static/js/1740.2c71a97a.chunk.js +1 -0
  15. package/build/static/js/1839.0d0dcac8.chunk.js +1 -0
  16. package/build/static/js/2372.844b5190.chunk.js +2 -0
  17. package/build/static/js/2372.844b5190.chunk.js.LICENSE.txt +10 -0
  18. package/build/static/js/2385.2cbc4e3c.chunk.js +1 -0
  19. package/build/static/js/2448.e6f85eda.chunk.js +1 -0
  20. package/build/static/js/2753.c27b6faa.chunk.js +1 -0
  21. package/build/static/js/2873.f5c04f3b.chunk.js +1 -0
  22. package/build/static/js/2940.dd2240b9.chunk.js +1 -0
  23. package/build/static/js/3208.55e0b2fa.chunk.js +1 -0
  24. package/build/static/js/4021.ec2e87b0.chunk.js +1 -0
  25. package/build/static/js/4482.a9238ad0.chunk.js +1 -0
  26. package/build/static/js/4494.6bb6fb20.chunk.js +1 -0
  27. package/build/static/js/4694.aa16aaee.chunk.js +1 -0
  28. package/build/static/js/4721.2185bda3.chunk.js +1 -0
  29. package/build/static/js/4724.374578aa.chunk.js +1 -0
  30. package/build/static/js/4785.76a05d79.chunk.js +1 -0
  31. package/build/static/js/4831.391fe620.chunk.js +1 -0
  32. package/build/static/js/4949.391c96be.chunk.js +2 -0
  33. package/build/static/js/{2961.54b0c743.chunk.js.LICENSE.txt → 4949.391c96be.chunk.js.LICENSE.txt} +15 -15
  34. package/build/static/js/5299.beb80829.chunk.js +1 -0
  35. package/build/static/js/6093.209cd165.chunk.js +1 -0
  36. package/build/static/js/6134.b9e5b2db.chunk.js +1 -0
  37. package/build/static/js/6679.f4ee1d77.chunk.js +2 -0
  38. package/build/static/js/6679.f4ee1d77.chunk.js.LICENSE.txt +62 -0
  39. package/build/static/js/6802.df955c77.chunk.js +1 -0
  40. package/build/static/js/6865.12e417bf.chunk.js +1 -0
  41. package/build/static/js/698.116a166b.chunk.js +1 -0
  42. package/build/static/js/7125.afecc159.chunk.js +1 -0
  43. package/build/static/js/{7332.2f57919b.chunk.js → 7332.cb5400eb.chunk.js} +1 -1
  44. package/build/static/js/7579.ea965a43.chunk.js +1 -0
  45. package/build/static/js/7696.c9589682.chunk.js +1 -0
  46. package/build/static/js/790.4b5acd65.chunk.js +1 -0
  47. package/build/static/js/8050.029f3dc8.chunk.js +1 -0
  48. package/build/static/js/8097.4837946f.chunk.js +2 -0
  49. package/build/static/js/{3603.e3f6f11d.chunk.js → 8186.2f2e42e5.chunk.js} +2 -2
  50. package/build/static/js/865.143ae622.chunk.js +1 -0
  51. package/build/static/js/8801.77babe65.chunk.js +1 -0
  52. package/build/static/js/8850.6abc7336.chunk.js +1 -0
  53. package/build/static/js/9005.87bae37e.chunk.js +1 -0
  54. package/build/static/js/9166.f234f6b4.chunk.js +2 -0
  55. package/build/static/js/9166.f234f6b4.chunk.js.LICENSE.txt +13 -0
  56. package/build/static/js/9311.7c7348b0.chunk.js +1 -0
  57. package/build/static/js/9320.14465db9.chunk.js +1 -0
  58. package/build/static/js/9449.a2c361bb.chunk.js +2 -0
  59. package/build/static/js/9449.a2c361bb.chunk.js.LICENSE.txt +40 -0
  60. package/build/static/js/9699.df050cd6.chunk.js +1 -0
  61. package/build/static/js/9813.1821ef79.chunk.js +1 -0
  62. package/build/static/js/main.ca9c9d66.js +28 -0
  63. package/build/static/js/{main.52e22014.js.LICENSE.txt → main.ca9c9d66.js.LICENSE.txt} +23 -23
  64. package/build/static/media/SourceCodePro-Bold.17a68a0751a813474a0e.woff2 +0 -0
  65. package/build/static/media/SourceCodePro-BoldItalic.d45b7a3df103d441d78b.woff2 +0 -0
  66. package/build/static/media/SourceCodePro-Italic.ec122a420df4175e74f2.woff2 +0 -0
  67. package/build/static/media/SourceCodePro-Regular.84b900b88d09398d86b0.woff2 +0 -0
  68. package/build/static/media/SourceCodePro-SemiBold.17291d1c493cb25eb2c3.woff2 +0 -0
  69. package/build/static/media/SourceCodePro-SemiBoldItalic.f879ae27307c3926522b.woff2 +0 -0
  70. package/build/static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2 +0 -0
  71. package/build/static/media/SourceSansPro-BoldItalic.1d664be59d2eb5fef029.woff2 +0 -0
  72. package/build/static/media/SourceSansPro-Italic.8a9bfea74d43927d6eec.woff2 +0 -0
  73. package/build/static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2 +0 -0
  74. package/build/static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2 +0 -0
  75. package/build/static/media/SourceSansPro-SemiBoldItalic.befb0a2824eabc5ce36b.woff2 +0 -0
  76. package/build/static/media/SourceSerifPro-Bold.d7975b56594770699ae0.woff2 +0 -0
  77. package/build/static/media/SourceSerifPro-BoldItalic.913697a7178b128caa4c.woff2 +0 -0
  78. package/build/static/media/SourceSerifPro-Italic.d3529cb5797663ac5d88.woff2 +0 -0
  79. package/build/static/media/SourceSerifPro-Regular.e6c37aa3926474cc93e1.woff2 +0 -0
  80. package/build/static/media/SourceSerifPro-SemiBold.5c1d378dd5990ef334ca.woff2 +0 -0
  81. package/build/static/media/SourceSerifPro-SemiBoldItalic.249e948b885d0c7d30a8.woff2 +0 -0
  82. package/build/static/media/index.c05687ef19f5bac24939.cjs +1 -0
  83. package/build/static/media/index.cf5b321a6e04bf47c12e.cjs +1 -0
  84. package/build/static/media/index.db61103fb7fdd62b9c44.cjs +1 -0
  85. package/build/static/media/index.f29488c1099d5e3883ac.cjs +1 -0
  86. package/package.json +5 -5
  87. package/build/static/css/5099.60b7ada4.chunk.css +0 -1
  88. package/build/static/css/main.73ab603a.css +0 -1
  89. package/build/static/js/1318.57c335d2.chunk.js +0 -1
  90. package/build/static/js/142.3d0fb3e3.chunk.js +0 -1
  91. package/build/static/js/172.0ee3e7c6.chunk.js +0 -5
  92. package/build/static/js/1839.29b0ce99.chunk.js +0 -1
  93. package/build/static/js/2327.b8572a38.chunk.js +0 -1
  94. package/build/static/js/2775.c1ed54fa.chunk.js +0 -5
  95. package/build/static/js/291.aa03bc71.chunk.js +0 -1
  96. package/build/static/js/2961.54b0c743.chunk.js +0 -2
  97. package/build/static/js/3580.31cb6ce5.chunk.js +0 -1
  98. package/build/static/js/3744.6440bac0.chunk.js +0 -2
  99. package/build/static/js/3744.6440bac0.chunk.js.LICENSE.txt +0 -5
  100. package/build/static/js/3975.5538132d.chunk.js +0 -1
  101. package/build/static/js/4140.edb6c36a.chunk.js +0 -1
  102. package/build/static/js/4141.623ab362.chunk.js +0 -9
  103. package/build/static/js/4320.5977ee6b.chunk.js +0 -2
  104. package/build/static/js/4320.5977ee6b.chunk.js.LICENSE.txt +0 -20
  105. package/build/static/js/5093.304fcb1e.chunk.js +0 -1
  106. package/build/static/js/5099.51feed45.chunk.js +0 -1
  107. package/build/static/js/5177.21c4f353.chunk.js +0 -2
  108. package/build/static/js/5241.0326c97c.chunk.js +0 -1
  109. package/build/static/js/5440.c7134ed1.chunk.js +0 -1
  110. package/build/static/js/5617.837c33c0.chunk.js +0 -1
  111. package/build/static/js/6557.fd2f35c8.chunk.js +0 -1
  112. package/build/static/js/6679.a8b5d830.chunk.js +0 -2
  113. package/build/static/js/6679.a8b5d830.chunk.js.LICENSE.txt +0 -60
  114. package/build/static/js/6683.aab9fa01.chunk.js +0 -1
  115. package/build/static/js/6756.2cb6963c.chunk.js +0 -1
  116. package/build/static/js/6862.886eab8e.chunk.js +0 -1
  117. package/build/static/js/6865.b0803b6b.chunk.js +0 -1
  118. package/build/static/js/6913.30734208.chunk.js +0 -17
  119. package/build/static/js/6939.c09d92c1.chunk.js +0 -1
  120. package/build/static/js/787.a500c8a4.chunk.js +0 -1
  121. package/build/static/js/792.04aad606.chunk.js +0 -1
  122. package/build/static/js/8035.dc118cc9.chunk.js +0 -1
  123. package/build/static/js/8295.c3cd87de.chunk.js +0 -1
  124. package/build/static/js/8418.aed275df.chunk.js +0 -1
  125. package/build/static/js/8486.e56533d6.chunk.js +0 -1
  126. package/build/static/js/865.9e23130b.chunk.js +0 -1
  127. package/build/static/js/9004.6a66722a.chunk.js +0 -1
  128. package/build/static/js/9042.a6fcbc74.chunk.js +0 -5
  129. package/build/static/js/9107.b49ea9ea.chunk.js +0 -5
  130. package/build/static/js/9130.8e10440e.chunk.js +0 -1
  131. package/build/static/js/9166.1a468fb9.chunk.js +0 -2
  132. package/build/static/js/9166.1a468fb9.chunk.js.LICENSE.txt +0 -13
  133. package/build/static/js/9382.c417d448.chunk.js +0 -1
  134. package/build/static/js/9615.c725e9d2.chunk.js +0 -1
  135. package/build/static/js/9733.e3808291.chunk.js +0 -2
  136. package/build/static/js/9733.e3808291.chunk.js.LICENSE.txt +0 -8
  137. package/build/static/js/9915.fe11690a.chunk.js +0 -1
  138. package/build/static/js/main.52e22014.js +0 -28
  139. package/build/static/media/SourceCodePro-Bold.52ac8f3034507f1d9e53.ttf +0 -0
  140. package/build/static/media/SourceCodePro-BoldItalic.05b618077343fbbd92b7.ttf +0 -0
  141. package/build/static/media/SourceCodePro-Italic.454577c22304619db035.ttf +0 -0
  142. package/build/static/media/SourceCodePro-Regular.70cc7ff27245e82ad414.ttf +0 -0
  143. package/build/static/media/SourceCodePro-SemiBold.4d4c53c06b5bebed1cf3.ttf +0 -0
  144. package/build/static/media/SourceCodePro-SemiBoldItalic.2f5470bc8b2cd27a5c4b.ttf +0 -0
  145. package/build/static/media/SourceSansPro-Bold.12e6acd2589d00c9d0aa.ttf +0 -0
  146. package/build/static/media/SourceSansPro-BoldItalic.7c4f9b00300acb82f0f6.ttf +0 -0
  147. package/build/static/media/SourceSansPro-Italic.3c01996d38a55834ddcb.ttf +0 -0
  148. package/build/static/media/SourceSansPro-Regular.efa76f8326aa5cee3bdd.ttf +0 -0
  149. package/build/static/media/SourceSansPro-SemiBold.43cc81b496222dc9ce3c.ttf +0 -0
  150. package/build/static/media/SourceSansPro-SemiBoldItalic.c30987e28fc21daba1ae.ttf +0 -0
  151. package/build/static/media/SourceSerifPro-Bold.bada4fe17051c992f22f.ttf +0 -0
  152. package/build/static/media/SourceSerifPro-BoldItalic.9f9b1eb2d82e26bb2f4a.ttf +0 -0
  153. package/build/static/media/SourceSerifPro-Italic.90931d6ad253cd8de8e4.ttf +0 -0
  154. package/build/static/media/SourceSerifPro-Regular.6f22301c30206f4bad62.ttf +0 -0
  155. package/build/static/media/SourceSerifPro-SemiBold.b27cb117978bab2c80a3.ttf +0 -0
  156. package/build/static/media/SourceSerifPro-SemiBoldItalic.1266f2c17835efdcff7b.ttf +0 -0
  157. package/build/static/media/index.09797f5e19b3c0491904.cjs +0 -1
  158. package/build/static/media/index.1e3d64b0fcde879f0060.cjs +0 -1
  159. package/build/static/media/index.85823dd8655ed4119d0c.cjs +0 -1
  160. package/build/static/media/index.b599194a631d76b49328.cjs +0 -1
  161. /package/build/static/css/{4320.1edfa457.chunk.css → 9449.1edfa457.chunk.css} +0 -0
  162. /package/build/static/js/{5177.21c4f353.chunk.js.LICENSE.txt → 8097.4837946f.chunk.js.LICENSE.txt} +0 -0
  163. /package/build/static/js/{3603.e3f6f11d.chunk.js.LICENSE.txt → 8186.2f2e42e5.chunk.js.LICENSE.txt} +0 -0
@@ -10,6 +10,28 @@ object-assign
10
10
  http://jedwatson.github.io/classnames
11
11
  */
12
12
 
13
+ /*!
14
+ * Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ * of this software and associated documentation files (the "Software"), to deal
18
+ * in the Software without restriction, including without limitation the rights
19
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ * copies of the Software, and to permit persons to whom the Software is
21
+ * furnished to do so, subject to the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be included in
24
+ * all copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ * SOFTWARE.
33
+ */
34
+
13
35
  /*!
14
36
  * Determine if an object is a Buffer
15
37
  *
@@ -76,28 +98,6 @@ object-assign
76
98
  * Licensed MIT © Zeno Rocha
77
99
  */
78
100
 
79
- /*! @license DOMPurify 2.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.5/LICENSE */
80
-
81
- /*! Moment Duration Format v2.2.2
82
- * https://github.com/jsmreese/moment-duration-format
83
- * Date: 2018-02-16
84
- *
85
- * Duration format plugin function for the Moment.js library
86
- * http://momentjs.com/
87
- *
88
- * Copyright 2018 John Madhavan-Reese
89
- * Released under the MIT license
90
- */
91
-
92
- /**
93
- * @license
94
- * Lodash <https://lodash.com/>
95
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
96
- * Released under MIT license <https://lodash.com/license>
97
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
98
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
99
- */
100
-
101
101
  /**
102
102
  * @license React
103
103
  * react-is.production.min.js
@@ -172,4 +172,4 @@ object-assign
172
172
 
173
173
  //! moment.js
174
174
 
175
- //! version : 0.5.40
175
+ //! version : 0.5.44
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var w3cKeyname=require("w3c-keyname"),prosemirrorState=require("prosemirror-state"),mac="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function normalizeKeyName(e){var t,r,a,i,n=e.split(/-(?!$)/),o=n[n.length-1];"Space"==o&&(o=" ");for(var s=0;s<n.length-1;s++){var f=n[s];if(/^(cmd|meta|m)$/i.test(f))i=!0;else if(/^a(lt)?$/i.test(f))t=!0;else if(/^(c|ctrl|control)$/i.test(f))r=!0;else if(/^s(hift)?$/i.test(f))a=!0;else{if(!/^mod$/i.test(f))throw new Error("Unrecognized modifier name: "+f);mac?i=!0:r=!0}}return t&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),a&&(o="Shift-"+o),o}function normalize(e){var t=Object.create(null);for(var r in e)t[normalizeKeyName(r)]=e[r];return t}function modifiers(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r&&t.shiftKey&&(e="Shift-"+e),e}function keymap(e){return new prosemirrorState.Plugin({props:{handleKeyDown:keydownHandler(e)}})}function keydownHandler(e){var t=normalize(e);return function(e,r){var a,i=w3cKeyname.keyName(r),n=t[modifiers(i,r)];if(n&&n(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){var o=t[modifiers(i,r,!1)];if(o&&o(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(a=w3cKeyname.base[r.keyCode])&&a!=i){var s=t[modifiers(a,r)];if(s&&s(e.state,e.dispatch,e))return!0}}return!1}}exports.keydownHandler=keydownHandler,exports.keymap=keymap;
@@ -0,0 +1 @@
1
+ "use strict";function _createForOfIteratorHelper(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"===typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function _get(){return _get="undefined"!==typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var o=_superPropBase(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},_get.apply(this,arguments)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var n,o=_getPrototypeOf(e);if(t){var r=_getPrototypeOf(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var prosemirrorState=require("prosemirror-state"),prosemirrorModel=require("prosemirror-model"),prosemirrorTransform=require("prosemirror-transform"),domIndex=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},parentNode=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},reusedRange=null,textRange=function(e,t,n){var o=reusedRange||(reusedRange=document.createRange());return o.setEnd(e,null==n?e.nodeValue.length:n),o.setStart(e,t||0),o},isEquivalentPosition=function(e,t,n,o){return n&&(scanFor(e,t,n,o,-1)||scanFor(e,t,n,o,1))},atomElements=/^(img|br|input|textarea|hr)$/i;function scanFor(e,t,n,o,r){for(;;){if(e==n&&t==o)return!0;if(t==(r<0?0:nodeSize(e))){var i=e.parentNode;if(!i||1!=i.nodeType||hasBlockDesc(e)||atomElements.test(e.nodeName)||"false"==e.contentEditable)return!1;t=domIndex(e)+(r<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(r<0?-1:0)]).contentEditable)return!1;t=r<0?nodeSize(e):0}}}function nodeSize(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function isOnEdge(e,t,n){for(var o=0==t,r=t==nodeSize(e);o||r;){if(e==n)return!0;var i=domIndex(e);if(!(e=e.parentNode))return!1;o=o&&0==i,r=r&&i==nodeSize(e)}}function hasBlockDesc(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var selectionCollapsed=function(e){return e.focusNode&&isEquivalentPosition(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function keyEvent(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function deepActiveElement(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function caretFromPoint(e,t,n){if(e.caretPositionFromPoint)try{var o=e.caretPositionFromPoint(t,n);if(o)return{node:o.offsetNode,offset:o.offset}}catch(i){}if(e.caretRangeFromPoint){var r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}var nav="undefined"!=typeof navigator?navigator:null,doc="undefined"!=typeof document?document:null,agent=nav&&nav.userAgent||"",ie_edge=/Edge\/(\d+)/.exec(agent),ie_upto10=/MSIE \d/.exec(agent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent),ie=!!(ie_upto10||ie_11up||ie_edge),ie_version=ie_upto10?document.documentMode:ie_11up?+ie_11up[1]:ie_edge?+ie_edge[1]:0,gecko=!ie&&/gecko\/(\d+)/i.test(agent);gecko&&(/Firefox\/(\d+)/.exec(agent)||[0,0])[1];var _chrome=!ie&&/Chrome\/(\d+)/.exec(agent),chrome=!!_chrome,chrome_version=_chrome?+_chrome[1]:0,safari=!ie&&!!nav&&/Apple Computer/.test(nav.vendor),ios=safari&&(/Mobile\/\w+/.test(agent)||!!nav&&nav.maxTouchPoints>2),mac=ios||!!nav&&/Mac/.test(nav.platform),windows=!!nav&&/Win/.test(nav.platform),android=/Android \d/.test(agent),webkit=!!doc&&"webkitFontSmoothing"in doc.documentElement.style,webkit_version=webkit?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function windowRect(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function getSide(e,t){return"number"==typeof e?e:e[t]}function clientRect(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,o=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*o}}function scrollRectIntoView(e,t,n){for(var o=e.someProp("scrollThreshold")||0,r=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,s=n||e.dom;s;s=parentNode(s))if(1==s.nodeType){var a=s,l=a==i.body,c=l?windowRect(i):clientRect(a),d=0,u=0;if(t.top<c.top+getSide(o,"top")?u=-(c.top-t.top+getSide(r,"top")):t.bottom>c.bottom-getSide(o,"bottom")&&(u=t.bottom-t.top>c.bottom-c.top?t.top+getSide(r,"top")-c.top:t.bottom-c.bottom+getSide(r,"bottom")),t.left<c.left+getSide(o,"left")?d=-(c.left-t.left+getSide(r,"left")):t.right>c.right-getSide(o,"right")&&(d=t.right-c.right+getSide(r,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else{var f=a.scrollLeft,h=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);var p=a.scrollLeft-f,m=a.scrollTop-h;t={left:t.left-p,top:t.top-m,right:t.right-p,bottom:t.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function storeScrollPos(e){for(var t,n,o=e.dom.getBoundingClientRect(),r=Math.max(0,o.top),i=(o.left+o.right)/2,s=r+1;s<Math.min(innerHeight,o.bottom);s+=5){var a=e.root.elementFromPoint(i,s);if(a&&a!=e.dom&&e.dom.contains(a)){var l=a.getBoundingClientRect();if(l.top>=r-20){t=a,n=l.top;break}}}return{refDOM:t,refTop:n,stack:scrollStack(e.dom)}}function scrollStack(e){for(var t=[],n=e.ownerDocument,o=e;o&&(t.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),e!=n);o=parentNode(o));return t}function resetScrollPos(e){var t=e.refDOM,n=e.refTop,o=e.stack,r=t?t.getBoundingClientRect().top:0;restoreScrollStack(o,0==r?0:r-n)}function restoreScrollStack(e,t){for(var n=0;n<e.length;n++){var o=e[n],r=o.dom,i=o.top,s=o.left;r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}var preventScrollSupported=null;function focusPreventScroll(e){if(e.setActive)return e.setActive();if(preventScrollSupported)return e.focus(preventScrollSupported);var t=scrollStack(e);e.focus(null==preventScrollSupported?{get preventScroll(){return preventScrollSupported={preventScroll:!0},!0}}:void 0),preventScrollSupported||(preventScrollSupported=!1,restoreScrollStack(t,0))}function findOffsetInNode(e,t){for(var n,o,r,i,s=2e8,a=0,l=t.top,c=t.top,d=e.firstChild,u=0;d;d=d.nextSibling,u++){var f=void 0;if(1==d.nodeType)f=d.getClientRects();else{if(3!=d.nodeType)continue;f=textRange(d).getClientRects()}for(var h=0;h<f.length;h++){var p=f[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);var m=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(m<s){n=d,s=m,o=m&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&m&&(a=u+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!r&&p.left<=t.left&&p.right>=t.left&&(r=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=u+1)}}return!n&&r&&(n=r,o=i,s=0),n&&3==n.nodeType?findOffsetInText(n,o):!n||s&&1==n.nodeType?{node:e,offset:a}:findOffsetInNode(n,o)}function findOffsetInText(e,t){for(var n=e.nodeValue.length,o=document.createRange(),r=0;r<n;r++){o.setEnd(e,r+1),o.setStart(e,r);var i=singleRect(o,1);if(i.top!=i.bottom&&inRect(t,i))return{node:e,offset:r+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function inRect(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function targetKludge(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function posFromElement(e,t,n){var o=findOffsetInNode(t,n),r=o.node,i=o.offset,s=-1;if(1==r.nodeType&&!r.firstChild){var a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}function posFromCaret(e,t,n,o){for(var r=-1,i=t,s=!1;i!=e.dom;){var a=e.docView.nearestDesc(i,!0);if(!a)return null;if(1==a.dom.nodeType&&(a.node.isBlock&&a.parent&&!s||!a.contentDOM)){var l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!s&&(s=!0,l.left>o.left||l.top>o.top?r=a.posBefore:(l.right<o.left||l.bottom<o.top)&&(r=a.posAfter)),!a.contentDOM&&r<0&&!a.node.isText)return(a.node.isBlock?o.top<(l.top+l.bottom)/2:o.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return r>-1?r:e.docView.posFromDOM(t,n,-1)}function elementFromPoint(e,t,n){var o=e.childNodes.length;if(o&&n.top<n.bottom)for(var r=Math.max(0,Math.min(o-1,Math.floor(o*(t.top-n.top)/(n.bottom-n.top))-2)),i=r;;){var s=e.childNodes[i];if(1==s.nodeType)for(var a=s.getClientRects(),l=0;l<a.length;l++){var c=a[l];if(inRect(t,c))return elementFromPoint(s,t,c)}if((i=(i+1)%o)==r)break}return e}function _posAtCoords(e,t){var n,o=e.dom.ownerDocument,r=0,i=caretFromPoint(o,t.left,t.top);i&&(n=i.node,r=i.offset);var s,a=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){var l=e.dom.getBoundingClientRect();if(!inRect(t,l))return null;if(!(a=elementFromPoint(e.dom,t,l)))return null}if(safari)for(var c=a;n&&c;c=parentNode(c))c.draggable&&(n=void 0);if(a=targetKludge(a,t),n){if(gecko&&1==n.nodeType&&(r=Math.min(r,n.childNodes.length))<n.childNodes.length){var d,u=n.childNodes[r];"IMG"==u.nodeName&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&r++}var f;webkit&&r&&1==n.nodeType&&1==(f=n.childNodes[r-1]).nodeType&&"false"==f.contentEditable&&f.getBoundingClientRect().top>=t.top&&r--,n==e.dom&&r==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=r&&1==n.nodeType&&"BR"==n.childNodes[r-1].nodeName||(s=posFromCaret(e,n,r,t))}null==s&&(s=posFromElement(e,a,t));var h=e.docView.nearestDesc(a,!0);return{pos:s,inside:h?h.posAtStart-h.border:-1}}function nonZero(e){return e.top<e.bottom||e.left<e.right}function singleRect(e,t){var n=e.getClientRects();if(n.length){var o=n[t<0?0:n.length-1];if(nonZero(o))return o}return Array.prototype.find.call(n,nonZero)||e.getBoundingClientRect()}var BIDI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _coordsAtPos(e,t,n){var o=e.docView.domFromPos(t,n<0?-1:1),r=o.node,i=o.offset,s=o.atom,a=webkit||gecko;if(3==r.nodeType){if(!a||!BIDI.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){var l=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==r.nodeValue.length?(l--,d=1):n<0?l--:c++,flattenV(singleRect(textRange(r,l,c),d),d<0)}var u=singleRect(textRange(r,i,i),n);if(gecko&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){var f=singleRect(textRange(r,i-1,i-1),-1);if(f.top==u.top){var h=singleRect(textRange(r,i,i+1),-1);if(h.top!=u.top)return flattenV(h,h.left<f.left)}}return u}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==nodeSize(r))){var p=r.childNodes[i-1];if(1==p.nodeType)return flattenH(p.getBoundingClientRect(),!1)}if(null==s&&i<nodeSize(r)){var m=r.childNodes[i];if(1==m.nodeType)return flattenH(m.getBoundingClientRect(),!0)}return flattenH(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==nodeSize(r))){var v=r.childNodes[i-1],g=3==v.nodeType?textRange(v,nodeSize(v)-(a?0:1)):1!=v.nodeType||"BR"==v.nodeName&&v.nextSibling?null:v;if(g)return flattenV(singleRect(g,1),!1)}if(null==s&&i<nodeSize(r)){for(var y=r.childNodes[i];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var b=y?3==y.nodeType?textRange(y,0,a?0:1):1==y.nodeType?y:null:null;if(b)return flattenV(singleRect(b,-1),!0)}return flattenV(singleRect(3==r.nodeType?textRange(r):r,-n),n>=0)}function flattenV(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function flattenH(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function withFlushedState(e,t,n){var o=e.state,r=e.root.activeElement;o!=t&&e.updateState(t),r!=e.dom&&e.focus();try{return n()}finally{o!=t&&e.updateState(o),r!=e.dom&&r&&r.focus()}}function endOfTextblockVertical(e,t,n){var o=t.selection,r="up"==n?o.$from:o.$to;return withFlushedState(e,t,(function(){for(var t=e.docView.domFromPos(r.pos,"up"==n?-1:1).node;;){var o=e.docView.nearestDesc(t,!0);if(!o)break;if(o.node.isBlock){t=o.contentDOM||o.dom;break}t=o.dom.parentNode}for(var i=_coordsAtPos(e,r.pos,1),s=t.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=textRange(s,0,s.nodeValue.length).getClientRects()}for(var l=0;l<a.length;l++){var c=a[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0}))}var maybeRTL=/[\u0590-\u08ac]/;function endOfTextblockHorizontal(e,t,n){var o=t.selection.$head;if(!o.parent.isTextblock)return!1;var r=o.parentOffset,i=!r,s=r==o.parent.content.size,a=e.domSelection();return maybeRTL.test(o.parent.textContent)&&a.modify?withFlushedState(e,t,(function(){var t=e.domSelectionRange(),r=t.focusNode,i=t.focusOffset,s=t.anchorNode,l=t.anchorOffset,c=a.caretBidiLevel;a.modify("move",n,"character");var d=o.depth?e.docView.domAfterPos(o.before()):e.dom,u=e.domSelectionRange(),f=u.focusNode,h=u.focusOffset,p=f&&!d.contains(1==f.nodeType?f:f.parentNode)||r==f&&i==h;try{a.collapse(s,l),r&&(r!=s||i!=l)&&a.extend&&a.extend(r,i)}catch(m){}return null!=c&&(a.caretBidiLevel=c),p})):"left"==n||"backward"==n?i:s}var cachedState=null,cachedDir=null,cachedResult=!1;function _endOfTextblock(e,t,n){return cachedState==t&&cachedDir==n?cachedResult:(cachedState=t,cachedDir=n,cachedResult="up"==n||"down"==n?endOfTextblockVertical(e,t,n):endOfTextblockHorizontal(e,t,n))}var NOT_DIRTY=0,CHILD_DIRTY=1,CONTENT_DIRTY=2,NODE_DIRTY=3,ViewDesc=function(){function e(t,n,o,r){_classCallCheck(this,e),this.parent=t,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=NOT_DIRTY,o.pmViewDesc=this}return _createClass(e,[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var o=this.children[t];if(o==e)return n;n+=o.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var o,r;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&(!(r=o.pmViewDesc)||r.parent!=this);)o=o.previousSibling;return o?this.posBeforeChild(r)+r.size:this.posAtStart}var i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(e==this.dom&&this.contentDOM)a=t>domIndex(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){a=!1;break}if(l.previousSibling)break}if(null==a&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){a=!0;break}if(c.nextSibling)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,o=e;o;o=o.parentNode){var r=this.getDesc(o),i=void 0;if(r&&(!t||r.node)){if(!n||!(i=r.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return r;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var o=e;o;o=o.parentNode){var r=this.getDesc(o);if(r)return r.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var o=this.children[t],r=n+o.size;if(n==e&&r!=n){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<r)return o.descAt(e-n-o.border);n=r}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,o=0,r=0,i=0;o<this.children.length;o++){var s=this.children[o],a=i+s.size;if(a>e||s instanceof TrailingHackViewDesc){r=e-i;break}i=a}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(;o&&!(n=this.children[o-1]).size&&n instanceof WidgetViewDesc&&n.side>=0;o--);if(t<=0){for(var l,c=!0;(l=o?this.children[o-1]:null)&&l.dom.parentNode!=this.contentDOM;o--,c=!1);return l&&t&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?domIndex(l.dom)+1:0}}for(var d,u=!0;(d=o<this.children.length?this.children[o]:null)&&d.dom.parentNode!=this.contentDOM;o++,u=!1);return d&&u&&!d.border&&!d.domAtom?d.domFromPos(0,t):{node:this.contentDOM,offset:d?domIndex(d.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var o=-1,r=-1,i=n,s=0;;s++){var a=this.children[s],l=i+a.size;if(-1==o&&e<=l){var c=i+a.border;if(e>=c&&t<=l-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,c);e=i;for(var d=s;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){o=domIndex(u.dom)+1;break}e-=u.size}-1==o&&(o=0)}if(o>-1&&(l>t||s==this.children.length-1)){t=l;for(var f=s+1;f<this.children.length;f++){var h=this.children[f];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){r=domIndex(h.dom);break}t+=h.size}-1==r&&(r=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:r}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,o=t.offset;if(1!=n.nodeType||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}},{key:"setSelection",value:function(e,t,n){for(var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=Math.min(e,t),i=Math.max(e,t),s=0,a=0;s<this.children.length;s++){var l=this.children[s],c=a+l.size;if(r>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,o);a=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),f=n.getSelection(),h=!1;if((gecko||safari)&&e==t){var p=d,m=p.node,v=p.offset;if(3==m.nodeType){if((h=!(!v||"\n"!=m.nodeValue[v-1]))&&v==m.nodeValue.length)for(var g,y=m;y;y=y.parentNode){if(g=y.nextSibling){"BR"==g.nodeName&&(d=u={node:g.parentNode,offset:domIndex(g)+1});break}var b=y.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{var S=m.childNodes[v-1];h=S&&("BR"==S.nodeName||"false"==S.contentEditable)}}if(gecko&&f.focusNode&&f.focusNode!=u.node&&1==f.focusNode.nodeType){var k=f.focusNode.childNodes[f.focusOffset];k&&"false"==k.contentEditable&&(o=!0)}if(o||h&&safari||!isEquivalentPosition(d.node,d.offset,f.anchorNode,f.anchorOffset)||!isEquivalentPosition(u.node,u.offset,f.focusNode,f.focusOffset)){var D=!1;if((f.extend||e==t)&&!h){f.collapse(d.node,d.offset);try{e!=t&&f.extend(u.node,u.offset),D=!0}catch(O){}}if(!D){if(e>t){var C=d;d=u,u=C}var w=document.createRange();w.setEnd(u.node,u.offset),w.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(w)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,o=0;o<this.children.length;o++){var r=this.children[o],i=n+r.size;if(n==i?e<=i&&t>=n:e<i&&t>n){var s=n+r.border,a=i-r.border;if(e>=s&&t<=a)return this.dirty=e==n||t==i?CONTENT_DIRTY:CHILD_DIRTY,void(e!=s||t!=a||!r.contentLost&&r.dom.parentNode==this.contentDOM?r.markDirty(e-s,t-s):r.dirty=NODE_DIRTY);r.dirty=r.dom!=r.contentDOM||r.dom.parentNode!=this.contentDOM||r.children.length?NODE_DIRTY:CONTENT_DIRTY}n=i}this.dirty=CONTENT_DIRTY}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?CONTENT_DIRTY:CHILD_DIRTY;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}}]),e}(),WidgetViewDesc=function(e){_inherits(n,ViewDesc);var t=_createSuper(n);function n(e,o,r,i){var s;_classCallCheck(this,n);var a,l=o.type.toDOM;if("function"==typeof l&&(l=l(r,(function(){return a?a.parent?a.parent.posBeforeChild(a):void 0:i}))),!o.type.spec.raw){if(1!=l.nodeType){var c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}return(s=t.call(this,e,[],l,null)).widget=o,s.widget=o,a=_assertThisInitialized(s),s}return _createClass(n,[{key:"matchesWidget",value:function(e){return this.dirty==NOT_DIRTY&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),_get(_getPrototypeOf(n.prototype),"destroy",this).call(this)}},{key:"domAtom",get:function(){return!0}},{key:"side",get:function(){return this.widget.type.side}}]),n}(),CompositionViewDesc=function(e){_inherits(n,ViewDesc);var t=_createSuper(n);function n(e,o,r,i){var s;return _classCallCheck(this,n),(s=t.call(this,e,[],o,null)).textDOM=r,s.text=i,s}return _createClass(n,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}]),n}(),MarkViewDesc=function(e){_inherits(n,ViewDesc);var t=_createSuper(n);function n(e,o,r,i){var s;return _classCallCheck(this,n),(s=t.call(this,e,[],r,i)).mark=o,s}return _createClass(n,[{key:"parseRule",value:function(){return this.dirty&NODE_DIRTY||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return this.dirty!=NODE_DIRTY&&this.mark.eq(e)}},{key:"markDirty",value:function(e,t){if(_get(_getPrototypeOf(n.prototype),"markDirty",this).call(this,e,t),this.dirty!=NOT_DIRTY){for(var o=this.parent;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=NOT_DIRTY}}},{key:"slice",value:function(e,t,o){var r=n.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=replaceNodes(i,t,s,o)),e>0&&(i=replaceNodes(i,0,e,o));for(var a=0;a<i.length;a++)i[a].parent=r;return r.children=i,r}}],[{key:"create",value:function(e,t,o,r){var i=r.nodeViews[t.type.name],s=i&&i(t,r,o);return s&&s.dom||(s=prosemirrorModel.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,o))),new n(e,t,s.dom,s.contentDOM||s.dom)}}]),n}(),NodeViewDesc=function(e){_inherits(n,ViewDesc);var t=_createSuper(n);function n(e,o,r,i,s,a,l,c,d){var u;return _classCallCheck(this,n),(u=t.call(this,e,[],s,a)).node=o,u.outerDeco=r,u.innerDeco=i,u.nodeDOM=l,u}return _createClass(n,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var o=this.children[n];if(this.dom.contains(o.dom.parentNode)){t.contentElement=o.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return prosemirrorModel.Fragment.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return this.dirty==NOT_DIRTY&&e.eq(this.node)&&sameOuterDeco(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new ViewTreeUpdater(this,s&&s.node,e);iterDeco(this.node,this.innerDeco,(function(t,i,s){t.spec.marks?l.syncToMarks(t.spec.marks,o,e):t.type.side>=0&&!s&&l.syncToMarks(i==n.node.childCount?prosemirrorModel.Mark.none:n.node.child(i).marks,o,e),l.placeWidget(t,e,r)}),(function(t,n,s,c){var d;l.syncToMarks(t.marks,o,e),l.findNodeMatch(t,n,s,c)||a&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,n,s,d,e)||l.updateNextNode(t,n,s,e,c,r)||l.addNode(t,n,s,e,r),r+=t.nodeSize})),l.syncToMarks([],o,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==CONTENT_DIRTY)&&(s&&this.protectLocalComposition(e,s),renderDescs(this.contentDOM,this.children,e),ios&&iosHacks(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,o=n.from,r=n.to;if(!(e.state.selection instanceof prosemirrorState.TextSelection)||o<t||r>t+this.node.content.size)return null;var i=e.domSelectionRange(),s=nearbyTextNode(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){var a=s.nodeValue,l=findTextInFragment(this.node.content,a,o-t,r-t);return l<0?null:{node:s,pos:l,text:a}}return{node:s,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,o=t.pos,r=t.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}var s=new CompositionViewDesc(this,i,n,r);e.input.compositionNodes.push(s),this.children=replaceNodes(this.children,o,o+r.length,e,s)}}},{key:"update",value:function(e,t,n,o){return!(this.dirty==NODE_DIRTY||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,o),!0)}},{key:"updateInner",value:function(e,t,n,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=NOT_DIRTY}},{key:"updateOuterDeco",value:function(e){if(!sameOuterDeco(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=patchOuterDeco(this.dom,this.nodeDOM,computeOuterDeco(this.outerDeco,this.node,t),computeOuterDeco(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,t,o,r,i,s){var a,l=i.nodeViews[t.type.name],c=l&&l(t,i,(function(){return a?a.parent?a.parent.posBeforeChild(a):void 0:s}),o,r),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else if(!d){var f=prosemirrorModel.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t));d=f.dom,u=f.contentDOM}u||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));var h=d;return d=applyOuterDeco(d,o,t),c?a=new CustomNodeViewDesc(e,t,o,r,d,u||null,h,c,i,s+1):t.isText?new TextViewDesc(e,t,o,r,d,h,i):new n(e,t,o,r,d,u||null,h,i,s+1)}}]),n}();function docViewDesc(e,t,n,o,r){applyOuterDeco(o,t,e);var i=new NodeViewDesc(void 0,e,t,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}var TextViewDesc=function(e){_inherits(n,NodeViewDesc);var t=_createSuper(n);function n(e,o,r,i,s,a,l){return _classCallCheck(this,n),t.call(this,e,o,r,i,s,null,a,l,0)}return _createClass(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,o){return!(this.dirty==NODE_DIRTY||this.dirty!=NOT_DIRTY&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),this.dirty==NOT_DIRTY&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=NOT_DIRTY,!0)}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):_get(_getPrototypeOf(n.prototype),"localPosFromDOM",this).call(this,e,t,o)}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,o){var r=this.node.cut(e,t),i=document.createTextNode(r.text);return new n(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}},{key:"markDirty",value:function(e,t){_get(_getPrototypeOf(n.prototype),"markDirty",this).call(this,e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=NODE_DIRTY)}},{key:"domAtom",get:function(){return!1}}]),n}(),TrailingHackViewDesc=function(e){_inherits(n,ViewDesc);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return this.dirty==NOT_DIRTY&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}]),n}(),CustomNodeViewDesc=function(e){_inherits(n,NodeViewDesc);var t=_createSuper(n);function n(e,o,r,i,s,a,l,c,d,u){var f;return _classCallCheck(this,n),(f=t.call(this,e,o,r,i,s,a,l,d,u)).spec=c,f}return _createClass(n,[{key:"update",value:function(e,t,o,r){if(this.dirty==NODE_DIRTY)return!1;if(this.spec.update){var i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}return!(!this.contentDOM&&!e.isLeaf)&&_get(_getPrototypeOf(n.prototype),"update",this).call(this,e,t,o,r)}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():_get(_getPrototypeOf(n.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():_get(_getPrototypeOf(n.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o):_get(_getPrototypeOf(n.prototype),"setSelection",this).call(this,e,t,o,r)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),_get(_getPrototypeOf(n.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):_get(_getPrototypeOf(n.prototype),"ignoreMutation",this).call(this,e)}}]),n}();function renderDescs(e,t,n){for(var o=e.firstChild,r=!1,i=0;i<t.length;i++){var s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=o;)o=rm(o),r=!0;o=o.nextSibling}else r=!0,e.insertBefore(a,o);if(s instanceof MarkViewDesc){var l=o?o.previousSibling:e.lastChild;renderDescs(s.contentDOM,s.children,n),o=l?l.nextSibling:e.firstChild}}for(;o;)o=rm(o),r=!0;r&&n.trackWrites==e&&(n.trackWrites=null)}var OuterDecoLevel=function(e){e&&(this.nodeName=e)};OuterDecoLevel.prototype=Object.create(null);var noDeco=[new OuterDecoLevel];function computeOuterDeco(e,t,n){if(0==e.length)return noDeco;for(var o=n?noDeco[0]:new OuterDecoLevel,r=[o],i=0;i<e.length;i++){var s=e[i].type.attrs;if(s)for(var a in s.nodeName&&r.push(o=new OuterDecoLevel(s.nodeName)),s){var l=s[a];null!=l&&(n&&1==r.length&&r.push(o=new OuterDecoLevel(t.isInline?"span":"div")),"class"==a?o.class=(o.class?o.class+" ":"")+l:"style"==a?o.style=(o.style?o.style+";":"")+l:"nodeName"!=a&&(o[a]=l))}}return r}function patchOuterDeco(e,t,n,o){if(n==noDeco&&o==noDeco)return t;for(var r=t,i=0;i<o.length;i++){var s=o[i],a=n[i];if(i){var l=void 0;a&&a.nodeName==s.nodeName&&r!=e&&(l=r.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||((l=document.createElement(s.nodeName)).pmIsDeco=!0,l.appendChild(r),a=noDeco[0]),r=l}patchAttributes(r,a||noDeco[0],s)}return r}function patchAttributes(e,t,n){for(var o in t)"class"==o||"style"==o||"nodeName"==o||o in n||e.removeAttribute(o);for(var r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){for(var i=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[],a=0;a<i.length;a++)-1==s.indexOf(i[a])&&e.classList.remove(i[a]);for(var l=0;l<s.length;l++)-1==i.indexOf(s[l])&&e.classList.add(s[l]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function applyOuterDeco(e,t,n){return patchOuterDeco(e,e,noDeco,computeOuterDeco(t,n,1!=e.nodeType))}function sameOuterDeco(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function rm(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var ViewTreeUpdater=function(){function e(t,n,o){_classCallCheck(this,e),this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=preMatch(t.node.content,t)}return _createClass(e,[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n){for(var o=0,r=this.stack.length>>1,i=Math.min(r,e.length);o<i&&(o==r-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<r;)this.destroyRest(),this.top.dirty=NOT_DIRTY,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<e.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){var l=this.top.children[a];if(l.matchesMark(e[r])&&!this.isLocked(l.dom)){s=a;break}}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=MarkViewDesc.create(this.top,e[r],t,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,r++}}},{key:"findNodeMatch",value:function(e,t,n,o){var r,i=-1;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,n))i=this.top.children.indexOf(r,this.index);else for(var s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){var l=this.top.children[s];if(l.matchesNode(e,t,n)&&!this.preMatch.matched.has(l)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}},{key:"updateNodeAt",value:function(e,t,n,o,r){var i=this.top.children[o];return i.dirty==NODE_DIRTY&&i.dom==i.contentDOM&&(i.dirty=CONTENT_DIRTY),!!i.update(e,t,n,r)&&(this.destroyBetween(this.index,o),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==n)return o;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,o,r,i){for(var s=this.index;s<this.top.children.length;s++){var a=this.top.children[s];if(a instanceof NodeViewDesc){var l=this.preMatch.matched.get(a);if(null!=l&&l!=r)return!1;var c=a.dom,d=void 0,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=NODE_DIRTY&&sameOuterDeco(t,a.outerDeco));if(!u&&a.update(e,t,n,o))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,o,i)))return this.top.children[this.index]=d,d.contentDOM&&(d.dirty=CONTENT_DIRTY,d.updateChildren(o,i+1),d.dirty=NOT_DIRTY),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,o,r,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;var s=NodeViewDesc.create(this.top,t,n,o,r,i);if(s.contentDOM){s.children=e.children,e.children=[];var a,l=_createForOfIteratorHelper(s.children);try{for(l.s();!(a=l.n()).done;){a.value.parent=s}}catch(c){l.e(c)}finally{l.f()}}return e.destroy(),s}},{key:"addNode",value:function(e,t,n,o,r){var i=NodeViewDesc.create(this.top,e,t,n,o,r);i.contentDOM&&i.updateChildren(o,r+1),this.top.children.splice(this.index++,0,i),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var o=this.index<this.top.children.length?this.top.children[this.index]:null;if(!o||!o.matchesWidget(e)||e!=o.widget&&o.widget.type.toDOM.parentNode){var r=new WidgetViewDesc(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof MarkViewDesc;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof TextViewDesc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((safari||chrome)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var o=new TrailingHackViewDesc(this.top,[],n,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}]),e}();function preMatch(e,t){var n=t,o=n.children.length,r=e.childCount,i=new Map,s=[];e:for(;r>0;){for(var a=void 0;;)if(o){var l=n.children[o-1];if(!(l instanceof MarkViewDesc)){a=l,o--;break}n=l,o=l.children.length}else{if(n==t)break e;o=n.parent.children.indexOf(n),n=n.parent}var c=a.node;if(c){if(c!=e.child(r-1))break;--r,i.set(a,r),s.push(a)}}return{index:r,matched:i,matches:s.reverse()}}function compareSide(e,t){return e.type.side-t.type.side}function iterDeco(e,t,n,o){var r=t.locals(e),i=0;if(0!=r.length)for(var s=0,a=[],l=null,c=0;;){for(var d=void 0,u=void 0;s<r.length&&r[s].to==i;){var f=r[s++];f.widget&&(d?(u||(u=[d])).push(f):d=f)}if(d)if(u){u.sort(compareSide);for(var h=0;h<u.length;h++)n(u[h],c,!!l)}else n(d,c,!!l);var p=void 0,m=void 0;if(l)m=-1,p=l,l=null;else{if(!(c<e.childCount))break;m=c,p=e.child(c++)}for(var v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)a.push(r[s++]);var g=i+p.nodeSize;if(p.isText){var y=g;s<r.length&&r[s].from<y&&(y=r[s].from);for(var b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<g&&(l=p.cut(y-i),p=p.cut(0,y-i),g=y,m=-1)}else for(;s<r.length&&r[s].to<g;)s++;o(p,p.isInline&&!p.isLeaf?a.filter((function(e){return!e.inline})):a.slice(),t.forChild(i,p),m),i=g}else for(var S=0;S<e.childCount;S++){var k=e.child(S);o(k,r,t.forChild(i,k),S),i+=k.nodeSize}}function iosHacks(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function nearbyTextNode(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=nodeSize(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}function findTextInFragment(e,t,n,o){for(var r=0,i=0;r<e.childCount&&i<=o;){var s=e.child(r++),a=i;if(i+=s.nodeSize,s.isText){for(var l=s.text;r<e.childCount;){var c=e.child(r++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=o&&l.slice(o-t.length-a,o-a)==t)return o-t.length;var d=a<o?l.lastIndexOf(t,o-a-1):-1;if(d>=0&&d+t.length+a>=n)return a+d;if(n==o&&l.length>=o+t.length-a&&l.slice(o-a,o-a+t.length)==t)return o}}}return-1}function replaceNodes(e,t,n,o,r){for(var i=[],s=0,a=0;s<e.length;s++){var l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,o)),r&&(i.push(r),r=void 0),d>n&&i.push(l.slice(n-c,l.size,o)))}return i}function selectionFromDOM(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;var r=e.docView.nearestDesc(n.focusNode),i=r&&0==r.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;var a,l,c=o.resolve(s);if(selectionCollapsed(n)){for(a=c;r&&!r.node;)r=r.parent;var d=r.node;if(r&&d.isAtom&&prosemirrorState.NodeSelection.isSelectable(d)&&r.parent&&(!d.isInline||!isOnEdge(n.focusNode,n.focusOffset,r.dom))){var u=r.posBefore;l=new prosemirrorState.NodeSelection(s==u?c:o.resolve(u))}}else{var f=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null;a=o.resolve(f)}l||(l=selectionBetween(e,a,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1));return l}function editorOwnsSelection(e){return e.editable?e.hasFocus():hasSelection(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function selectionToDOM(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(syncNodeSelection(e,n),editorOwnsSelection(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&chrome){var o=e.domSelectionRange(),r=e.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&isEquivalentPosition(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)selectCursorWrapper(e);else{var i,s,a=n.anchor,l=n.head;!brokenSelectBetweenUneditable||n instanceof prosemirrorState.TextSelection||(n.$from.parent.inlineContent||(i=temporarilyEditableNear(e,n.from)),n.empty||n.$from.parent.inlineContent||(s=temporarilyEditableNear(e,n.to))),e.docView.setSelection(a,l,e.root,t),brokenSelectBetweenUneditable&&(i&&resetEditable(i),s&&resetEditable(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&removeClassOnSelectionChange(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var brokenSelectBetweenUneditable=safari||chrome&&chrome_version<63;function temporarilyEditableNear(e,t){var n=e.docView.domFromPos(t,0),o=n.node,r=n.offset,i=r<o.childNodes.length?o.childNodes[r]:null,s=r?o.childNodes[r-1]:null;if(safari&&i&&"false"==i.contentEditable)return setEditable(i);if((!i||"false"==i.contentEditable)&&(!s||"false"==s.contentEditable)){if(i)return setEditable(i);if(s)return setEditable(s)}}function setEditable(e){return e.contentEditable="true",safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function resetEditable(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function removeClassOnSelectionChange(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==o&&n.anchorOffset==r||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((function(){editorOwnsSelection(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}function selectCursorWrapper(e){var t=e.domSelection(),n=document.createRange(),o=e.cursorWrapper.dom,r="IMG"==o.nodeName;r?n.setEnd(o.parentNode,domIndex(o)+1):n.setEnd(o,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!r&&!e.state.selection.visible&&ie&&ie_version<=11&&(o.disabled=!0,o.disabled=!1)}function syncNodeSelection(e,t){if(t instanceof prosemirrorState.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(clearNodeSelection(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else clearNodeSelection(e)}function clearNodeSelection(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function selectionBetween(e,t,n,o){return e.someProp("createSelectionBetween",(function(o){return o(e,t,n)}))||prosemirrorState.TextSelection.between(t,n,o)}function hasFocusAndSelection(e){return!(e.editable&&!e.hasFocus())&&hasSelection(e)}function hasSelection(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(n){return!1}}function anchorInRightPlace(e){var t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return isEquivalentPosition(t.node,t.offset,n.anchorNode,n.anchorOffset)}function moveSelectionBlock(e,t){var n=e.selection,o=n.$anchor,r=n.$head,i=t>0?o.max(r):o.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&prosemirrorState.Selection.findFrom(s,t)}function apply(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function selectHorizontally(e,t,n){var o=e.state.selection;if(!(o instanceof prosemirrorState.TextSelection)){if(o instanceof prosemirrorState.NodeSelection&&o.node.isInline)return apply(e,new prosemirrorState.TextSelection(t>0?o.$to:o.$from));var r=moveSelectionBlock(e.state,t);return!!r&&apply(e,r)}if(n.indexOf("s")>-1){var i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;var a=e.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return apply(e,new prosemirrorState.TextSelection(o.$anchor,a))}if(!o.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var l=moveSelectionBlock(e.state,t);return!!(l&&l instanceof prosemirrorState.NodeSelection)&&apply(e,l)}if(!(mac&&n.indexOf("m")>-1)){var c,d=o.$head,u=d.textOffset?null:t<0?d.nodeBefore:d.nodeAfter;if(!u||u.isText)return!1;var f=t<0?d.pos-u.nodeSize:d.pos;return!!(u.isAtom||(c=e.docView.descAt(f))&&!c.contentDOM)&&(prosemirrorState.NodeSelection.isSelectable(u)?apply(e,new prosemirrorState.NodeSelection(t<0?e.state.doc.resolve(d.pos-u.nodeSize):d)):!!webkit&&apply(e,new prosemirrorState.TextSelection(e.state.doc.resolve(t<0?f:f+u.nodeSize))))}}function nodeLen(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function isIgnorable(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function skipIgnoredNodes(e,t){return t<0?skipIgnoredNodesBefore(e):skipIgnoredNodesAfter(e)}function skipIgnoredNodesBefore(e){var t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(n){var r,i,s=!1;for(gecko&&1==n.nodeType&&o<nodeLen(n)&&isIgnorable(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(1!=n.nodeType)break;var a=n.childNodes[o-1];if(isIgnorable(a,-1))r=n,i=--o;else{if(3!=a.nodeType)break;o=(n=a).nodeValue.length}}else{if(isBlockNode(n))break;for(var l=n.previousSibling;l&&isIgnorable(l,-1);)r=n.parentNode,i=domIndex(l),l=l.previousSibling;if(l)o=nodeLen(n=l);else{if((n=n.parentNode)==e.dom)break;o=0}}s?setSelFocus(e,n,o):r&&setSelFocus(e,r,i)}}function skipIgnoredNodesAfter(e){var t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(n){for(var r,i,s=nodeLen(n);;)if(o<s){if(1!=n.nodeType)break;if(!isIgnorable(n.childNodes[o],1))break;r=n,i=++o}else{if(isBlockNode(n))break;for(var a=n.nextSibling;a&&isIgnorable(a,1);)r=a.parentNode,i=domIndex(a)+1,a=a.nextSibling;if(a)o=0,s=nodeLen(n=a);else{if((n=n.parentNode)==e.dom)break;o=s=0}}r&&setSelFocus(e,r,i)}}function isBlockNode(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function textNodeAfter(e,t){for(;e&&t==e.childNodes.length&&!hasBlockDesc(e);)t=domIndex(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}function textNodeBefore(e,t){for(;e&&!t&&!hasBlockDesc(e);)t=domIndex(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}function setSelFocus(e,t,n){var o,r;3!=t.nodeType&&((r=textNodeAfter(t,n))?(t=r,n=0):(o=textNodeBefore(t,n))&&(t=o,n=o.nodeValue.length));var i=e.domSelection();if(selectionCollapsed(i)){var s=document.createRange();s.setEnd(t,n),s.setStart(t,n),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(t,n);e.domObserver.setCurSelection();var a=e.state;setTimeout((function(){e.state==a&&selectionToDOM(e)}),50)}function findDirection(e,t){var n=e.state.doc.resolve(t);if(!chrome&&!windows&&n.parent.inlineContent){var o=e.coordsAtPos(t);if(t>n.start()){var r=e.coordsAtPos(t-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(t<n.end()){var s=e.coordsAtPos(t+1),a=(s.top+s.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function selectVertically(e,t,n){var o=e.state.selection;if(o instanceof prosemirrorState.TextSelection&&!o.empty||n.indexOf("s")>-1)return!1;if(mac&&n.indexOf("m")>-1)return!1;var r=o.$from,i=o.$to;if(!r.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var s=moveSelectionBlock(e.state,t);if(s&&s instanceof prosemirrorState.NodeSelection)return apply(e,s)}if(!r.parent.inlineContent){var a=t<0?r:i,l=o instanceof prosemirrorState.AllSelection?prosemirrorState.Selection.near(a,t):prosemirrorState.Selection.findFrom(a,t);return!!l&&apply(e,l)}return!1}function stopNativeHorizontalDelete(e,t){if(!(e.state.selection instanceof prosemirrorState.TextSelection))return!0;var n=e.state.selection,o=n.$head,r=n.$anchor,i=n.empty;if(!o.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var s=!o.textOffset&&(t<0?o.nodeBefore:o.nodeAfter);if(s&&!s.isText){var a=e.state.tr;return t<0?a.delete(o.pos-s.nodeSize,o.pos):a.delete(o.pos,o.pos+s.nodeSize),e.dispatch(a),!0}return!1}function switchEditable(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function safariDownArrowBug(e){if(!safari||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(n&&1==n.nodeType&&0==o&&n.firstChild&&"false"==n.firstChild.contentEditable){var r=n.firstChild;switchEditable(e,r,"true"),setTimeout((function(){return switchEditable(e,r,"false")}),20)}return!1}function getMods(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function captureKeyDown(e,t){var n=t.keyCode,o=getMods(t);if(8==n||mac&&72==n&&"c"==o)return stopNativeHorizontalDelete(e,-1)||skipIgnoredNodes(e,-1);if(46==n&&!t.shiftKey||mac&&68==n&&"c"==o)return stopNativeHorizontalDelete(e,1)||skipIgnoredNodes(e,1);if(13==n||27==n)return!0;if(37==n||mac&&66==n&&"c"==o){var r=37==n?"ltr"==findDirection(e,e.state.selection.from)?-1:1:-1;return selectHorizontally(e,r,o)||skipIgnoredNodes(e,r)}if(39==n||mac&&70==n&&"c"==o){var i=39==n?"ltr"==findDirection(e,e.state.selection.from)?1:-1:1;return selectHorizontally(e,i,o)||skipIgnoredNodes(e,i)}return 38==n||mac&&80==n&&"c"==o?selectVertically(e,-1,o)||skipIgnoredNodes(e,-1):40==n||mac&&78==n&&"c"==o?safariDownArrowBug(e)||selectVertically(e,1,o)||skipIgnoredNodes(e,1):o==(mac?"m":"c")&&(66==n||73==n||89==n||90==n)}function serializeForClipboard(e,t){e.someProp("transformCopied",(function(n){t=n(t,e)}));for(var n=[],o=t,r=o.content,i=o.openStart,s=o.openEnd;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var l=e.someProp("clipboardSerializer")||prosemirrorModel.DOMSerializer.fromSchema(e.state.schema),c=detachedDoc(),d=c.createElement("div");d.appendChild(l.serializeFragment(r,{document:c}));for(var u,f=d.firstChild,h=0;f&&1==f.nodeType&&(u=wrapMap[f.nodeName.toLowerCase()]);){for(var p=u.length-1;p>=0;p--){for(var m=c.createElement(u[p]);d.firstChild;)m.appendChild(d.firstChild);d.appendChild(m),h++}f=d.firstChild}return f&&1==f.nodeType&&f.setAttribute("data-pm-slice","".concat(i," ").concat(s).concat(h?" -".concat(h):""," ").concat(JSON.stringify(n))),{dom:d,text:e.someProp("clipboardTextSerializer",(function(n){return n(t,e)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function parseFromClipboard(e,t,n,o,r){var i,s,a=r.parent.type.spec.code;if(!n&&!t)return null;var l=t&&(o||a||!n);if(l){if(e.someProp("transformPastedText",(function(n){t=n(t,a||o,e)})),a)return t?new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):prosemirrorModel.Slice.empty;var c=e.someProp("clipboardTextParser",(function(n){return n(t,r,o,e)}));if(c)s=c;else{var d=r.marks(),u=e.state.schema,f=prosemirrorModel.DOMSerializer.fromSchema(u);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((function(e){var t=i.appendChild(document.createElement("p"));e&&t.appendChild(f.serializeNode(u.text(e,d)))}))}}else e.someProp("transformPastedHTML",(function(t){n=t(n,e)})),i=readHTML(n),webkit&&restoreReplacedSpaces(i);var h=i&&i.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var m=+p[3];m>0;m--){for(var v=i.firstChild;v&&1!=v.nodeType;)v=v.nextSibling;if(!v)break;i=v}if(!s){var g=e.someProp("clipboardParser")||e.someProp("domParser")||prosemirrorModel.DOMParser.fromSchema(e.state.schema);s=g.parseSlice(i,{preserveWhitespace:!(!l&&!p),context:r,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||inlineParents.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(p)s=addContext(closeSlice(s,+p[1],+p[2]),p[4]);else if((s=prosemirrorModel.Slice.maxOpen(normalizeSiblings(s.content,r),!0)).openStart||s.openEnd){for(var y=0,b=0,S=s.content.firstChild;y<s.openStart&&!S.type.spec.isolating;y++,S=S.firstChild);for(var k=s.content.lastChild;b<s.openEnd&&!k.type.spec.isolating;b++,k=k.lastChild);s=closeSlice(s,y,b)}return e.someProp("transformPasted",(function(t){s=t(s,e)})),s}var inlineParents=/^(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 normalizeSiblings(e,t){if(e.childCount<2)return e;for(var n,o=function(){var n,o=t.node(r).contentMatchAt(t.index(r)),i=[];if(e.forEach((function(e){if(i){var t,r=o.findWrapping(e.type);if(!r)return i=null;if(t=i.length&&n.length&&addToSibling(r,n,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=closeRight(i[i.length-1],n.length));var s=withWrappers(e,r);i.push(s),o=o.matchType(s.type),n=r}}})),i)return{v:prosemirrorModel.Fragment.from(i)}},r=t.depth;r>=0;r--)if(n=o())return n.v;return e}function withWrappers(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=t.length-1;o>=n;o--)e=t[o].create(null,prosemirrorModel.Fragment.from(e));return e}function addToSibling(e,t,n,o,r){if(r<e.length&&r<t.length&&e[r]==t[r]){var i=addToSibling(e,t,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==e.length-1?n.type:e[r+1]))return o.copy(o.content.append(prosemirrorModel.Fragment.from(withWrappers(n,e,r+1))))}}function closeRight(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,closeRight(e.lastChild,t-1)),o=e.contentMatchAt(e.childCount).fillBefore(prosemirrorModel.Fragment.empty,!0);return e.copy(n.append(o))}function closeRange(e,t,n,o,r,i){var s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),r<o-1&&(a=closeRange(a,t,n,o,r+1,i)),r>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=r).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(prosemirrorModel.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function closeSlice(e,t,n){return t<e.openStart&&(e=new prosemirrorModel.Slice(closeRange(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new prosemirrorModel.Slice(closeRange(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var wrapMap={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},_detachedDoc=null;function detachedDoc(){return _detachedDoc||(_detachedDoc=document.implementation.createHTMLDocument("title"))}function readHTML(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,o=detachedDoc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e);if((n=r&&wrapMap[r[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join("")),o.innerHTML=e,n)for(var i=0;i<n.length;i++)o=o.querySelector(n[i])||o;return o}function restoreReplacedSpaces(e){for(var t=e.querySelectorAll(chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var o=t[n];1==o.childNodes.length&&"\xa0"==o.textContent&&o.parentNode&&o.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),o)}}function addContext(e,t){if(!e.size)return e;var n,o=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(c){return e}for(var r=e.content,i=e.openStart,s=e.openEnd,a=n.length-2;a>=0;a-=2){var l=o.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;r=prosemirrorModel.Fragment.from(l.create(n[a+1],r)),i++,s++}return new prosemirrorModel.Slice(r,i,s)}var handlers={},editHandlers={},passiveHandlers={touchstart:!0,touchmove:!0},InputState=_createClass((function e(){_classCallCheck(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}));function initInput(e){var t=function(){var t=handlers[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!eventBelongsToView(e,n)||runCustomHandler(e,n)||!e.editable&&n.type in editHandlers||t(e,n)},passiveHandlers[n]?{passive:!0}:void 0)};for(var n in handlers)t();safari&&e.dom.addEventListener("input",(function(){return null})),ensureListeners(e)}function setSelectionOrigin(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function destroyInput(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function ensureListeners(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return runCustomHandler(e,t)})}))}function runCustomHandler(e,t){return e.someProp("handleDOMEvents",(function(n){var o=n[t.type];return!!o&&(o(e,t)||t.defaultPrevented)}))}function eventBelongsToView(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function _dispatchEvent(e,t){runCustomHandler(e,t)||!handlers[t.type]||!e.editable&&t.type in editHandlers||handlers[t.type](e,t)}function eventCoords(e){return{left:e.clientX,top:e.clientY}}function isNear(e,t){var n=t.x-e.clientX,o=t.y-e.clientY;return n*n+o*o<100}function runHandlerOnContext(e,t,n,o,r){if(-1==o)return!1;for(var i,s=e.state.doc.resolve(o),a=function(o){if(e.someProp(t,(function(t){return o>s.depth?t(e,n,s.nodeAfter,s.before(o),r,!0):t(e,n,s.node(o),s.before(o),r,!1)})))return{v:!0}},l=s.depth+1;l>0;l--)if(i=a(l))return i.v;return!1}function updateSelection(e,t,n){e.focused||e.focus();var o=e.state.tr.setSelection(t);"pointer"==n&&o.setMeta("pointer",!0),e.dispatch(o)}function selectClickedLeaf(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&prosemirrorState.NodeSelection.isSelectable(o))&&(updateSelection(e,new prosemirrorState.NodeSelection(n),"pointer"),!0)}function selectClickedNode(e,t){if(-1==t)return!1;var n,o,r=e.state.selection;r instanceof prosemirrorState.NodeSelection&&(n=r.node);for(var i=e.state.doc.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(prosemirrorState.NodeSelection.isSelectable(a)){o=n&&r.$from.depth>0&&s>=r.$from.depth&&i.before(r.$from.depth+1)==r.$from.pos?i.before(r.$from.depth):i.before(s);break}}return null!=o&&(updateSelection(e,prosemirrorState.NodeSelection.create(e.state.doc,o),"pointer"),!0)}function handleSingleClick(e,t,n,o,r){return runHandlerOnContext(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(function(n){return n(e,t,o)}))||(r?selectClickedNode(e,n):selectClickedLeaf(e,n))}function handleDoubleClick(e,t,n,o){return runHandlerOnContext(e,"handleDoubleClickOn",t,n,o)||e.someProp("handleDoubleClick",(function(n){return n(e,t,o)}))}function handleTripleClick(e,t,n,o){return runHandlerOnContext(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(function(n){return n(e,t,o)}))||defaultTripleClick(e,n,o)}function defaultTripleClick(e,t,n){if(0!=n.button)return!1;var o=e.state.doc;if(-1==t)return!!o.inlineContent&&(updateSelection(e,prosemirrorState.TextSelection.create(o,0,o.content.size),"pointer"),!0);for(var r=o.resolve(t),i=r.depth+1;i>0;i--){var s=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(s.inlineContent)updateSelection(e,prosemirrorState.TextSelection.create(o,a+1,a+1+s.content.size),"pointer");else{if(!prosemirrorState.NodeSelection.isSelectable(s))continue;updateSelection(e,prosemirrorState.NodeSelection.create(o,a),"pointer")}return!0}}function forceDOMFlush(e){return endComposition(e)}editHandlers.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!inOrNearComposition(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!android||!chrome||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!ios||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(function(t){return t(e,n)}))||captureKeyDown(e,n)?n.preventDefault():setSelectionOrigin(e,"key");else{var o=Date.now();e.input.lastIOSEnter=o,e.input.lastIOSEnterFallbackTimeout=setTimeout((function(){e.input.lastIOSEnter==o&&(e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(13,"Enter"))})),e.input.lastIOSEnter=0)}),200)}},editHandlers.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},editHandlers.keypress=function(e,t){var n=t;if(!(inOrNearComposition(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||mac&&n.metaKey))if(e.someProp("handleKeyPress",(function(t){return t(e,n)})))n.preventDefault();else{var o=e.state.selection;if(!(o instanceof prosemirrorState.TextSelection)||!o.$from.sameParent(o.$to)){var r=String.fromCharCode(n.charCode);/[\r\n]/.test(r)||e.someProp("handleTextInput",(function(t){return t(e,o.$from.pos,o.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),n.preventDefault()}}};var selectNodeModifier=mac?"metaKey":"ctrlKey";handlers.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var o=forceDOMFlush(e),r=Date.now(),i="singleClick";r-e.input.lastClick.time<500&&isNear(n,e.input.lastClick)&&!n[selectNodeModifier]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i};var s=e.posAtCoords(eventCoords(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new MouseDown(e,s,n,!!o)):("doubleClick"==i?handleDoubleClick:handleTripleClick)(e,s.pos,s.inside,n)?n.preventDefault():setSelectionOrigin(e,"pointer"))};var MouseDown=function(){function e(t,n,o,r){var i,s,a=this;if(_classCallCheck(this,e),this.view=t,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!o[selectNodeModifier],this.allowDefault=o.shiftKey,n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{var l=t.state.doc.resolve(n.pos);i=l.parent,s=l.depth?l.before():0}var c=r?null:o.target,d=c?t.docView.nearestDesc(c,!0):null;this.target=d?d.dom:null;var u=t.state.selection;(0==o.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||u instanceof prosemirrorState.NodeSelection&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!gecko||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((function(){a.view.input.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),setSelectionOrigin(t,"pointer")}return _createClass(e,[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((function(){return selectionToDOM(e.view)})),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(eventCoords(e))),this.updateAllowDefault(e),this.allowDefault||!t?setSelectionOrigin(this.view,"pointer"):handleSingleClick(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||safari&&this.mightDrag&&!this.mightDrag.node.isAtom||chrome&&!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)?(updateSelection(this.view,prosemirrorState.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):setSelectionOrigin(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),setSelectionOrigin(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}]),e}();function inOrNearComposition(e,t){return!!e.composing||!!(safari&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}handlers.touchstart=function(e){e.input.lastTouch=Date.now(),forceDOMFlush(e),setSelectionOrigin(e,"pointer")},handlers.touchmove=function(e){e.input.lastTouch=Date.now(),setSelectionOrigin(e,"pointer")},handlers.contextmenu=function(e){return forceDOMFlush(e)};var timeoutComposition=android?5e3:-1;function scheduleComposeEnd(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((function(){return endComposition(e)}),t))}function clearComposition(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=timestampFromCustomEvent());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function timestampFromCustomEvent(){var e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function endComposition(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(android&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),clearComposition(e),t||e.docView&&e.docView.dirty){var n=selectionFromDOM(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}}function captureCopy(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),r=document.createRange();r.selectNodeContents(t),e.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}editHandlers.compositionstart=editHandlers.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),endComposition(e,!0),e.markCursor=null;else if(endComposition(e),gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var o=e.domSelectionRange(),r=o.focusNode,i=o.focusOffset;r&&1==r.nodeType&&0!=i;){var s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(3==s.nodeType){e.domSelection().collapse(s,s.nodeValue.length);break}r=s,i=-1}e.input.composing=!0}scheduleComposeEnd(e,timeoutComposition)},editHandlers.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionPendingChanges&&Promise.resolve().then((function(){return e.domObserver.flush()})),e.input.compositionID++,scheduleComposeEnd(e,20))};var brokenClipboardAPI=ie&&ie_version<15||ios&&webkit_version<604;function sliceSingleNode(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}function capturePaste(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,o=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();var r=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((function(){e.focus(),o.parentNode&&o.parentNode.removeChild(o),n?doPaste(e,o.value,null,r,t):doPaste(e,o.textContent,o.innerHTML,r,t)}),50)}}function doPaste(e,t,n,o,r){var i=parseFromClipboard(e,t,n,o,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||prosemirrorModel.Slice.empty)})))return!0;if(!i)return!1;var s=sliceSingleNode(i),a=s?e.state.tr.replaceSelectionWith(s,o):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function getText(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}handlers.copy=editHandlers.cut=function(e,t){var n=t,o=e.state.selection,r="cut"==n.type;if(!o.empty){var i=brokenClipboardAPI?null:n.clipboardData,s=serializeForClipboard(e,o.content()),a=s.dom,l=s.text;i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):captureCopy(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},editHandlers.paste=function(e,t){var n=t;if(!e.composing||android){var o=brokenClipboardAPI?null:n.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;o&&doPaste(e,getText(o),o.getData("text/html"),r,n)?n.preventDefault():capturePaste(e,n)}};var Dragging=_createClass((function e(t,n,o){_classCallCheck(this,e),this.slice=t,this.move=n,this.node=o})),dragCopyModifier=mac?"altKey":"ctrlKey";for(var prop in handlers.dragstart=function(e,t){var n=t,o=e.input.mouseDown;if(o&&o.done(),n.dataTransfer){var r,i=e.state.selection,s=i.empty?null:e.posAtCoords(eventCoords(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof prosemirrorState.NodeSelection?i.to-1:i.to));else if(o&&o.mightDrag)r=prosemirrorState.NodeSelection.create(e.state.doc,o.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var a=e.docView.nearestDesc(n.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(r=prosemirrorState.NodeSelection.create(e.state.doc,a.posBefore))}var l=(r||e.state.selection).content(),c=serializeForClipboard(e,l),d=c.dom,u=c.text;n.dataTransfer.clearData(),n.dataTransfer.setData(brokenClipboardAPI?"Text":"text/html",d.innerHTML),n.dataTransfer.effectAllowed="copyMove",brokenClipboardAPI||n.dataTransfer.setData("text/plain",u),e.dragging=new Dragging(l,!n[dragCopyModifier],r)}},handlers.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},editHandlers.dragover=editHandlers.dragenter=function(e,t){return t.preventDefault()},editHandlers.drop=function(e,t){var n=t,o=e.dragging;if(e.dragging=null,n.dataTransfer){var r=e.posAtCoords(eventCoords(n));if(r){var i=e.state.doc.resolve(r.pos),s=o&&o.slice;s?e.someProp("transformPasted",(function(t){s=t(s,e)})):s=parseFromClipboard(e,getText(n.dataTransfer),brokenClipboardAPI?null:n.dataTransfer.getData("text/html"),!1,i);var a=!(!o||n[dragCopyModifier]);if(e.someProp("handleDrop",(function(t){return t(e,n,s||prosemirrorModel.Slice.empty,a)})))n.preventDefault();else if(s){n.preventDefault();var l=s?prosemirrorTransform.dropPoint(e.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);var c=e.state.tr;if(a){var d=o.node;d?d.replace(c):c.deleteSelection()}var u=c.mapping.map(l),f=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,h=c.doc;if(f?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),!c.doc.eq(h)){var p=c.doc.resolve(u);if(f&&prosemirrorState.NodeSelection.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new prosemirrorState.NodeSelection(p));else{var m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((function(e,t,n,o){return m=o})),c.setSelection(selectionBetween(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}}}}},handlers.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&selectionToDOM(e)}),20))},handlers.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},handlers.beforeinput=function(e,t){if(chrome&&android&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout((function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},editHandlers)handlers[prop]=editHandlers[prop];function compareObjs(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var o in t)if(!(o in e))return!1;return!0}var WidgetType=function(){function e(t,n){_classCallCheck(this,e),this.toDOM=t,this.spec=n||noSpec,this.side=this.spec.side||0}return _createClass(e,[{key:"map",value:function(e,t,n,o){var r=e.mapResult(t.from+o,this.side<0?-1:1),i=r.pos;return r.deleted?null:new Decoration(i-n,i-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&compareObjs(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}]),e}(),InlineType=function(){function e(t,n){_classCallCheck(this,e),this.attrs=t,this.spec=n||noSpec}return _createClass(e,[{key:"map",value:function(e,t,n,o){var r=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-n;return r>=i?null:new Decoration(r,i,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&compareObjs(this.attrs,t.attrs)&&compareObjs(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}]),e}(),NodeType=function(){function e(t,n){_classCallCheck(this,e),this.attrs=t,this.spec=n||noSpec}return _createClass(e,[{key:"map",value:function(e,t,n,o){var r=e.mapResult(t.from+o,1);if(r.deleted)return null;var i=e.mapResult(t.to+o,-1);return i.deleted||i.pos<=r.pos?null:new Decoration(r.pos-n,i.pos-n,this)}},{key:"valid",value:function(e,t){var n,o=e.content.findIndex(t.from),r=o.index,i=o.offset;return i==t.from&&!(n=e.child(r)).isText&&i+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&compareObjs(this.attrs,t.attrs)&&compareObjs(this.spec,t.spec)}},{key:"destroy",value:function(){}}]),e}(),Decoration=function(){function e(t,n,o){_classCallCheck(this,e),this.from=t,this.to=n,this.type=o}return _createClass(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof InlineType}},{key:"widget",get:function(){return this.type instanceof WidgetType}}],[{key:"widget",value:function(t,n,o){return new e(t,t,new WidgetType(n,o))}},{key:"inline",value:function(t,n,o,r){return new e(t,n,new InlineType(o,r))}},{key:"node",value:function(t,n,o,r){return new e(t,n,new NodeType(o,r))}}]),e}(),none=[],noSpec={},DecorationSet=function(){function e(t,n){_classCallCheck(this,e),this.local=t.length?t:none,this.children=n.length?n:none}return _createClass(e,[{key:"find",value:function(e,t,n){var o=[];return this.findInner(null==e?0:e,null==t?1e9:t,o,0,n),o}},{key:"findInner",value:function(e,t,n,o,r){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=t&&s.to>=e&&(!r||r(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){var l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,n,o+l,r)}}},{key:"map",value:function(e,t,n){return this==empty||0==e.maps.length?this:this.mapInner(e,t,0,0,n||noSpec)}},{key:"mapInner",value:function(t,n,o,r,i){for(var s,a=0;a<this.local.length;a++){var l=this.local[a].map(t,o,r);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?mapChildren(this.children,s||[],t,n,o,r,i):s?new e(s.sort(byPos),none):empty}},{key:"add",value:function(t,n){return n.length?this==empty?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,o){var r,i=this,s=0;t.forEach((function(e,t){var a,l=t+o;if(a=takeSpansForNode(n,e,l)){for(r||(r=i.children.slice());s<r.length&&r[s]<t;)s+=3;r[s]==t?r[s+2]=r[s+2].addInner(e,a,l+1):r.splice(s,0,t,t+e.nodeSize,buildTree(a,e,l+1,noSpec)),s+=3}}));for(var a=moveSpans(s?withoutNulls(n):n,-o),l=0;l<a.length;l++)a[l].type.valid(t,a[l])||a.splice(l--,1);return new e(a.length?this.local.concat(a).sort(byPos):this.local,r||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==empty?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var o=this.children,r=this.local,i=0;i<o.length;i+=3){for(var s,a=void 0,l=o[i]+n,c=o[i+1]+n,d=0;d<t.length;d++)(s=t[d])&&s.from>l&&s.to<c&&(t[d]=null,(a||(a=[])).push(s));if(a){o==this.children&&(o=this.children.slice());var u=o[i+2].removeInner(a,l+1);u!=empty?o[i+2]=u:(o.splice(i,3),i-=3)}}if(r.length)for(var f,h=0;h<t.length;h++)if(f=t[h])for(var p=0;p<r.length;p++)r[p].eq(f,n)&&(r==this.local&&(r=this.local.slice()),r.splice(p--,1));return o==this.children&&r==this.local?this:r.length||o.length?new e(r,o):empty}},{key:"forChild",value:function(t,n){if(this==empty)return this;if(n.isLeaf)return e.empty;for(var o,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=t){this.children[i]==t&&(o=this.children[i+2]);break}for(var s=t+1,a=s+n.content.size,l=0;l<this.local.length;l++){var c=this.local[l];if(c.from<a&&c.to>s&&c.type instanceof InlineType){var d=Math.max(s,c.from)-s,u=Math.min(a,c.to)-s;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){var f=new e(r.sort(byPos),none);return o?new DecorationGroup([f,o]):f}return o||empty}},{key:"eq",value:function(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(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var o=0;o<this.children.length;o+=3)if(this.children[o]!=t.children[o]||this.children[o+1]!=t.children[o+1]||!this.children[o+2].eq(t.children[o+2]))return!1;return!0}},{key:"locals",value:function(e){return removeOverlap(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==empty)return none;if(e.inlineContent||!this.local.some(InlineType.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof InlineType||t.push(this.local[n]);return t}}],[{key:"create",value:function(e,t){return t.length?buildTree(t,e,0,noSpec):empty}}]),e}();DecorationSet.empty=new DecorationSet([],[]),DecorationSet.removeOverlap=removeOverlap;var empty=DecorationSet.empty,DecorationGroup=function(){function e(t){_classCallCheck(this,e),this.members=t}return _createClass(e,[{key:"map",value:function(t,n){var o=this.members.map((function(e){return e.map(t,n,noSpec)}));return e.from(o)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return DecorationSet.empty;for(var o=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(t,n);i!=empty&&(i instanceof e?o=o.concat(i.members):o.push(i))}return e.from(o)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,o=0;o<this.members.length;o++){var r=this.members[o].localsInner(e);if(r.length)if(t){n&&(t=t.slice(),n=!1);for(var i=0;i<r.length;i++)t.push(r[i])}else t=r}return t?removeOverlap(n?t:t.sort(byPos)):none}}],[{key:"from",value:function(t){switch(t.length){case 0:return empty;case 1:return t[0];default:return new e(t.every((function(e){return e instanceof DecorationSet}))?t:t.reduce((function(e,t){return e.concat(t instanceof DecorationSet?t:t.members)}),[]))}}}]),e}();function mapChildren(e,t,n,o,r,i,s){for(var a=e.slice(),l=function(e){var t=0;n.maps[c].forEach((function(n,o,r,i){for(var s=i-r-(o-n),l=0;l<a.length;l+=3){var c=a[l+1];if(!(c<0||n>c+e-t)){var d=a[l]+e-t;o>=d?a[l+1]=n<=d?-2:-1:n>=e&&s&&(a[l]+=s,a[l+1]+=s)}}t+=s})),e=n.maps[c].map(e,-1),d=e},c=0,d=i;c<n.maps.length;c++)l(d);for(var u=!1,f=0;f<a.length;f+=3)if(a[f+1]<0){if(-2==a[f+1]){u=!0,a[f+1]=-1;continue}var h=n.map(e[f]+i),p=h-r;if(p<0||p>=o.content.size){u=!0;continue}var m=n.map(e[f+1]+i,-1)-r,v=o.content.findIndex(p),g=v.index,y=v.offset,b=o.maybeChild(g);if(b&&y==p&&y+b.nodeSize==m){var S=a[f+2].mapInner(n,b,h+1,e[f]+i+1,s);S!=empty?(a[f]=p,a[f+1]=m,a[f+2]=S):(a[f+1]=-2,u=!0)}else u=!0}if(u){var k=buildTree(mapAndGatherRemainingDecorations(a,e,t,n,r,i,s),o,0,s);t=k.local;for(var D=0;D<a.length;D+=3)a[D+1]<0&&(a.splice(D,3),D-=3);for(var C=0,w=0;C<k.children.length;C+=3){for(var O=k.children[C];w<a.length&&a[w]<O;)w+=3;a.splice(w,0,k.children[C],k.children[C+1],k.children[C+2])}}return new DecorationSet(t.sort(byPos),a)}function moveSpans(e,t){if(!t||!e.length)return e;for(var n=[],o=0;o<e.length;o++){var r=e[o];n.push(new Decoration(r.from+t,r.to+t,r.type))}return n}function mapAndGatherRemainingDecorations(e,t,n,o,r,i,s){function a(e,t){for(var i=0;i<e.local.length;i++){var l=e.local[i].map(o,r,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(var c=0;c<e.children.length;c+=3)a(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}function takeSpansForNode(e,t,n){if(t.isLeaf)return null;for(var o,r=n+t.nodeSize,i=null,s=0;s<e.length;s++)(o=e[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[s]=null);return i}function withoutNulls(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function buildTree(e,t,n,o){var r=[],i=!1;t.forEach((function(t,s){var a=takeSpansForNode(e,t,s+n);if(a){i=!0;var l=buildTree(a,t,n+s+1,o);l!=empty&&r.push(s,s+t.nodeSize,l)}}));for(var s=moveSpans(i?withoutNulls(e):e,-n).sort(byPos),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(o.onRemove&&o.onRemove(s[a].spec),s.splice(a--,1));return s.length||r.length?new DecorationSet(s,r):empty}function byPos(e,t){return e.from-t.from||e.to-t.to}function removeOverlap(e){for(var t=e,n=0;n<t.length-1;n++){var o=t[n];if(o.from!=o.to)for(var r=n+1;r<t.length;r++){var i=t[r];if(i.from!=o.from){i.from<o.to&&(t==e&&(t=e.slice()),t[n]=o.copy(o.from,i.from),insertAhead(t,r,o.copy(i.from,o.to)));break}i.to!=o.to&&(t==e&&(t=e.slice()),t[r]=i.copy(i.from,o.to),insertAhead(t,r+1,i.copy(o.to,i.to)))}}return t}function insertAhead(e,t,n){for(;t<e.length&&byPos(n,e[t])>0;)t++;e.splice(t,0,n)}function viewDecorations(e){var t=[];return e.someProp("decorations",(function(n){var o=n(e.state);o&&o!=empty&&t.push(o)})),e.cursorWrapper&&t.push(DecorationSet.create(e.state.doc,[e.cursorWrapper.deco])),DecorationGroup.from(t)}var observeOptions={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},useCharData=ie&&ie_version<=11,SelectionState=function(){function e(){_classCallCheck(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return _createClass(e,[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}]),e}(),DOMObserver=function(){function e(t,n){var o=this;_classCallCheck(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SelectionState,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)o.queue.push(e[t]);ie&&ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?o.flushSoon():o.flush()})),useCharData&&(this.onCharData=function(e){o.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),o.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return _createClass(e,[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,observeOptions)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)}},{key:"onSelectionChange",value:function(){if(hasFocusAndSelection(this.view)){if(this.suppressingSelectionUpdates)return selectionToDOM(this.view);if(ie&&ie_version<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&isEquivalentPosition(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,o=e.focusNode;o;o=parentNode(o))n.add(o);for(var r=e.anchorNode;r;r=parentNode(r))if(n.has(r)){t=r;break}var i=t&&this.view.docView.nearestDesc(t);return i&&i.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=_createForOfIteratorHelper(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(o){t.e(o)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&hasFocusAndSelection(e)&&!this.ignoreSelectionChange(n),r=-1,i=-1,s=!1,a=[];if(e.editable)for(var l=0;l<t.length;l++){var c=this.registerMutation(t[l],a);c&&(r=r<0?c.from:Math.min(c.from,r),i=i<0?c.to:Math.max(c.to,i),c.typeOver&&(s=!0))}if(gecko&&a.length>1){var d=a.filter((function(e){return"BR"==e.nodeName}));if(2==d.length){var u=d[0],f=d[1];u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}}var h=null;r<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&selectionCollapsed(n)&&(h=selectionFromDOM(e))&&h.eq(prosemirrorState.Selection.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,selectionToDOM(e),this.currentSelection.set(n),e.scrollToSelection()):(r>-1||o)&&(r>-1&&(e.docView.markDirty(r,i),checkCSS(e)),this.handleDOMChange(r,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||selectionToDOM(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var o=0;o<e.addedNodes.length;o++)t.push(e.addedNodes[o]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var r=e.previousSibling,i=e.nextSibling;if(ie&&ie_version<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var a=e.addedNodes[s],l=a.previousSibling,c=a.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(r=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(i=c)}var d=r&&r.parentNode==e.target?domIndex(r)+1:0,u=n.localPosFromDOM(e.target,d,-1),f=i&&i.parentNode==e.target?domIndex(i):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,f,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}]),e}(),cssChecked=new WeakMap,cssCheckWarned=!1;function checkCSS(e){if(!cssChecked.has(e)&&(cssChecked.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=gecko,cssCheckWarned)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."),cssCheckWarned=!0}}function safariShadowSelectionRange(e){var t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);var o=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.domAtPos(e.state.selection.anchor);if(isEquivalentPosition(a.node,a.offset,i,s)){var l=[i,s,o,r];o=l[0],r=l[1],i=l[2],s=l[3]}return{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}}function parseBetween(e,t,n){var o,r=e.docView.parseRange(t,n),i=r.node,s=r.fromOffset,a=r.toOffset,l=r.from,c=r.to,d=e.domSelectionRange(),u=d.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(o=[{node:u,offset:d.anchorOffset}],selectionCollapsed(d)||o.push({node:d.focusNode,offset:d.focusOffset})),chrome&&8===e.input.lastKeyCode)for(var f=a;f>s;f--){var h=i.childNodes[f-1],p=h.pmViewDesc;if("BR"==h.nodeName&&!p){a=f;break}if(!p||p.size)break}var m=e.state.doc,v=e.someProp("domParser")||prosemirrorModel.DOMParser.fromSchema(e.state.schema),g=m.resolve(l),y=null,b=v.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:o,ruleFromNode:ruleFromNode,context:g});if(o&&null!=o[0].pos){var S=o[0].pos,k=o[1]&&o[1].pos;null==k&&(k=S),y={anchor:S+l,head:k+l}}return{doc:b,sel:y,from:l,to:c}}function ruleFromNode(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var isInline=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function readDOMChange(e,t,n,o,r){var i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var s=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,a=selectionFromDOM(e,s);if(a&&!e.state.selection.eq(a)){if(chrome&&android&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(13,"Enter"))})))return;var l=e.state.tr.setSelection(a);"pointer"==s?l.setMeta("pointer",!0):"key"==s&&l.scrollIntoView(),i&&l.setMeta("composition",i),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u,f,h=e.state.selection,p=parseBetween(e,t,n),m=e.state.doc,v=m.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(u=e.state.selection.to,f="end"):(u=e.state.selection.from,f="start"),e.input.lastKeyCode=null;var g=findDiff(v.content,p.doc.content,p.from,u,f);if((ios&&e.input.lastIOSEnter>Date.now()-225||android)&&r.some((function(e){return 1==e.nodeType&&!isInline.test(e.nodeName)}))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(13,"Enter"))})))e.input.lastIOSEnter=0;else{if(!g){if(!(o&&h instanceof prosemirrorState.TextSelection&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var y=resolveSelection(e,e.state.doc,p.sel);if(y&&!y.eq(e.state.selection)){var b=e.state.tr.setSelection(y);i&&b.setMeta("composition",i),e.dispatch(b)}}return}g={start:h.from,endA:h.to,endB:h.to}}if(chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from&&p.sel.head==p.sel.anchor){var S=g.endB-g.start;p.sel={anchor:p.sel.anchor+S,head:p.sel.anchor+S}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof prosemirrorState.TextSelection&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),ie&&ie_version<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&" \xa0"==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);var k,D=p.doc.resolveNoCache(g.start-p.from),C=p.doc.resolveNoCache(g.endB-p.from),w=m.resolve(g.start),O=D.sameParent(C)&&D.parent.inlineContent&&w.end()>=g.endA;if((ios&&e.input.lastIOSEnter>Date.now()-225&&(!O||r.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!O&&D.pos<p.doc.content.size&&!D.sameParent(C)&&(k=prosemirrorState.Selection.findFrom(p.doc.resolve(D.pos+1),1,!0))&&k.head==C.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(13,"Enter"))})))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>g.start&&looksLikeJoin(m,g.start,g.endA,D,C)&&e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(8,"Backspace"))})))android&&chrome&&e.domObserver.suppressSelectionUpdates();else{chrome&&android&&g.endB==g.start&&(e.input.lastAndroidDelete=Date.now()),android&&!O&&D.start()!=C.start()&&0==C.parentOffset&&D.depth==C.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,C=p.doc.resolveNoCache(g.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,keyEvent(13,"Enter"))}))}),20));var N,T,M,x=g.start,_=g.endA;if(O)if(D.pos==C.pos)ie&&ie_version<=11&&0==D.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return selectionToDOM(e)}),20)),N=e.state.tr.delete(x,_),T=m.resolve(g.start).marksAcross(m.resolve(g.endA));else if(g.endA==g.endB&&(M=isMarkChange(D.parent.content.cut(D.parentOffset,C.parentOffset),w.parent.content.cut(w.parentOffset,g.endA-w.start()))))N=e.state.tr,"add"==M.type?N.addMark(x,_,M.mark):N.removeMark(x,_,M.mark);else if(D.parent.child(D.index()).isText&&D.index()==C.index()-(C.textOffset?0:1)){var P=D.parent.textBetween(D.parentOffset,C.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,x,_,P)})))return;N=e.state.tr.insertText(P,x,_)}if(N||(N=e.state.tr.replace(x,_,p.doc.slice(g.start-p.from,g.endB-p.from))),p.sel){var E=resolveSelection(e,N.doc,p.sel);E&&!(chrome&&android&&e.composing&&E.empty&&(g.start!=g.endB||e.input.lastAndroidDelete<Date.now()-100)&&(E.head==x||E.head==N.mapping.map(_)-1)||ie&&E.empty&&E.head==x)&&N.setSelection(E)}T&&N.ensureMarks(T),i&&N.setMeta("composition",i),e.dispatch(N.scrollIntoView())}}}}function resolveSelection(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:selectionBetween(e,t.resolve(n.anchor),t.resolve(n.head))}function isMarkChange(e,t){for(var n,o,r,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s,c=0;c<s.length;c++)a=s[c].removeFromSet(a);for(var d=0;d<i.length;d++)l=i[d].removeFromSet(l);if(1==a.length&&0==l.length)o=a[0],n="add",r=function(e){return e.mark(o.addToSet(e.marks))};else{if(0!=a.length||1!=l.length)return null;o=l[0],n="remove",r=function(e){return e.mark(o.removeFromSet(e.marks))}}for(var u=[],f=0;f<t.childCount;f++)u.push(r(t.child(f)));if(prosemirrorModel.Fragment.from(u).eq(e))return{mark:o,type:n}}function looksLikeJoin(e,t,n,o,r){if(!o.parent.isTextblock||n-t<=r.pos-o.pos||skipClosingAndOpening(o,!0,!1)<r.pos)return!1;var i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=e.resolve(skipClosingAndOpening(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||skipClosingAndOpening(s,!0,!1)<n)&&o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function skipClosingAndOpening(e,t,n){for(var o=e.depth,r=t?e.end():e.pos;o>0&&(t||e.indexAfter(o)==e.node(o).childCount);)o--,r++,t=!1;if(n)for(var i=e.node(o).maybeChild(e.indexAfter(o));i&&!i.isLeaf;)i=i.firstChild,r++;return r}function findDiff(e,t,n,o,r){var i=e.findDiffStart(t,n);if(null==i)return null;var s=e.findDiffEnd(t,n+e.size,n+t.size),a=s.a,l=s.b;"end"==r&&(o-=a+Math.max(0,i-Math.min(a,l))-i);if(a<i&&e.size<t.size){var c=o<=i&&o>=a?i-o:0;(i-=c)&&i<t.size&&isSurrogatePair(t.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-a),a=i}else if(l<i){var d=o<=i&&o>=l?i-o:0;(i-=d)&&i<e.size&&isSurrogatePair(e.textBetween(i-1,i+1))&&(i+=d?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function isSurrogatePair(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var __serializeForClipboard=serializeForClipboard,__parseFromClipboard=parseFromClipboard,__endComposition=endComposition,EditorView=function(){function e(t,n){var o=this;_classCallCheck(this,e),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 InputState,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(checkStateComponent),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=getEditable(this),updateCursorWrapper(this),this.nodeViews=buildNodeViews(this),this.docView=docViewDesc(this.state.doc,computeDocDeco(this),viewDecorations(this),this.dom,this),this.domObserver=new DOMObserver(this,(function(e,t,n,r){return readDOMChange(o,e,t,n,r)})),this.domObserver.start(),initInput(this),this.updatePluginViews()}return _createClass(e,[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ensureListeners(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(checkStateComponent),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var o in t.state=this.state,e)t[o]=e[o];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,o=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(clearComposition(this),i=!0),this.state=e;var s=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var a=buildNodeViews(this);changedNodeViews(a,this.nodeViews)&&(this.nodeViews=a,r=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&ensureListeners(this),this.editable=getEditable(this),updateCursorWrapper(this);var l=viewDecorations(this),c=computeDocDeco(this),d=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",u=r||!this.docView.matchesNode(e.doc,c,l);!u&&e.selection.eq(o.selection)||(i=!0);var f="preserve"==d&&i&&null==this.dom.style.overflowAnchor&&storeScrollPos(this);if(i){this.domObserver.stop();var h=u&&(ie||chrome)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&selectionContextChanged(o.selection,e.selection);if(u){var p=chrome?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,c,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=docViewDesc(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&anchorInRightPlace(this))?selectionToDOM(this,h):(syncNodeSelection(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():f&&resetScrollPos(f)}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(function(t){return t(e)})));else if(this.state.selection instanceof prosemirrorState.NodeSelection){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&scrollRectIntoView(this,n.getBoundingClientRect(),t)}else scrollRectIntoView(this,this.coordsAtPos(this.state.selection.head,1),t)}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var o=0;o<this.directPlugins.length;o++){var r=this.directPlugins[o];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var s=this.state.plugins[i];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,o=-1;if(this.state.doc.nodeAt(n.from)==n.node)o=n.from;else{var r=n.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==n.node&&(o=r)}this.dragging=new Dragging(e.slice,e.move,o<0?void 0:prosemirrorState.NodeSelection.create(this.state.doc,o))}},{key:"someProp",value:function(e,t){var n,o=this._props&&this._props[e];if(null!=o&&(n=t?t(o):o))return n;for(var r=0;r<this.directPlugins.length;r++){var i=this.directPlugins[r].props[e];if(null!=i&&(n=t?t(i):i))return n}var s=this.state.plugins;if(s)for(var a=0;a<s.length;a++){var l=s[a].props[e];if(null!=l&&(n=t?t(l):l))return n}}},{key:"hasFocus",value:function(){if(ie){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&focusPreventScroll(this.dom),selectionToDOM(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,o=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},r=this.dom.parentNode;r;r=r.parentNode)if(n=o(r))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return _posAtCoords(this,e)}},{key:"coordsAtPos",value:function(e){return _coordsAtPos(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=this.docView.posFromDOM(e,t,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o}},{key:"endOfTextblock",value:function(e,t){return _endOfTextblock(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return doPaste(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return doPaste(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"destroy",value:function(){this.docView&&(destroyInput(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],viewDecorations(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return _dispatchEvent(this,e)}},{key:"dispatch",value:function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}},{key:"domSelectionRange",value:function(){return safari&&11===this.root.nodeType&&deepActiveElement(this.dom.ownerDocument)==this.dom?safariShadowSelectionRange(this):this.domSelection()}},{key:"domSelection",value:function(){return this.root.getSelection()}}]),e}();function computeDocDeco(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var o in n)"class"==o?t.class+=" "+n[o]:"style"==o?t.style=(t.style?t.style+";":"")+n[o]:t[o]||"contenteditable"==o||"nodeName"==o||(t[o]=String(n[o]))})),t.translate||(t.translate="no"),[Decoration.node(0,e.state.doc.content.size,t)]}function updateCursorWrapper(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Decoration.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function getEditable(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function selectionContextChanged(e,t){var n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function buildNodeViews(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function changedNodeViews(e,t){var n=0,o=0;for(var r in e){if(e[r]!=t[r])return!0;n++}for(var i in t)o++;return n!=o}function checkStateComponent(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}exports.Decoration=Decoration,exports.DecorationSet=DecorationSet,exports.EditorView=EditorView,exports.__endComposition=__endComposition,exports.__parseFromClipboard=__parseFromClipboard,exports.__serializeForClipboard=__serializeForClipboard;
@@ -0,0 +1 @@
1
+ "use strict";function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var prosemirrorState=require("prosemirror-state"),prosemirrorTransform=require("prosemirror-transform"),InputRule=_createClass((function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,e),this.match=t,this.match=t,this.handler="string"==typeof n?stringHandler(n):n,this.undoable=!1!==r.undoable}));function stringHandler(e){return function(t,n,r,o){var u=e;if(n[1]){var l=n[0].lastIndexOf(n[1]);u+=n[0].slice(l+n[1].length);var s=(r+=l)-o;s>0&&(u=n[0].slice(l-s,l)+u,r=o)}return t.tr.insertText(u,r,o)}}var MAX_MATCH=500;function inputRules(e){var t=e.rules,n=new prosemirrorState.Plugin({state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,r,o,u){return run(e,r,o,u,t,n)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var r=e.state.selection.$cursor;r&&run(e,r.pos,r.pos,"",t,n)}))}}},isInputRules:!0});return n}function run(e,t,n,r,o,u){if(e.composing)return!1;var l=e.state,s=l.doc.resolve(t);if(s.parent.type.spec.code)return!1;for(var i=s.parent.textBetween(Math.max(0,s.parentOffset-MAX_MATCH),s.parentOffset,null,"\ufffc")+r,p=0;p<o.length;p++){var a=o[p],c=a.match.exec(i),f=c&&a.handler(l,c,t-(c[0].length-r.length),n);if(f)return a.undoable&&f.setMeta(u,{transform:f,from:t,to:n,text:r}),e.dispatch(f),!0}return!1}var undoInputRule=function(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var o=n[r],u=void 0;if(o.spec.isInputRules&&(u=o.getState(e))){if(t){for(var l=e.tr,s=u.transform,i=s.steps.length-1;i>=0;i--)l.step(s.steps[i].invert(s.docs[i]));if(u.text){var p=l.doc.resolve(u.from).marks();l.replaceWith(u.from,u.to,e.schema.text(u.text,p))}else l.delete(u.from,u.to);t(l)}return!0}}return!1},emDash=new InputRule(/--$/,"\u2014"),ellipsis=new InputRule(/\.\.\.$/,"\u2026"),openDoubleQuote=new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201c"),closeDoubleQuote=new InputRule(/"$/,"\u201d"),openSingleQuote=new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018"),closeSingleQuote=new InputRule(/'$/,"\u2019"),smartQuotes=[openDoubleQuote,closeDoubleQuote,openSingleQuote,closeSingleQuote];function wrappingInputRule(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return new InputRule(e,(function(e,o,u,l){var s=n instanceof Function?n(o):n,i=e.tr.delete(u,l),p=i.doc.resolve(u).blockRange(),a=p&&prosemirrorTransform.findWrapping(p,t,s);if(!a)return null;i.wrap(p,a);var c=i.doc.resolve(u-1).nodeBefore;return c&&c.type==t&&prosemirrorTransform.canJoin(i.doc,u-1)&&(!r||r(o,c))&&i.join(u-1),i}))}function textblockTypeInputRule(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new InputRule(e,(function(e,r,o,u){var l=e.doc.resolve(o),s=n instanceof Function?n(r):n;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),t)?e.tr.delete(o,u).setBlockType(o,o,t,s):null}))}exports.InputRule=InputRule,exports.closeDoubleQuote=closeDoubleQuote,exports.closeSingleQuote=closeSingleQuote,exports.ellipsis=ellipsis,exports.emDash=emDash,exports.inputRules=inputRules,exports.openDoubleQuote=openDoubleQuote,exports.openSingleQuote=openSingleQuote,exports.smartQuotes=smartQuotes,exports.textblockTypeInputRule=textblockTypeInputRule,exports.undoInputRule=undoInputRule,exports.wrappingInputRule=wrappingInputRule;
@@ -0,0 +1 @@
1
+ "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"===typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],h=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;h=!1}else for(;!(h=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);h=!0);}catch(e){u=!0,i=e}finally{try{if(!h&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _get(){return _get="undefined"!==typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=_superPropBase(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_get.apply(this,arguments)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var n,r=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _wrapNativeSuper(e){var t="function"===typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,e)},_wrapNativeSuper(e)}function _construct(e,t,n){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_setPrototypeOf(i,n.prototype),i},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var OrderedMap=require("orderedmap");function _findDiffStart(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var i=e.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(var a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){var s=_findDiffStart(i.content,o.content,n+1);if(null!=s)return s}n+=i.nodeSize}else n+=i.nodeSize}}function _findDiffEnd(e,t,n,r){for(var i=e.childCount,o=t.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};var a=e.child(--i),s=t.child(--o),h=a.nodeSize;if(a!=s){if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){for(var u=0,c=Math.min(a.text.length,s.text.length);u<c&&a.text[a.text.length-u-1]==s.text[s.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){var l=_findDiffEnd(a.content,s.content,n-1,r-1);if(l)return l}n-=h,r-=h}else n-=h,r-=h}}var Fragment=function(){function e(t,n){if(_classCallCheck(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return _createClass(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0,o=0,a=0;a<t;o++){var s=this.content[o],h=a+s.nodeSize;if(h>e&&!1!==n(s,r+a,i||null,o)&&s.content.size){var u=a+1;s.nodesBetween(Math.max(0,e-u),Math.min(s.content.size,t-u),n,r+u)}a=h}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var i="",o=!0;return this.nodesBetween(e,t,(function(a,s){var h=a.isText?a.text.slice(Math.max(e,s)-s,t-s):a.isLeaf?r?"function"===typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&h||a.isTextblock)&&n&&(o?o=!1:i+=n),i+=h}),0),i}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new e(i,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],i=0;if(n>t)for(var o=0,a=0;a<n;o++){var s=this.content[o],h=a+s.nodeSize;h>t&&((a<t||h>n)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),i+=s.nodeSize),a=h}return new e(r,i)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,o)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return _findDiffStart(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return _findDiffEnd(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0==e)return retIndex(0,e);if(e==this.size)return retIndex(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var n=0,r=0;;n++){var i=r+this.child(n).nodeSize;if(i>=e)return i==e||t>0?retIndex(n+1,i):retIndex(n,r);r=i}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,i=0;i<t.length;i++){var o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}]),e}();Fragment.empty=new Fragment([],0);var found={index:0,offset:0};function retIndex(e,t){return found.index=e,found.offset=t,found}function compareDeep(e,t){if(e===t)return!0;if(!e||"object"!=_typeof(e)||!t||"object"!=_typeof(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!compareDeep(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!compareDeep(e[i],t[i]))return!1;for(var o in t)if(!(o in e))return!1}return!0}var Mark=function(){function e(t,n){_classCallCheck(this,e),this.type=t,this.attrs=n}return _createClass(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&compareDeep(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));return n.create(t.attrs)}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort((function(e,t){return e.type.rank-t.type.rank})),n}}]),e}();Mark.none=[];var ReplaceError=function(e){_inherits(n,_wrapNativeSuper(Error));var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n)}(),Slice=function(){function e(t,n,r){_classCallCheck(this,e),this.content=t,this.openStart=n,this.openEnd=r}return _createClass(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=insertInto(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(removeRange(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new e(Fragment.fromJSON(t,n.content),r,i)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,i=0,o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(var a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,r,i)}}]),e}();function removeRange(e,t,n){var r=e.findIndex(t),i=r.index,o=r.offset,a=e.maybeChild(i),s=e.findIndex(n),h=s.index,u=s.offset;if(o==t||a.isText){if(u!=n&&!e.child(h).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(i!=h)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(removeRange(a.content,t-o-1,n-o-1)))}function insertInto(e,t,n,r){var i=e.findIndex(t),o=i.index,a=i.offset,s=e.maybeChild(o);if(a==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));var h=insertInto(s.content,t-a-1,n);return h&&e.replaceChild(o,s.copy(h))}function _replace(e,t,n){if(n.openStart>e.depth)throw new ReplaceError("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter(e,t,n,0)}function replaceOuter(e,t,n,r){var i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){var a=replaceOuter(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var s=prepareSliceForReplace(n,e);return close(o,replaceThreeWay(e,s.start,s.end,t,r))}var h=e.parent,u=h.content;return close(h,u.cut(0,e.parentOffset).append(n.content).append(u.cut(t.parentOffset)))}return close(o,replaceTwoWay(e,t,r))}function checkJoin(e,t){if(!t.type.compatibleContent(e.type))throw new ReplaceError("Cannot join "+t.type.name+" onto "+e.type.name)}function joinable(e,t,n){var r=e.node(n);return checkJoin(r,t.node(n)),r}function addNode(e,t){var 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 addRange(e,t,n,r){var i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(addNode(e.nodeAfter,r),o++));for(var s=o;s<a;s++)addNode(i.child(s),r);t&&t.depth==n&&t.textOffset&&addNode(t.nodeBefore,r)}function close(e,t){return e.type.checkContent(t),e.copy(t)}function replaceThreeWay(e,t,n,r,i){var o=e.depth>i&&joinable(e,t,i+1),a=r.depth>i&&joinable(n,r,i+1),s=[];return addRange(null,e,i,s),o&&a&&t.index(i)==n.index(i)?(checkJoin(o,a),addNode(close(o,replaceThreeWay(e,t,n,r,i+1)),s)):(o&&addNode(close(o,replaceTwoWay(e,t,i+1)),s),addRange(t,n,i,s),a&&addNode(close(a,replaceTwoWay(n,r,i+1)),s)),addRange(r,null,i,s),new Fragment(s)}function replaceTwoWay(e,t,n){var r=[];(addRange(null,e,n,r),e.depth>n)&&addNode(close(joinable(e,t,n+1),replaceTwoWay(e,t,n+1)),r);return addRange(t,null,n,r),new Fragment(r)}function prepareSliceForReplace(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(Fragment.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}Slice.empty=new Slice(Fragment.empty,0,0);var ResolvedPos=function(){function e(t,n,r){_classCallCheck(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return _createClass(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return Mark.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var o=n.marks,a=0;a<o.length;a++)!1!==o[a].type.spec.inclusive||r&&o[a].isInSet(r.marks)||(o=o[a--].removeFromSet(o));return o}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var 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 NodeRange(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],i=0,o=n,a=t;;){var s=a.content.findIndex(o),h=s.index,u=s.offset,c=o-u;if(r.push(a,h,i+u),!c)break;if((a=a.child(h)).isText)break;o=c-1,i+=u+1}return new e(n,r,o)}},{key:"resolveCached",value:function(t,n){for(var r=0;r<resolveCache.length;r++){var i=resolveCache[r];if(i.pos==n&&i.doc==t)return i}var o=resolveCache[resolveCachePos]=e.resolve(t,n);return resolveCachePos=(resolveCachePos+1)%resolveCacheSize,o}}]),e}(),resolveCache=[],resolveCachePos=0,resolveCacheSize=12,NodeRange=function(){function e(t,n,r){_classCallCheck(this,e),this.$from=t,this.$to=n,this.depth=r}return _createClass(e,[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}]),e}(),emptyAttrs=Object.create(null),Node=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Mark.none;_classCallCheck(this,e),this.type=t,this.attrs=n,this.marks=i,this.content=r||Fragment.empty}return _createClass(e,[{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&compareDeep(this.attrs,t||e.defaultAttrs||emptyAttrs)&&Mark.sameSet(this.marks,n||Mark.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return Slice.empty;var r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),s=r.node(o).content.cut(r.pos-a,i.pos-a);return new Slice(s,r.depth-o,i.depth-o)}},{key:"replace",value:function(e,t,n){return _replace(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(!(t=t.maybeChild(r)))return null;if(i==e||t.isText)return t;e-=i+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}},{key:"resolve",value:function(e){return ResolvedPos.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return ResolvedPos.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fragment.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,o=this.contentMatchAt(e).matchFragment(n,r,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var s=r;s<i;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content);for(var e=Mark.none,t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Mark.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map((function(e){return e.type.name}))));this.content.forEach((function(e){return e.check()}))}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var 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((function(e){return e.toJSON()}))),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=Fragment.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}]),e}();Node.prototype.text=void 0;var TextNode=function(e){_inherits(n,Node);var t=_createSuper(n);function n(e,r,i,o){var a;if(_classCallCheck(this,n),a=t.call(this,e,r,null,o),!i)throw new RangeError("Empty text nodes are not allowed");return a.text=i,a}return _createClass(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var e=_get(_getPrototypeOf(n.prototype),"toJSON",this).call(this);return e.text=this.text,e}}]),n}();function wrapMarks(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var ContentMatch=function(){function e(t){_classCallCheck(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return _createClass(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function i(o,a){var s=o.matchFragment(e,n);if(s&&(!t||s.validEnd))return Fragment.from(a.map((function(e){return e.createAndFill()})));for(var h=0;h<o.next.length;h++){var u=o.next[h],c=u.type,l=u.next;if(!c.isText&&!c.hasRequiredAttrs()&&-1==r.indexOf(l)){r.push(l);var f=i(l,a.concat(c));if(f)return f}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var o=[],a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(var s=0;s<i.next.length;s++){var h=i.next[s],u=h.type,c=h.next;u.isLeaf||u.hasRequiredAttrs()||u.name in t||r.type&&!c.validEnd||(n.push({match:u.contentMatch,type:u,via:r}),t[u.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",i=0;i<t.next.length;i++)r+=(i?", ":"")+t.next[i].type.name+"->"+e.indexOf(t.next[i].next);return r})).join("\n")}}],[{key:"parse",value:function(t,n){var r=new TokenStream(t,n);if(null==r.next)return e.empty;var i=parseExpr(r);r.next&&r.err("Unexpected trailing text");var o=dfa(nfa(i));return checkForDeadEnds(o,r),o}}]),e}();ContentMatch.empty=new ContentMatch(!0);var TokenStream=function(){function e(t,n){_classCallCheck(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}return _createClass(e,[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}]),e}();function parseExpr(e){var t=[];do{t.push(parseExprSeq(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function parseExprSeq(e){var t=[];do{t.push(parseExprSubscript(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function parseExprSubscript(e){for(var t=parseExprAtom(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=parseExprRange(e,t)}return t}function parseNum(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function parseExprRange(e,t){var n=parseNum(e),r=n;return e.eat(",")&&(r="}"!=e.next?parseNum(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function resolveName(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var o in n){var a=n[o];a.groups.indexOf(t)>-1&&i.push(a)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i}function parseExprAtom(e){if(e.eat("(")){var t=parseExpr(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=resolveName(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}function nfa(e){var t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,o))}),[]);if("seq"!=t.type){if("star"==t.type){var a=n();return r(o,a),i(e(t.expr,a),a),[r(a)]}if("plus"==t.type){var s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(o)].concat(e(t.expr,o));if("range"==t.type){for(var h=o,u=0;u<t.min;u++){var c=n();i(e(t.expr,h),c),h=c}if(-1==t.max)i(e(t.expr,h),h);else for(var l=t.min;l<t.max;l++){var f=n();r(h,f),i(e(t.expr,h),f),h=f}return[r(h)]}if("name"==t.type)return[r(o,void 0,t.value)];throw new Error("Unknown expr type")}for(var p=0;;p++){var d=e(t.exprs[p],o);if(p==t.exprs.length-1)return d;i(d,o=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach((function(e){return e.to=t}))}}function cmp(e,t){return t-e}function nullFrom(e,t){var n=[];return function t(r){var i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(var o=0;o<i.length;o++){var a=i[o],s=a.term,h=a.to;s||-1!=n.indexOf(h)||t(h)}}(t),n.sort(cmp)}function dfa(e){var t=Object.create(null);return function n(r){var i=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){for(var o,a=0;a<i.length;a++)i[a][0]==n&&(o=i[a][1]);nullFrom(e,r).forEach((function(e){o||i.push([n,o=[]]),-1==o.indexOf(e)&&o.push(e)}))}}))}));for(var o=t[r.join(",")]=new ContentMatch(r.indexOf(e.length-1)>-1),a=0;a<i.length;a++){var s=i[a][1].sort(cmp);o.next.push({type:i[a][0],next:t[s.join(",")]||n(s)})}return o}(nullFrom(e,0))}function checkForDeadEnds(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],o=!i.validEnd,a=[],s=0;s<i.next.length;s++){var h=i.next[s],u=h.type,c=h.next;a.push(u.name),!o||u.isText||u.hasRequiredAttrs()||(o=!1),-1==r.indexOf(c)&&r.push(c)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function defaultAttrs(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function _computeAttrs(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(void 0===i){var o=e[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}n[r]=i}return n}function initAttrs(e){var t=Object.create(null);if(e)for(var n in e)t[n]=new Attribute(e[n]);return t}var NodeType=function(){function e(t,n,r){_classCallCheck(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=initAttrs(r.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return _createClass(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==ContentMatch.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:_computeAttrs(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node(this,this.computeAttrs(e),Fragment.from(t),Mark.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=Fragment.from(t),this.checkContent(t),new Node(this,this.computeAttrs(e),t,Mark.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=Fragment.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(Fragment.empty,!0);return o?new Node(this,e,t.append(o),Mark.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Mark.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach((function(t,i){return r[t]=new e(t,n,i)}));var i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}]),e}(),Attribute=function(){function e(t){_classCallCheck(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}return _createClass(e,[{key:"isRequired",get:function(){return!this.hasDefault}}]),e}(),MarkType=function(){function e(t,n,r,i){_classCallCheck(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=initAttrs(i.attrs),this.excluded=null;var o=defaultAttrs(this.attrs);this.instance=o?new Mark(this,o):null}return _createClass(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new Mark(this,_computeAttrs(this.attrs,e))}},{key:"removeFromSet",value:function(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}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),i=0;return t.forEach((function(t,o){return r[t]=new e(t,i++,n,o)})),r}}]),e}(),Schema=function(){function e(t){_classCallCheck(this,e),this.cached=Object.create(null);var n=this.spec={};for(var r in t)n[r]=t[r];n.nodes=OrderedMap.from(t.nodes),n.marks=OrderedMap.from(t.marks||{}),this.nodes=NodeType.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);var i=Object.create(null);for(var o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");var a=this.nodes[o],s=a.spec.content||"",h=a.spec.marks;a.contentMatch=i[s]||(i[s]=ContentMatch.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.markSet="_"==h?null:h?gatherMarks(this,h.split(" ")):""!=h&&a.inlineContent?null:[]}for(var u in this.marks){var c=this.marks[u],l=c.spec.excludes;c.excluded=null==l?[c]:""==l?[]:gatherMarks(this,l.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}return _createClass(e,[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof NodeType))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new TextNode(n,n.defaultAttrs,e,Mark.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeFromJSON",value:function(e){return Node.fromJSON(this,e)}},{key:"markFromJSON",value:function(e){return Mark.fromJSON(this,e)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}]),e}();function gatherMarks(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(var s in e.marks){var h=e.marks[s];("_"==i||h.spec.group&&h.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=h)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var DOMParser=function(){function e(t,n){var r=this;_classCallCheck(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[],n.forEach((function(e){e.tag?r.tags.push(e):e.style&&r.styles.push(e)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}return _createClass(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ParseContext(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ParseContext(this,t,!0);return n.addAll(e,t.from,t.to),Slice.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(matches(e,i.tag)&&(void 0===i.namespace||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var o=i.getAttrs(e);if(!1===o)continue;i.attrs=o||void 0}return i}}}},{key:"matchStyle",value:function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var o=this.styles[i],a=o.style;if(!(0!=a.indexOf(e)||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(61!=a.charCodeAt(e.length)||a.slice(e.length+1)!=t))){if(o.getAttrs){var s=o.getAttrs(t);if(!1===s)continue;o.attrs=s||void 0}return o}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((null==i.priority?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=copy(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))};for(var i in e.marks)r(i);var o=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach((function(e){n(e=copy(e)),e.node||e.ignore||e.mark||(e.node=t)}))};for(var a in e.nodes)o(a);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}]),e}(),blockTags={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},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0},OPT_PRESERVE_WS=1,OPT_PRESERVE_WS_FULL=2,OPT_OPEN_LEFT=4;function wsOptionsFor(e,t,n){return null!=t?(t?OPT_PRESERVE_WS:0)|("full"===t?OPT_PRESERVE_WS_FULL:0):e&&"pre"==e.whitespace?OPT_PRESERVE_WS|OPT_PRESERVE_WS_FULL:n&~OPT_OPEN_LEFT}var NodeContext=function(){function e(t,n,r,i,o,a,s){_classCallCheck(this,e),this.type=t,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=s,this.content=[],this.activeMarks=Mark.none,this.stashMarks=[],this.match=a||(s&OPT_OPEN_LEFT?null:t.contentMatch)}return _createClass(e,[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(Fragment.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(this.options&OPT_PRESERVE_WS)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var i=Fragment.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}},{key:"popFromStashMark",value:function(e){for(var t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}},{key:"applyPending",value:function(e){for(var t=0,n=this.pendingMarks;t<n.length;t++){var r=n[t];(this.type?this.type.allowsMarkType(r.type):markMayApply(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!blockTags.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}]),e}(),ParseContext=function(){function e(t,n,r){_classCallCheck(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0;var i,o=n.topNode,a=wsOptionsFor(null,n.preserveWhitespace,0)|(r?OPT_OPEN_LEFT:0);i=o?new NodeContext(o.type,o.attrs,Mark.none,Mark.none,!0,n.topMatch||o.type.contentMatch,a):new NodeContext(r?null:t.schema.topNodeType,null,Mark.none,Mark.none,!0,null,a),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}return _createClass(e,[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e){3==e.nodeType?this.addTextNode(e):1==e.nodeType&&this.addElement(e)}},{key:"withStyleRules",value:function(e,t){var n=e.getAttribute("style");if(!n)return t();var r=this.readStyles(parseStyles(n));if(r){for(var i=_slicedToArray(r,2),o=i[0],a=i[1],s=this.top,h=0;h<a.length;h++)this.removePendingMark(a[h],s);for(var u=0;u<o.length;u++)this.addPendingMark(o[u]);t();for(var c=0;c<o.length;c++)this.removePendingMark(o[c],s);for(var l=0;l<a.length;l++)this.addPendingMark(a[l])}}},{key:"addTextNode",value:function(e){var t=e.nodeValue,n=this.top;if(n.options&OPT_PRESERVE_WS_FULL||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(n.options&OPT_PRESERVE_WS)t=n.options&OPT_PRESERVE_WS_FULL?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],i=e.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t){var n,r=this,i=e.nodeName.toLowerCase();listTags.hasOwnProperty(i)&&this.parser.normalizeLists&&normalizeList(e);var o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:ignoreTags.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);var a,s=this.top,h=this.needsBlock;if(blockTags.hasOwnProperty(i))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),a=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);o&&o.skip?this.addAll(e):this.withStyleRules(e,(function(){return r.addAll(e)})),a&&this.sync(s),this.needsBlock=h}else this.withStyleRules(e,(function(){r.addElementByRule(e,o,!1===o.consuming?n:void 0)}))}},{key:"leafFallback",value:function(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}},{key:"ignoreFallback",value:function(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}},{key:"readStyles",value:function(e){for(var t=this,n=Mark.none,r=Mark.none,i=0;i<e.length;i+=2)for(var o,a=function(o){var a=t.parser.matchStyle(e[i],e[i+1],t,o);return a?a.ignore?{v:null}:(a.clearMark?t.top.pendingMarks.concat(t.top.activeMarks).forEach((function(e){a.clearMark(e)&&(r=e.addToSet(r))})):n=t.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),!1!==a.consuming?(s=o,0):void(s=o=a)):(s=o,0)},s=void 0;0!==(o=a(s));)if(o)return o.v;return[n,r]}},{key:"addElementByRule",value:function(e,t,n){var r,i,o,a=this;t.node?(i=this.parser.schema.nodes[t.node]).isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):r=this.enter(i,t.attrs||null,t.preserveWhitespace):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));var s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return a.insertNode(e)}));else{var h=e;"string"==typeof t.contentElement?h=e.querySelector(t.contentElement):"function"==typeof t.contentElement?h=t.contentElement(e):t.contentElement&&(h=t.contentElement),this.findAround(e,h,!0),this.addAll(h)}r&&this.sync(s)&&this.open--,o&&this.removePendingMark(o,s)}},{key:"addAll",value:function(e,t,n){for(var r=t||0,i=t?e.childNodes[t]:e.firstChild,o=null==n?null:e.childNodes[n];i!=o;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i);this.findAtPoint(e,r)}},{key:"findPlace",value:function(e){for(var t,n,r=this.open;r>=0;r--){var i=this.nodes[r],o=i.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,n=i,!o.length))break;if(i.solid)break}if(!t)return!1;this.sync(n);for(var a=0;a<t.length;a++)this.enterInner(t[a],null,!1);return!0}},{key:"insertNode",value:function(e){if(e.isInline&&this.needsBlock&&!this.top.type){var t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();var n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));for(var r=n.activeMarks,i=0;i<e.marks.length;i++)n.type&&!n.type.allowsMarkType(e.marks[i].type)||(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}},{key:"enter",value:function(e,t,n){var r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}},{key:"enterInner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;this.closeExtra();var i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);var o=wsOptionsFor(e,r,i.options);i.options&OPT_OPEN_LEFT&&0==i.content.length&&(o|=OPT_OPEN_LEFT),this.nodes.push(new NodeContext(e,t,i.activeMarks,i.pendingMarks,n,null,o)),this.open++}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],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}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}},{key:"findInText",value:function(e){if(this.find)for(var 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))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1);return function e(a,s){for(;a>=0;a--){var h=n[a];if(""==h){if(a==n.length-1||0==a)continue;for(;s>=o;s--)if(e(a-1,s))return!0;return!1}var u=s>0||0==s&&i?t.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!u||u.name!=h&&-1==u.groups.indexOf(h))return!1;s--}return!0}(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}}},{key:"addPendingMark",value:function(e){var t=findSameMarkInSet(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}},{key:"removePendingMark",value:function(e,t){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);var i=r.popFromStashMark(e);i&&r.type&&r.type.allowsMarkType(i.type)&&(r.activeMarks=i.addToSet(r.activeMarks))}if(r==t)break}}}]),e}();function normalizeList(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&listTags.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}function matches(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function parseStyles(e){for(var t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];t=n.exec(e);)r.push(t[1],t[2].trim());return r}function copy(e){var t={};for(var n in e)t[n]=e[n];return t}function markMayApply(e,t){var n,r=t.schema.nodes,i=function(){var n=r[o];if(!n.allowsMarkType(e))return 0;var i=[];return function e(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var o=n.edge(r),a=o.type,s=o.next;if(a==t)return!0;if(i.indexOf(s)<0&&e(s))return!0}}(n.contentMatch)?{v:!0}:void 0};for(var o in r)if(0!==(n=i())&&n)return n.v}function findSameMarkInSet(e,t){for(var n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}var DOMSerializer=function(){function e(t,n){_classCallCheck(this,e),this.nodes=t,this.marks=n}return _createClass(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=doc(n).createDocumentFragment());var i=r,o=[];return e.forEach((function(e){if(o.length||e.marks.length){for(var r=0,a=0;r<o.length&&a<e.marks.length;){var s=e.marks[a];if(t.marks[s.type.name]){if(!s.eq(o[r][0])||!1===s.type.spec.spanning)break;r++,a++}else a++}for(;r<o.length;)i=o.pop()[1];for(;a<e.marks.length;){var h=e.marks[a++],u=t.serializeMark(h,e.isInline,n);u&&(o.push([h,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(t.serializeNodeInner(e,n))})),r}},{key:"serializeNodeInner",value:function(t,n){var r=e.renderSpec(doc(n),this.nodes[t.type.name](t)),i=r.dom,o=r.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return i}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}},{key:"serializeMark",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.marks[t.type.name];return i&&e.renderSpec(doc(r),i(t,n))}}],[{key:"renderSpec",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"==typeof n)return{dom:t.createTextNode(n)};if(null!=n.nodeType)return{dom:n};if(n.dom&&null!=n.dom.nodeType)return n;var i,o=n[0],a=o.indexOf(" ");a>0&&(r=o.slice(0,a),o=o.slice(a+1));var s=r?t.createElementNS(r,o):t.createElement(o),h=n[1],u=1;if(h&&"object"==_typeof(h)&&null==h.nodeType&&!Array.isArray(h))for(var c in u=2,h)if(null!=h[c]){var l=c.indexOf(" ");l>0?s.setAttributeNS(c.slice(0,l),c.slice(l+1),h[c]):s.setAttribute(c,h[c])}for(var f=u;f<n.length;f++){var p=n[f];if(0===p){if(f<n.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var d=e.renderSpec(t,p,r),v=d.dom,y=d.contentDOM;if(s.appendChild(v),y){if(i)throw new RangeError("Multiple content holes");i=y}}return{dom:s,contentDOM:i}}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=gatherToDOM(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return gatherToDOM(e.marks)}}]),e}();function gatherToDOM(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function doc(e){return e.document||window.document}exports.ContentMatch=ContentMatch,exports.DOMParser=DOMParser,exports.DOMSerializer=DOMSerializer,exports.Fragment=Fragment,exports.Mark=Mark,exports.MarkType=MarkType,exports.Node=Node,exports.NodeRange=NodeRange,exports.NodeType=NodeType,exports.ReplaceError=ReplaceError,exports.ResolvedPos=ResolvedPos,exports.Schema=Schema,exports.Slice=Slice;