tiptap.umd.min.js 334 KB

12345678910111213141516171819
  1. (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("Vue")):"function"===typeof define&&define.amd?define(["Vue"],e):"object"===typeof exports?exports["tiptap"]=e(require("Vue")):t["tiptap"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(){var e={39:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M5 14a5 5 0 110 10 5 5 0 010-10zm2.5 5.938a.937.937 0 100-1.875H6.25a.312.312 0 01-.313-.313V16.5a.937.937 0 10-1.875 0v1.25c0 .173-.14.313-.312.313H2.5a.937.937 0 100 1.875h1.25c.173 0 .313.14.313.312v1.25a.937.937 0 101.875 0v-1.25c0-.173.14-.313.312-.313H7.5zM16 19a3 3 0 006 0V5a3 3 0 00-6 0v14zm-2 0V5a5 5 0 0110 0v14a5 5 0 01-10 0z"}})]))}}},5379:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M19 14a5 5 0 110 10 5 5 0 010-10zm2.5 5.938a.937.937 0 100-1.875h-1.25a.312.312 0 01-.313-.313V16.5a.937.937 0 10-1.875 0v1.25c0 .173-.14.313-.312.313H16.5a.937.937 0 100 1.875h1.25c.173 0 .313.14.313.312v1.25a.937.937 0 101.875 0v-1.25c0-.173.14-.313.312-.313h1.25zM2 19a3 3 0 006 0V5a3 3 0 10-6 0v14zm-2 0V5a5 5 0 1110 0v14a5 5 0 01-10 0z"}})]))}}},5726:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M19 0a5 5 0 110 10 5 5 0 010-10zm2.5 5.938a.937.937 0 100-1.875h-1.25a.312.312 0 01-.313-.313V2.5a.937.937 0 10-1.875 0v1.25c0 .173-.14.313-.312.313H16.5a.937.937 0 100 1.875h1.25c.173 0 .313.14.313.312V7.5a.937.937 0 101.875 0V6.25c0-.173.14-.313.312-.313h1.25zM5 16a3 3 0 000 6h14a3 3 0 000-6H5zm0-2h14a5 5 0 010 10H5a5 5 0 010-10z"}})]))}}},7228:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M19 14a5 5 0 110 10 5 5 0 010-10zm2.5 5.938a.937.937 0 100-1.875h-1.25a.312.312 0 01-.313-.313V16.5a.937.937 0 10-1.875 0v1.25c0 .173-.14.313-.312.313H16.5a.937.937 0 100 1.875h1.25c.173 0 .313.14.313.312v1.25a.937.937 0 101.875 0v-1.25c0-.173.14-.313.312-.313h1.25zM5 2a3 3 0 100 6h14a3 3 0 000-6H5zm0-2h14a5 5 0 010 10H5A5 5 0 115 0z"}})]))}}},3642:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M17.194 10.962A6.271 6.271 0 0012.844.248H4.3a1.25 1.25 0 000 2.5h1.013a.25.25 0 01.25.25V21a.25.25 0 01-.25.25H4.3a1.25 1.25 0 100 2.5h9.963a6.742 6.742 0 002.93-12.786zm-4.35-8.214a3.762 3.762 0 010 7.523H8.313a.25.25 0 01-.25-.25V3a.25.25 0 01.25-.25zm1.42 18.5H8.313a.25.25 0 01-.25-.25v-7.977a.25.25 0 01.25-.25H14.264a4.239 4.239 0 010 8.477z"}})]))}}},3282:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M21 0H3a3 3 0 00-3 3v18a3 3 0 003 3h18a3 3 0 003-3V3a3 3 0 00-3-3zm1 21a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1h18a1 1 0 011 1z"}}),n("path",{attrs:{d:"M11.249 4.5a1.251 1.251 0 00-1.75.25L7.365 7.6l-.482-.481a1.25 1.25 0 00-1.767 1.764l1.5 1.5a1.262 1.262 0 001.884-.134l3-4a1.25 1.25 0 00-.251-1.749zM11.249 13.5a1.251 1.251 0 00-1.75.25L7.365 16.6l-.482-.481a1.25 1.25 0 10-1.767 1.768l1.5 1.5a1.265 1.265 0 001.884-.138l3-4a1.25 1.25 0 00-.251-1.749zM18.5 7.749H14a1.25 1.25 0 000 2.5h4.5a1.25 1.25 0 000-2.5zM18.5 15.749H14a1.25 1.25 0 000 2.5h4.5a1.25 1.25 0 100-2.5z"}})]))}}},8593:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M9.147 21.552a1.244 1.244 0 01-.895-.378L.84 13.561a2.257 2.257 0 010-3.125l7.412-7.613a1.25 1.25 0 011.791 1.744l-6.9 7.083a.5.5 0 000 .7l6.9 7.082a1.25 1.25 0 01-.9 2.122zM14.854 21.552a1.25 1.25 0 01-.9-2.122l6.9-7.083a.5.5 0 000-.7l-6.9-7.082a1.25 1.25 0 011.791-1.744l7.411 7.612a2.257 2.257 0 010 3.125l-7.412 7.614a1.244 1.244 0 01-.89.38zm6.514-9.373z"}})]))}}},2015:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 474.557 474.557",width:"24",height:"24"},h),...d},i.concat([n("path",{attrs:{d:"M0 2.028V472.53h474.557V2.028H0zm435.471 431.437H39.108V41.136h396.363v392.329z"}}),n("path",{attrs:{d:"M124.916 273.625c1.294 4.53 2.006 14.409 2.006 29.574 0 13.007.669 22.563 2.071 28.624 1.402 6.018 4.142 11.174 8.24 15.272 4.077 4.098 9.081 7.075 15.013 8.866 5.954 1.769 14.496 2.653 25.605 2.653h6.579v-29.66c-8.866 0-14.625-.561-17.3-1.682-2.653-1.143-4.638-2.718-5.954-4.897-1.294-2.157-1.941-5.91-1.941-11.325 0-3.84-.345-12.576-.992-26.295-.496-8.973-1.575-16.135-3.236-21.484-1.639-5.393-4.012-9.944-7.118-13.697-3.085-3.775-7.054-7.032-11.907-9.815 5.501-3.581 9.577-6.967 12.274-10.311 2.675-3.257 4.875-7.442 6.601-12.511 1.704-5.069 2.783-11.691 3.214-19.845.733-14.452 1.143-24.289 1.143-29.487 0-5.091.626-8.715 1.855-10.807 1.251-2.071 3.149-3.645 5.738-4.702 2.588-1.014 8.477-1.532 17.623-1.532v-29.509h-6.579c-10.807 0-18.723.755-23.728 2.243-7.42 2.222-13.072 5.242-16.976 9.06-3.883 3.84-6.558 8.909-8.046 15.229-1.467 6.277-2.179 17.429-2.179 33.348 0 9.858-.367 16.674-1.035 20.643-.82 5.263-2.351 9.642-4.551 13.158-2.243 3.516-4.832 5.997-7.916 7.485-3.02 1.445-7.528 2.373-13.568 2.739v29.681c7.593.388 13.201 2.028 16.89 4.897 3.645 2.806 6.384 7.487 8.174 14.087zM212.084 331.392l6.73 14.366c7.42-2.653 13.568-6.32 18.4-10.915 4.832-4.595 8.089-9.815 9.815-15.617 1.747-5.846 2.61-13.805 2.61-23.814v-24.785h-34.751v34.729h16.761c-.129 6.838-1.726 12.295-4.659 16.48-2.956 4.034-7.939 7.269-14.906 9.556zM214.888 174.012h34.751v34.772h-34.751zM311.18 356.349c7.464-2.243 13.201-5.22 17.106-9.081 3.883-3.818 6.536-8.93 7.938-15.272 1.402-6.363 2.179-17.515 2.179-33.499 0-9.75.367-16.609 1.014-20.557.884-5.263 2.438-9.642 4.659-13.137 2.179-3.494 4.767-6.018 7.809-7.485 3.042-1.467 7.55-2.373 13.568-2.696h-.043v-29.66c-7.615-.453-13.18-2.071-16.933-4.918-3.667-2.826-6.407-7.571-8.262-14.107-1.251-4.616-1.855-14.452-1.855-29.509 0-13.029-.712-22.541-2.157-28.56-1.424-6.105-4.163-11.195-8.197-15.358-4.055-4.142-9.038-7.054-14.97-8.801-5.975-1.726-14.517-2.61-25.626-2.61h-6.557v29.466c9.34 0 15.337.561 17.99 1.683 2.696 1.1 4.551 2.675 5.565 4.724 1.057 2.049 1.553 6.169 1.639 12.36.453 19.608 1.186 32.291 2.071 38.072 1.381 8.369 4.055 15.294 7.873 20.686 2.826 3.84 7.248 7.658 13.352 11.627-4.702 2.696-8.52 5.846-11.54 9.448-3.041 3.559-5.436 7.96-7.205 13.072-1.812 5.177-2.955 12.08-3.322 20.6-.669 14.172-1.1 23.814-1.1 28.819-.086 5.026-.669 8.585-1.984 10.699-1.316 2.136-3.279 3.71-5.975 4.853-2.718 1.122-8.52 1.639-17.364 1.639v29.66h6.622c10.741.064 18.679-.712 23.705-2.158z"}})]))}}},1071:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M2 19a3 3 0 003 3h14a3 3 0 003-3V5a3 3 0 00-3-3H5a3 3 0 00-3 3v14zm-2 0V5a5 5 0 015-5h14a5 5 0 015 5v14a5 5 0 01-5 5H5a5 5 0 01-5-5zm12-9a1 1 0 011 1v2a1 1 0 01-2 0v-2a1 1 0 011-1zm0 6a1 1 0 011 1v3a1 1 0 01-2 0v-3a1 1 0 011-1zm0-13a1 1 0 011 1v3a1 1 0 01-2 0V4a1 1 0 011-1z"}})]))}}},3649:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M12.641 21.931a7.01 7.01 0 001.146 1.74A5 5 0 017 19V5a5 5 0 1110 0v7.29a6.972 6.972 0 00-2 .965V5a3 3 0 00-6 0v14a3 3 0 003.641 2.931zM19 14a5 5 0 110 10 5 5 0 010-10zm-2.5 5.938h5a.937.937 0 100-1.875h-5a.937.937 0 100 1.875z"}})]))}}},5517:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M13.255 15a6.972 6.972 0 00-.965 2H5A5 5 0 015 7h14a5 5 0 014.671 6.787 7.01 7.01 0 00-1.74-1.146A3 3 0 0019 9H5a3 3 0 000 6h8.255zM19 14a5 5 0 110 10 5 5 0 010-10zm-2.5 5.938h5a.937.937 0 100-1.875h-5a.937.937 0 100 1.875z"}})]))}}},4077:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M19 14a5 5 0 110 10 5 5 0 010-10zm-2.5 5.938h5a.937.937 0 100-1.875h-5a.937.937 0 100 1.875zM12.29 17H9v5h3.674c.356.75.841 1.426 1.427 2H5a5 5 0 01-5-5V5a5 5 0 015-5h14a5 5 0 015 5v2.823a.843.843 0 010 .354V14.1a7.018 7.018 0 00-2-1.427V9h-5v3.29a6.972 6.972 0 00-2 .965V9H9v6h4.255a6.972 6.972 0 00-.965 2zM17 7h5V5a3 3 0 00-3-3h-2v5zm-2 0V2H9v5h6zM7 2H5a3 3 0 00-3 3v2h5V2zM2 9v6h5V9H2zm0 8v2a3 3 0 003 3h2v-5H2z"}})]))}}},4478:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M11.999.5C5.649.5.5 5.648.5 12c0 5.082 3.294 9.392 7.865 10.914.574.103.756-.236.756-.541 0-.274.006-1.037 0-1.997-3.198.694-3.861-1.515-3.861-1.515-.523-1.329-1.275-1.682-1.275-1.682-1.045-.714.077-.699.077-.699 1.153.08 1.762 1.184 1.762 1.184 1.026 1.758 2.691 1.25 3.346.956.106-.742.402-1.251.731-1.536-2.554-.292-5.238-1.277-5.238-5.686 0-1.255.448-2.281 1.184-3.086-.118-.289-.514-1.46.112-3.043 0 0 .967-.309 3.162 1.18a11.011 11.011 0 012.88-.388c.976.005 1.96.132 2.88.388 2.195-1.488 3.159-1.18 3.159-1.18.627 1.583.232 2.754.114 3.043.736.805 1.183 1.831 1.183 3.086 0 4.42-2.689 5.391-5.251 5.674.412.357.787 1.047.787 2.12v3.184c0 .308.186.647.77.536C20.209 21.389 23.5 17.08 23.5 12 23.5 5.648 18.352.5 11.999.5z"}})]))}}},8242:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M5 13a1 1 0 010-2h14a1 1 0 010 2H5z"}})]))}}},3998:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("circle",{attrs:{cx:"9.75",cy:"6.247",r:"2.25"}}),n("path",{attrs:{d:"M16.916 8.71A1.027 1.027 0 0016 8.158a1.007 1.007 0 00-.892.586l-1.558 3.434a.249.249 0 01-.422.053l-.82-1.024a1 1 0 00-.813-.376 1.007 1.007 0 00-.787.426L7.59 15.71a.5.5 0 00.41.79h12a.5.5 0 00.425-.237.5.5 0 00.022-.486z"}}),n("path",{attrs:{d:"M22 0H5.5a2 2 0 00-2 2v16.5a2 2 0 002 2H22a2 2 0 002-2V2a2 2 0 00-2-2zm-.145 18.354a.5.5 0 01-.354.146H6a.5.5 0 01-.5-.5V2.5A.5.5 0 016 2h15.5a.5.5 0 01.5.5V18a.5.5 0 01-.145.351z"}}),n("path",{attrs:{d:"M19.5 22h-17a.5.5 0 01-.5-.5v-17a1 1 0 00-2 0V22a2 2 0 002 2h17.5a1 1 0 000-2z"}})]))}}},3028:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M22.5.248h-7.637a1.25 1.25 0 000 2.5h1.086a.25.25 0 01.211.384L4.78 21.017a.5.5 0 01-.422.231H1.5a1.25 1.25 0 000 2.5h7.637a1.25 1.25 0 000-2.5H8.051a.25.25 0 01-.211-.384L19.22 2.98a.5.5 0 01.422-.232H22.5a1.25 1.25 0 000-2.5z"}})]))}}},6803:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M12.406 14.905a1 1 0 00-.543 1.307 1 1 0 01-.217 1.09l-2.828 2.829a2 2 0 01-2.828 0L3.868 18.01a2 2 0 010-2.829L6.7 12.353a1.013 1.013 0 011.091-.217 1 1 0 00.763-1.849 3.034 3.034 0 00-3.268.652l-2.832 2.828a4.006 4.006 0 000 5.657l2.122 2.121a4 4 0 005.656 0l2.829-2.828a3.008 3.008 0 00.651-3.27 1 1 0 00-1.306-.542z"}}),n("path",{attrs:{d:"M7.757 16.241a1.011 1.011 0 001.414 0l7.779-7.778a1 1 0 00-1.414-1.414l-7.779 7.778a1 1 0 000 1.414z"}}),n("path",{attrs:{d:"M21.546 4.574l-2.121-2.121a4.006 4.006 0 00-5.657 0l-2.829 2.828a3.006 3.006 0 00-.651 3.269 1 1 0 101.849-.764 1 1 0 01.217-1.086l2.828-2.828a2 2 0 012.829 0l2.121 2.121a2 2 0 010 2.829L17.3 11.645a1.015 1.015 0 01-1.091.217 1 1 0 00-.765 1.849 3.026 3.026 0 003.27-.651l2.828-2.828a4.007 4.007 0 00.004-5.658z"}})]))}}},7674:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M12 .5A11.634 11.634 0 00.262 12 11.634 11.634 0 0012 23.5a11.836 11.836 0 006.624-2 1.25 1.25 0 10-1.393-2.076A9.34 9.34 0 0112 21a9.132 9.132 0 01-9.238-9A9.132 9.132 0 0112 3a9.132 9.132 0 019.238 9v.891a1.943 1.943 0 01-3.884 0V12A5.355 5.355 0 1012 17.261a5.376 5.376 0 003.861-1.634 4.438 4.438 0 007.877-2.736V12A11.634 11.634 0 0012 .5zm0 14.261A2.763 2.763 0 1114.854 12 2.812 2.812 0 0112 14.761z"}})]))}}},3524:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M7.75 4.5h15a1 1 0 000-2h-15a1 1 0 000 2zM22.75 11h-15a1 1 0 100 2h15a1 1 0 000-2zM22.75 19.5h-15a1 1 0 000 2h15a1 1 0 000-2zM2.212 17.248a2 2 0 00-1.933 1.484.75.75 0 101.45.386.5.5 0 11.483.63.75.75 0 100 1.5.5.5 0 11-.482.635.75.75 0 10-1.445.4 2 2 0 103.589-1.648.251.251 0 010-.278 2 2 0 00-1.662-3.111zM4.25 10.748a2 2 0 00-4 0 .75.75 0 001.5 0 .5.5 0 011 0 1.031 1.031 0 01-.227.645L.414 14.029A.75.75 0 001 15.248h2.5a.75.75 0 000-1.5h-.419a.249.249 0 01-.195-.406L3.7 12.33a2.544 2.544 0 00.55-1.582zM4 5.248h-.25A.25.25 0 013.5 5V1.623A1.377 1.377 0 002.125.248H1.5a.75.75 0 000 1.5h.25A.25.25 0 012 2v3a.25.25 0 01-.25.25H1.5a.75.75 0 000 1.5H4a.75.75 0 000-1.5z"}})]))}}},7260:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M22.5.248H7.228a6.977 6.977 0 100 13.954h2.318a.25.25 0 01.25.25V22.5a1.25 1.25 0 002.5 0V3a.25.25 0 01.25-.25h3.682a.25.25 0 01.25.25v19.5a1.25 1.25 0 002.5 0V3a.249.249 0 01.25-.25H22.5a1.25 1.25 0 000-2.5zM9.8 11.452a.25.25 0 01-.25.25H7.228a4.477 4.477 0 110-8.954h2.318A.25.25 0 019.8 3z"}})]))}}},8710:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M18.559 3.932a4.942 4.942 0 100 9.883 4.609 4.609 0 001.115-.141.25.25 0 01.276.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.71 9.71 0 009.428-9.95V8.873a4.947 4.947 0 00-4.941-4.941zM6.236 3.932a4.942 4.942 0 000 9.883 4.6 4.6 0 001.115-.141.25.25 0 01.277.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.711 9.711 0 009.428-9.95V8.873a4.947 4.947 0 00-4.942-4.941z"}})]))}}},3899:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M22.608.161a.5.5 0 00-.545.108L19.472 2.86a.25.25 0 01-.292.045 12.537 12.537 0 00-12.966.865A12.259 12.259 0 006.1 23.632a1.25 1.25 0 001.476-2.018 9.759 9.759 0 01.091-15.809 10 10 0 019.466-1.1.25.25 0 01.084.409l-1.85 1.85a.5.5 0 00.354.853h6.7a.5.5 0 00.5-.5V.623a.5.5 0 00-.313-.462z"}})]))}}},6499:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M20.485 3.511A12.01 12.01 0 1024 12a12.009 12.009 0 00-3.515-8.489zm-1.767 15.21A9.51 9.51 0 1121.5 12a9.508 9.508 0 01-2.782 6.721z"}}),n("path",{attrs:{d:"M16.987 7.01a1.275 1.275 0 00-1.8 0l-3.177 3.177L8.829 7.01a1.277 1.277 0 00-1.805 1.806l3.176 3.177-3.176 3.178a1.277 1.277 0 001.805 1.806l3.176-3.177 3.177 3.178a1.277 1.277 0 001.8-1.806l-3.176-3.178 3.176-3.177a1.278 1.278 0 00.005-1.807z"}})]))}}},3145:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M23.75 12.952A1.25 1.25 0 0022.5 11.7h-8.936a.492.492 0 01-.282-.09c-.722-.513-1.482-.981-2.218-1.432-2.8-1.715-4.5-2.9-4.5-4.863 0-2.235 2.207-2.569 3.523-2.569a4.54 4.54 0 013.081.764 2.662 2.662 0 01.447 1.99v.3a1.25 1.25 0 102.5 0v-.268a4.887 4.887 0 00-1.165-3.777C13.949.741 12.359.248 10.091.248c-3.658 0-6.023 1.989-6.023 5.069 0 2.773 1.892 4.512 4 5.927a.25.25 0 01-.139.458H1.5a1.25 1.25 0 000 2.5h10.977a.251.251 0 01.159.058 4.339 4.339 0 011.932 3.466c0 3.268-3.426 3.522-4.477 3.522-1.814 0-3.139-.405-3.834-1.173a3.394 3.394 0 01-.65-2.7 1.25 1.25 0 00-2.488-.246A5.76 5.76 0 004.4 21.753c1.2 1.324 3.114 2 5.688 2 4.174 0 6.977-2.42 6.977-6.022a6.059 6.059 0 00-.849-3.147.25.25 0 01.216-.377H22.5a1.25 1.25 0 001.25-1.255z"}})]))}}},7059:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{"fill-rule":"evenodd",d:"M17 17v5h2a3 3 0 003-3v-2h-5zm-2 0H9v5h6v-5zm2-2h5V9h-5v6zm-2 0V9H9v6h6zm2-8h5V5a3 3 0 00-3-3h-2v5zm-2 0V2H9v5h6zm9 9.177V19a5 5 0 01-5 5H5a5 5 0 01-5-5V5a5 5 0 015-5h14a5 5 0 015 5v2.823a.843.843 0 010 .354v7.646a.843.843 0 010 .354zM7 2H5a3 3 0 00-3 3v2h5V2zM2 9v6h5V9H2zm0 8v2a3 3 0 003 3h2v-5H2z"}})]))}}},8559:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("circle",{attrs:{cx:"2.5",cy:"3.998",r:"2.5"}}),n("path",{attrs:{d:"M8.5 5H23a1 1 0 000-2H8.5a1 1 0 000 2z"}}),n("circle",{attrs:{cx:"2.5",cy:"11.998",r:"2.5"}}),n("path",{attrs:{d:"M23 11H8.5a1 1 0 000 2H23a1 1 0 000-2z"}}),n("circle",{attrs:{cx:"2.5",cy:"19.998",r:"2.5"}}),n("path",{attrs:{d:"M23 19H8.5a1 1 0 000 2H23a1 1 0 000-2z"}})]))}}},1358:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M22.5 21.248h-21a1.25 1.25 0 000 2.5h21a1.25 1.25 0 000-2.5zM1.978 2.748h1.363a.25.25 0 01.25.25v8.523a8.409 8.409 0 0016.818 0V3a.25.25 0 01.25-.25h1.363a1.25 1.25 0 000-2.5H16.3a1.25 1.25 0 000 2.5h1.363a.25.25 0 01.25.25v8.523a5.909 5.909 0 01-11.818 0V3a.25.25 0 01.25-.25H7.7a1.25 1.25 0 100-2.5H1.978a1.25 1.25 0 000 2.5z"}})]))}}},2585:function(t){t.exports={functional:!0,render(t,e){const{_c:n,_v:r,data:o,children:i=[]}=e,{class:s,staticClass:l,style:a,staticStyle:c,attrs:h={},...d}=o;return n("svg",{class:[s,l],style:[a,c],attrs:Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},h),...d},i.concat([n("path",{attrs:{d:"M17.786 3.77a12.542 12.542 0 00-12.965-.865.249.249 0 01-.292-.045L1.937.269A.507.507 0 001.392.16a.5.5 0 00-.308.462v6.7a.5.5 0 00.5.5h6.7a.5.5 0 00.354-.854L6.783 5.115a.253.253 0 01-.068-.228.249.249 0 01.152-.181 10 10 0 019.466 1.1 9.759 9.759 0 01.094 15.809 1.25 1.25 0 001.473 2.016 12.122 12.122 0 005.013-9.961 12.125 12.125 0 00-5.127-9.9z"}})]))}}},5785:function(t,e,n){"use strict";var r=n(6574),o=i(Error);function i(t){return e.displayName=t.displayName||t.name,e;function e(e){return e&&(e=r.apply(null,arguments)),new t(e)}}t.exports=o,o.eval=i(EvalError),o.range=i(RangeError),o.reference=i(ReferenceError),o.syntax=i(SyntaxError),o.type=i(TypeError),o.uri=i(URIError),o.create=i},6574:function(t){(function(){var e;function n(){console.log(o.apply(null,arguments))}function r(t,e){return o.apply(null,[t].concat(e))}function o(t){for(var e,n,r,o,i=1,s=[].slice.call(arguments),l=0,a=t.length,c="",h=!1,d=!1,u=function(){return s[i++]},p=function(){var n="";while(/\d/.test(t[l]))n+=t[l++],e=t[l];return n.length>0?parseInt(n):null};l<a;++l)if(e=t[l],h)switch(h=!1,"."==e?(d=!1,e=t[++l]):"0"==e&&"."==t[l+1]?(d=!0,l+=2,e=t[l]):d=!0,o=p(),e){case"b":c+=parseInt(u(),10).toString(2);break;case"c":n=u(),c+="string"===typeof n||n instanceof String?n:String.fromCharCode(parseInt(n,10));break;case"d":c+=parseInt(u(),10);break;case"f":r=String(parseFloat(u()).toFixed(o||6)),c+=d?r:r.replace(/^0/,"");break;case"j":c+=JSON.stringify(u());break;case"o":c+="0"+parseInt(u(),10).toString(8);break;case"s":c+=u();break;case"x":c+="0x"+parseInt(u(),10).toString(16);break;case"X":c+="0x"+parseInt(u(),10).toString(16).toUpperCase();break;default:c+=e;break}else"%"===e?h=!0:c+=e;return c}e=t.exports=o,e.format=o,e.vsprintf=r,"undefined"!==typeof console&&"function"===typeof console.log&&(e.printf=n)})()},1154:function(t,e,n){function r(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(e){var n=t[e];"object"!=typeof n||Object.isFrozen(n)||r(n)})),t}n(7658),n(541);var o=r,i=r;o.default=i;class s{constructor(t){void 0===t.data&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function l(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function a(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach((function(t){for(const e in t)n[e]=t[e]})),n}const c="</span>",h=t=>!!t.kind;class d{constructor(t,e){this.buffer="",this.classPrefix=e.classPrefix,t.walk(this)}addText(t){this.buffer+=l(t)}openNode(t){if(!h(t))return;let e=t.kind;t.sublanguage||(e=`${this.classPrefix}${e}`),this.span(e)}closeNode(t){h(t)&&(this.buffer+=c)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}class u{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const e={kind:t,children:[]};this.add(e),this.stack.push(e)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){while(this.closeNode());}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,e){return"string"===typeof e?t.addText(e):e.children&&(t.openNode(e),e.children.forEach((e=>this._walk(t,e))),t.closeNode(e)),t}static _collapse(t){"string"!==typeof t&&t.children&&(t.children.every((t=>"string"===typeof t))?t.children=[t.children.join("")]:t.children.forEach((t=>{u._collapse(t)})))}}class p extends u{constructor(t){super(),this.options=t}addKeyword(t,e){""!==t&&(this.openNode(e),this.addText(t),this.closeNode())}addText(t){""!==t&&this.add(t)}addSublanguage(t,e){const n=t.root;n.kind=e,n.sublanguage=!0,this.add(n)}toHTML(){const t=new d(this,this.options);return t.value()}finalize(){return!0}}function f(t){return new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function m(t){return t?"string"===typeof t?t:t.source:null}function g(...t){const e=t.map((t=>m(t))).join("");return e}function y(...t){const e="("+t.map((t=>m(t))).join("|")+")";return e}function w(t){return new RegExp(t.toString()+"|").exec("").length-1}function v(t,e){const n=t&&t.exec(e);return n&&0===n.index}const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function x(t,e="|"){let n=0;return t.map((t=>{n+=1;const e=n;let r=m(t),o="";while(r.length>0){const t=b.exec(r);if(!t){o+=r;break}o+=r.substring(0,t.index),r=r.substring(t.index+t[0].length),"\\"===t[0][0]&&t[1]?o+="\\"+String(Number(t[1])+e):(o+=t[0],"("===t[0]&&n++)}return o})).map((t=>`(${t})`)).join(e)}const k=/\b\B/,S="[a-zA-Z]\\w*",C="[a-zA-Z_]\\w*",M="\\b\\d+(\\.\\d+)?",O="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",N="\\b(0b[01]+)",E="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",A=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=g(e,/.*\b/,t.binary,/\b.*/)),a({className:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,e)=>{0!==t.index&&e.ignoreMatch()}},t)},D={begin:"\\\\[\\s\\S]",relevance:0},T={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},R={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},z={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},_=function(t,e,n={}){const r=a({className:"comment",begin:t,end:e,contains:[]},n);return r.contains.push(z),r.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),r},I=_("//","$"),$=_("/\\*","\\*/"),P=_("#","$"),B={className:"number",begin:M,relevance:0},V={className:"number",begin:O,relevance:0},F={className:"number",begin:N,relevance:0},L={className:"number",begin:M+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},j={begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]}]},H={className:"title",begin:S,relevance:0},J={className:"title",begin:C,relevance:0},W={begin:"\\.\\s*"+C,relevance:0},q=function(t){return Object.assign(t,{"on:begin":(t,e)=>{e.data._beginMatch=t[1]},"on:end":(t,e)=>{e.data._beginMatch!==t[1]&&e.ignoreMatch()}})};var K=Object.freeze({__proto__:null,MATCH_NOTHING_RE:k,IDENT_RE:S,UNDERSCORE_IDENT_RE:C,NUMBER_RE:M,C_NUMBER_RE:O,BINARY_NUMBER_RE:N,RE_STARTERS_RE:E,SHEBANG:A,BACKSLASH_ESCAPE:D,APOS_STRING_MODE:T,QUOTE_STRING_MODE:R,PHRASAL_WORDS_MODE:z,COMMENT:_,C_LINE_COMMENT_MODE:I,C_BLOCK_COMMENT_MODE:$,HASH_COMMENT_MODE:P,NUMBER_MODE:B,C_NUMBER_MODE:V,BINARY_NUMBER_MODE:F,CSS_NUMBER_MODE:L,REGEXP_MODE:j,TITLE_MODE:H,UNDERSCORE_TITLE_MODE:J,METHOD_GUARD:W,END_SAME_AS_BEGIN:q});function U(t,e){const n=t.input[t.index-1];"."===n&&e.ignoreMatch()}function G(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=U,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,void 0===t.relevance&&(t.relevance=0))}function X(t,e){Array.isArray(t.illegal)&&(t.illegal=y(...t.illegal))}function Y(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function Z(t,e){void 0===t.relevance&&(t.relevance=1)}const Q=["of","and","for","in","not","or","if","then","parent","list","value"],tt="keyword";function et(t,e,n=tt){const r={};return"string"===typeof t?o(n,t.split(" ")):Array.isArray(t)?o(n,t):Object.keys(t).forEach((function(n){Object.assign(r,et(t[n],e,n))})),r;function o(t,n){e&&(n=n.map((t=>t.toLowerCase()))),n.forEach((function(e){const n=e.split("|");r[n[0]]=[t,nt(n[0],n[1])]}))}}function nt(t,e){return e?Number(e):rt(t)?0:1}function rt(t){return Q.includes(t.toLowerCase())}function ot(t,{plugins:e}){function n(e,n){return new RegExp(m(e),"m"+(t.case_insensitive?"i":"")+(n?"g":""))}class r{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(t,e){e.position=this.position++,this.matchIndexes[this.matchAt]=e,this.regexes.push([e,t]),this.matchAt+=w(t)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const t=this.regexes.map((t=>t[1]));this.matcherRe=n(x(t),!0),this.lastIndex=0}exec(t){this.matcherRe.lastIndex=this.lastIndex;const e=this.matcherRe.exec(t);if(!e)return null;const n=e.findIndex(((t,e)=>e>0&&void 0!==t)),r=this.matchIndexes[n];return e.splice(0,n),Object.assign(e,r)}}class o{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(t){if(this.multiRegexes[t])return this.multiRegexes[t];const e=new r;return this.rules.slice(t).forEach((([t,n])=>e.addRule(t,n))),e.compile(),this.multiRegexes[t]=e,e}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(t,e){this.rules.push([t,e]),"begin"===e.type&&this.count++}exec(t){const e=this.getMatcher(this.regexIndex);e.lastIndex=this.lastIndex;let n=e.exec(t);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const e=this.getMatcher(0);e.lastIndex=this.lastIndex+1,n=e.exec(t)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(t){const e=new o;return t.contains.forEach((t=>e.addRule(t.begin,{rule:t,type:"begin"}))),t.terminatorEnd&&e.addRule(t.terminatorEnd,{type:"end"}),t.illegal&&e.addRule(t.illegal,{type:"illegal"}),e}function s(e,r){const o=e;if(e.isCompiled)return o;[Y].forEach((t=>t(e,r))),t.compilerExtensions.forEach((t=>t(e,r))),e.__beforeBegin=null,[G,X,Z].forEach((t=>t(e,r))),e.isCompiled=!0;let l=null;if("object"===typeof e.keywords&&(l=e.keywords.$pattern,delete e.keywords.$pattern),e.keywords&&(e.keywords=et(e.keywords,t.case_insensitive)),e.lexemes&&l)throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return l=l||e.lexemes||/\w+/,o.keywordPatternRe=n(l,!0),r&&(e.begin||(e.begin=/\B|\b/),o.beginRe=n(e.begin),e.endSameAsBegin&&(e.end=e.begin),e.end||e.endsWithParent||(e.end=/\B|\b/),e.end&&(o.endRe=n(e.end)),o.terminatorEnd=m(e.end)||"",e.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(e.end?"|":"")+r.terminatorEnd)),e.illegal&&(o.illegalRe=n(e.illegal)),e.contains||(e.contains=[]),e.contains=[].concat(...e.contains.map((function(t){return st("self"===t?e:t)}))),e.contains.forEach((function(t){s(t,o)})),e.starts&&s(e.starts,r),o.matcher=i(o),o}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=a(t.classNameAliases||{}),s(t)}function it(t){return!!t&&(t.endsWithParent||it(t.starts))}function st(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map((function(e){return a(t,{variants:null},e)}))),t.cachedVariants?t.cachedVariants:it(t)?a(t,{starts:t.starts?a(t.starts):null}):Object.isFrozen(t)?a(t):t}var lt="10.7.3";function at(t){return Boolean(t||""===t)}function ct(t){const e={props:["language","code","autodetect"],data:function(){return{detectedLanguage:"",unknownLanguage:!1}},computed:{className(){return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){if(!this.autoDetect&&!t.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`),this.unknownLanguage=!0,l(this.code);let e={};return this.autoDetect?(e=t.highlightAuto(this.code),this.detectedLanguage=e.language):(e=t.highlight(this.language,this.code,this.ignoreIllegals),this.detectedLanguage=this.language),e.value},autoDetect(){return!this.language||at(this.autodetect)},ignoreIllegals(){return!0}},render(t){return t("pre",{},[t("code",{class:this.className,domProps:{innerHTML:this.highlighted}})])}},n={install(t){t.component("highlightjs",e)}};return{Component:e,VuePlugin:n}}const ht={"after:highlightElement":({el:t,result:e,text:n})=>{const r=ut(t);if(!r.length)return;const o=document.createElement("div");o.innerHTML=e.value,e.value=pt(r,ut(o),n)}};function dt(t){return t.nodeName.toLowerCase()}function ut(t){const e=[];return function t(n,r){for(let o=n.firstChild;o;o=o.nextSibling)3===o.nodeType?r+=o.nodeValue.length:1===o.nodeType&&(e.push({event:"start",offset:r,node:o}),r=t(o,r),dt(o).match(/br|hr|img|input/)||e.push({event:"stop",offset:r,node:o}));return r}(t,0),e}function pt(t,e,n){let r=0,o="";const i=[];function s(){return t.length&&e.length?t[0].offset!==e[0].offset?t[0].offset<e[0].offset?t:e:"start"===e[0].event?t:e:t.length?t:e}function a(t){function e(t){return" "+t.nodeName+'="'+l(t.value)+'"'}o+="<"+dt(t)+[].map.call(t.attributes,e).join("")+">"}function c(t){o+="</"+dt(t)+">"}function h(t){("start"===t.event?a:c)(t.node)}while(t.length||e.length){let e=s();if(o+=l(n.substring(r,e[0].offset)),r=e[0].offset,e===t){i.reverse().forEach(c);do{h(e.splice(0,1)[0]),e=s()}while(e===t&&e.length&&e[0].offset===r);i.reverse().forEach(a)}else"start"===e[0].event?i.push(e[0].node):i.pop(),h(e.splice(0,1)[0])}return o+l(n.substr(r))}const ft={},mt=t=>{console.error(t)},gt=(t,...e)=>{console.log(`WARN: ${t}`,...e)},yt=(t,e)=>{ft[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),ft[`${t}/${e}`]=!0)},wt=l,vt=a,bt=Symbol("nomatch"),xt=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const l=/(^(<[^>]+>|\t|)+|\n)/gm,a="Could not find the language '{}', did you forget to load/include a language module?",c={disableAutodetect:!0,name:"Plain text",contains:[]};let h={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:p};function d(t){return h.noHighlightRe.test(t)}function u(t){let e=t.className+" ";e+=t.parentNode?t.parentNode.className:"";const n=h.languageDetectRe.exec(e);if(n){const e=$(n[1]);return e||(gt(a.replace("{}",n[1])),gt("Falling back to no-highlight mode for this block.",t)),e?n[1]:"no-highlight"}return e.split(/\s+/).find((t=>d(t)||$(t)))}function m(t,e,n,r){let o="",i="";"object"===typeof e?(o=t,n=e.ignoreIllegals,i=e.language,r=void 0):(yt("10.7.0","highlight(lang, code, ...args) has been deprecated."),yt("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=t,o=e);const s={code:o,language:i};L("before:highlight",s);const l=s.result?s.result:g(s.language,s.code,n,r);return l.code=s.code,L("after:highlight",l),l}function g(t,n,o,l){function c(t,e){const n=O.case_insensitive?e[0].toLowerCase():e[0];return Object.prototype.hasOwnProperty.call(t.keywords,n)&&t.keywords[n]}function d(){if(!A.keywords)return void T.addText(R);let t=0;A.keywordPatternRe.lastIndex=0;let e=A.keywordPatternRe.exec(R),n="";while(e){n+=R.substring(t,e.index);const r=c(A,e);if(r){const[t,o]=r;if(T.addText(n),n="",z+=o,t.startsWith("_"))n+=e[0];else{const n=O.classNameAliases[t]||t;T.addKeyword(e[0],n)}}else n+=e[0];t=A.keywordPatternRe.lastIndex,e=A.keywordPatternRe.exec(R)}n+=R.substr(t),T.addText(n)}function u(){if(""===R)return;let t=null;if("string"===typeof A.subLanguage){if(!e[A.subLanguage])return void T.addText(R);t=g(A.subLanguage,R,!0,D[A.subLanguage]),D[A.subLanguage]=t.top}else t=w(R,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(z+=t.relevance),T.addSublanguage(t.emitter,t.language)}function p(){null!=A.subLanguage?u():d(),R=""}function m(t){return t.className&&T.openNode(O.classNameAliases[t.className]||t.className),A=Object.create(t,{parent:{value:A}}),A}function y(t,e,n){let r=v(t.endRe,n);if(r){if(t["on:end"]){const n=new s(t);t["on:end"](e,n),n.isMatchIgnored&&(r=!1)}if(r){while(t.endsParent&&t.parent)t=t.parent;return t}}if(t.endsWithParent)return y(t.parent,e,n)}function b(t){return 0===A.matcher.regexIndex?(R+=t[0],1):(P=!0,0)}function x(t){const e=t[0],n=t.rule,r=new s(n),o=[n.__beforeBegin,n["on:begin"]];for(const i of o)if(i&&(i(t,r),r.isMatchIgnored))return b(e);return n&&n.endSameAsBegin&&(n.endRe=f(e)),n.skip?R+=e:(n.excludeBegin&&(R+=e),p(),n.returnBegin||n.excludeBegin||(R=e)),m(n),n.returnBegin?0:e.length}function k(t){const e=t[0],r=n.substr(t.index),o=y(A,t,r);if(!o)return bt;const i=A;i.skip?R+=e:(i.returnEnd||i.excludeEnd||(R+=e),p(),i.excludeEnd&&(R=e));do{A.className&&T.closeNode(),A.skip||A.subLanguage||(z+=A.relevance),A=A.parent}while(A!==o.parent);return o.starts&&(o.endSameAsBegin&&(o.starts.endRe=o.endRe),m(o.starts)),i.returnEnd?0:e.length}function S(){const t=[];for(let e=A;e!==O;e=e.parent)e.className&&t.unshift(e.className);t.forEach((t=>T.openNode(t)))}let C={};function M(e,r){const s=r&&r[0];if(R+=e,null==s)return p(),0;if("begin"===C.type&&"end"===r.type&&C.index===r.index&&""===s){if(R+=n.slice(r.index,r.index+1),!i){const e=new Error("0 width match regex");throw e.languageName=t,e.badRule=C.rule,e}return 1}if(C=r,"begin"===r.type)return x(r);if("illegal"===r.type&&!o){const t=new Error('Illegal lexeme "'+s+'" for mode "'+(A.className||"<unnamed>")+'"');throw t.mode=A,t}if("end"===r.type){const t=k(r);if(t!==bt)return t}if("illegal"===r.type&&""===s)return 1;if(I>1e5&&I>3*r.index){const t=new Error("potential infinite loop, way more iterations than matches");throw t}return R+=s,s.length}const O=$(t);if(!O)throw mt(a.replace("{}",t)),new Error('Unknown language: "'+t+'"');const N=ot(O,{plugins:r});let E="",A=l||N;const D={},T=new h.__emitter(h);S();let R="",z=0,_=0,I=0,P=!1;try{for(A.matcher.considerAll();;){I++,P?P=!1:A.matcher.considerAll(),A.matcher.lastIndex=_;const t=A.matcher.exec(n);if(!t)break;const e=n.substring(_,t.index),r=M(e,t);_=t.index+r}return M(n.substr(_)),T.closeAllNodes(),T.finalize(),E=T.toHTML(),{relevance:Math.floor(z),value:E,language:t,illegal:!1,emitter:T,top:A}}catch(B){if(B.message&&B.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:B.message,context:n.slice(_-100,_+100),mode:B.mode},sofar:E,relevance:0,value:wt(n),emitter:T};if(i)return{illegal:!1,relevance:0,value:wt(n),emitter:T,language:t,top:A,errorRaised:B};throw B}}function y(t){const e={relevance:0,emitter:new h.__emitter(h),value:wt(t),illegal:!1,top:c};return e.emitter.addText(t),e}function w(t,n){n=n||h.languages||Object.keys(e);const r=y(t),o=n.filter($).filter(B).map((e=>g(e,t,!1)));o.unshift(r);const i=o.sort(((t,e)=>{if(t.relevance!==e.relevance)return e.relevance-t.relevance;if(t.language&&e.language){if($(t.language).supersetOf===e.language)return 1;if($(e.language).supersetOf===t.language)return-1}return 0})),[s,l]=i,a=s;return a.second_best=l,a}function b(t){return h.tabReplace||h.useBR?t.replace(l,(t=>"\n"===t?h.useBR?"<br>":t:h.tabReplace?t.replace(/\t/g,h.tabReplace):t)):t}function x(t,e,r){const o=e?n[e]:r;t.classList.add("hljs"),o&&t.classList.add(o)}const k={"before:highlightElement":({el:t})=>{h.useBR&&(t.innerHTML=t.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,"\n"))},"after:highlightElement":({result:t})=>{h.useBR&&(t.value=t.value.replace(/\n/g,"<br>"))}},S=/^(<[^>]+>|\t)+/gm,C={"after:highlightElement":({result:t})=>{h.tabReplace&&(t.value=t.value.replace(S,(t=>t.replace(/\t/g,h.tabReplace))))}};function M(t){let e=null;const n=u(t);if(d(n))return;L("before:highlightElement",{el:t,language:n}),e=t;const r=e.textContent,o=n?m(r,{language:n,ignoreIllegals:!0}):w(r);L("after:highlightElement",{el:t,result:o,text:r}),t.innerHTML=o.value,x(t,n,o.language),t.result={language:o.language,re:o.relevance,relavance:o.relevance},o.second_best&&(t.second_best={language:o.second_best.language,re:o.second_best.relevance,relavance:o.second_best.relevance})}function O(t){t.useBR&&(yt("10.3.0","'useBR' will be removed entirely in v11.0"),yt("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")),h=vt(h,t)}const N=()=>{if(N.called)return;N.called=!0,yt("10.6.0","initHighlighting() is deprecated. Use highlightAll() instead.");const t=document.querySelectorAll("pre code");t.forEach(M)};function E(){yt("10.6.0","initHighlightingOnLoad() is deprecated. Use highlightAll() instead."),A=!0}let A=!1;function D(){if("loading"===document.readyState)return void(A=!0);const t=document.querySelectorAll("pre code");t.forEach(M)}function T(){A&&D()}function R(n,r){let o=null;try{o=r(t)}catch(s){if(mt("Language definition for '{}' could not be registered.".replace("{}",n)),!i)throw s;mt(s),o=c}o.name||(o.name=n),e[n]=o,o.rawDefinition=r.bind(null,t),o.aliases&&P(o.aliases,{languageName:n})}function z(t){delete e[t];for(const e of Object.keys(n))n[e]===t&&delete n[e]}function _(){return Object.keys(e)}function I(t){yt("10.4.0","requireLanguage will be removed entirely in v11."),yt("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844");const e=$(t);if(e)return e;const n=new Error("The '{}' language is required, but not loaded.".replace("{}",t));throw n}function $(t){return t=(t||"").toLowerCase(),e[t]||e[n[t]]}function P(t,{languageName:e}){"string"===typeof t&&(t=[t]),t.forEach((t=>{n[t.toLowerCase()]=e}))}function B(t){const e=$(t);return e&&!e.disableAutodetect}function V(t){t["before:highlightBlock"]&&!t["before:highlightElement"]&&(t["before:highlightElement"]=e=>{t["before:highlightBlock"](Object.assign({block:e.el},e))}),t["after:highlightBlock"]&&!t["after:highlightElement"]&&(t["after:highlightElement"]=e=>{t["after:highlightBlock"](Object.assign({block:e.el},e))})}function F(t){V(t),r.push(t)}function L(t,e){const n=t;r.forEach((function(t){t[n]&&t[n](e)}))}function j(t){return yt("10.2.0","fixMarkup will be removed entirely in v11.0"),yt("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"),b(t)}function H(t){return yt("10.7.0","highlightBlock will be removed entirely in v12.0"),yt("10.7.0","Please use highlightElement now."),M(t)}"undefined"!==typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",T,!1),Object.assign(t,{highlight:m,highlightAuto:w,highlightAll:D,fixMarkup:j,highlightElement:M,highlightBlock:H,configure:O,initHighlighting:N,initHighlightingOnLoad:E,registerLanguage:R,unregisterLanguage:z,listLanguages:_,getLanguage:$,registerAliases:P,requireLanguage:I,autoDetection:B,inherit:vt,addPlugin:F,vuePlugin:ct(t).VuePlugin}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=lt;for(const s in K)"object"===typeof K[s]&&o(K[s]);return Object.assign(t,K),t.addPlugin(k),t.addPlugin(ht),t.addPlugin(C),t};var kt=xt({});t.exports=kt},4304:function(t,e,n){"use strict";n(7658);var r=n(1154),o=n(5785);d.prototype.addText=f,d.prototype.addKeyword=u,d.prototype.addSublanguage=p,d.prototype.openNode=m,d.prototype.closeNode=g,d.prototype.closeAllNodes=w,d.prototype.finalize=w,d.prototype.toHTML=y;var i="hljs-";function s(t,e,n){var s,l=r.configure({}),a=n||{},c=a.prefix;if("string"!==typeof t)throw o("Expected `string` for name, got `%s`",t);if(!r.getLanguage(t))throw o("Unknown language: `%s` is not registered",t);if("string"!==typeof e)throw o("Expected `string` for value, got `%s`",e);if(null!==c&&void 0!==c||i,r.configure({__emitter:d,classPrefix:c}),r.highlight(e,{language:t,ignoreIllegals:!0}),r.configure(l||{}),s.errorRaised)throw s.errorRaised;return{relevance:s.relevance,language:s.language,value:s.emitter.rootNode.children}}function l(t,e){var n,l,a,c,h=e||{},d=h.subset||r.listLanguages(),u=h.prefix,p=d.length,f=-1;if(null!==u&&void 0!==u||i,"string"!==typeof t)throw o("Expected `string` for value, got `%s`",t);({relevance:0,language:null,value:[]}),{relevance:0,language:null,value:[]};while(++f<p)d[f],r.getLanguage(c)&&(s(c,t,e),a.language=c,a.relevance>l.relevance&&a,a.relevance>n.relevance&&(n,a));return l.language&&(n.secondBest=l),n}function a(t,e){r.registerLanguage(t,e)}function c(){return r.listLanguages()}function h(t,e){var n,o=t;for(n in e&&({},o[t]=e),o)r.registerAliases(o[n],{languageName:n})}function d(t){this.options=t,this.rootNode={children:[]},this.stack=[this.rootNode]}function u(t,e){this.openNode(e),this.addText(t),this.closeNode()}function p(t,e){var n=this.stack,r=n[n.length-1],o=t.rootNode.children,i=e?{type:"element",tagName:"span",properties:{className:[e]},children:o}:o;r.children=r.children.concat(i)}function f(t){var e,n,r=this.stack;""!==t&&(e=r[r.length-1],n=e.children[e.children.length-1],n&&"text"===n.type?n.value+=t:e.children.push({type:"text",value:t}))}function m(t){var e=this.stack,n=this.options.classPrefix+t,r=e[e.length-1],o={type:"element",tagName:"span",properties:{className:[n]},children:[]};r.children.push(o),e.push(o)}function g(){this.stack.pop()}function y(){return""}function w(){}},9662:function(t,e,n){var r=n(614),o=n(6330),i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not a function")}},9670:function(t,e,n){var r=n(111),o=String,i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not an object")}},1318:function(t,e,n){var r=n(5656),o=n(1400),i=n(6244),s=function(t){return function(e,n,s){var l,a=r(e),c=i(a),h=o(s,c);if(t&&n!=n){while(c>h)if(l=a[h++],l!=l)return!0}else for(;c>h;h++)if((t||h in a)&&a[h]===n)return t||h||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},3658:function(t,e,n){"use strict";var r=n(9781),o=n(3157),i=TypeError,s=Object.getOwnPropertyDescriptor,l=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=l?function(t,e){if(o(t)&&!s(t,"length").writable)throw i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4326:function(t,e,n){var r=n(1702),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},9920:function(t,e,n){var r=n(2597),o=n(3887),i=n(1236),s=n(3070);t.exports=function(t,e,n){for(var l=o(e),a=s.f,c=i.f,h=0;h<l.length;h++){var d=l[h];r(t,d)||n&&r(n,d)||a(t,d,c(e,d))}}},8880:function(t,e,n){var r=n(9781),o=n(3070),i=n(9114);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},8052:function(t,e,n){var r=n(614),o=n(3070),i=n(6339),s=n(3072);t.exports=function(t,e,n,l){l||(l={});var a=l.enumerable,c=void 0!==l.name?l.name:e;if(r(n)&&i(n,c,l),l.global)a?t[e]=n:s(e,n);else{try{l.unsafe?t[e]&&(a=!0):delete t[e]}catch(h){}a?t[e]=n:o.f(t,e,{value:n,enumerable:!1,configurable:!l.nonConfigurable,writable:!l.nonWritable})}return t}},3072:function(t,e,n){var r=n(7854),o=Object.defineProperty;t.exports=function(t,e){try{o(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},5117:function(t,e,n){"use strict";var r=n(6330),o=TypeError;t.exports=function(t,e){if(!delete t[e])throw o("Cannot delete property "+r(e)+" of "+r(t))}},9781:function(t,e,n){var r=n(7293);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:function(t){var e="object"==typeof document&&document.all,n="undefined"==typeof e&&void 0!==e;t.exports={all:e,IS_HTMLDDA:n}},317:function(t,e,n){var r=n(7854),o=n(111),i=r.document,s=o(i)&&o(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},7207:function(t){var e=TypeError,n=9007199254740991;t.exports=function(t){if(t>n)throw e("Maximum allowed index exceeded");return t}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,n){var r,o,i=n(7854),s=n(8113),l=i.process,a=i.Deno,c=l&&l.versions||a&&a.version,h=c&&c.v8;h&&(r=h.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&s&&(r=s.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),t.exports=o},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,n){var r=n(7854),o=n(1236).f,i=n(8880),s=n(8052),l=n(3072),a=n(9920),c=n(4705);t.exports=function(t,e){var n,h,d,u,p,f,m=t.target,g=t.global,y=t.stat;if(h=g?r:y?r[m]||l(m,{}):(r[m]||{}).prototype,h)for(d in e){if(p=e[d],t.dontCallGetSet?(f=o(h,d),u=f&&f.value):u=h[d],n=c(g?d:m+(y?".":"#")+d,t.forced),!n&&void 0!==u){if(typeof p==typeof u)continue;a(p,u)}(t.sham||u&&u.sham)&&i(p,"sham",!0),s(h,d,p,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,n){var r=n(7293);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,n){var r=n(4374),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},6530:function(t,e,n){var r=n(9781),o=n(2597),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,l=o(i,"name"),a=l&&"something"===function(){}.name,c=l&&(!r||r&&s(i,"name").configurable);t.exports={EXISTS:l,PROPER:a,CONFIGURABLE:c}},1702:function(t,e,n){var r=n(4374),o=Function.prototype,i=o.call,s=r&&o.bind.bind(i,i);t.exports=r?s:function(t){return function(){return i.apply(t,arguments)}}},5005:function(t,e,n){var r=n(7854),o=n(614),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t]):r[t]&&r[t][e]}},8173:function(t,e,n){var r=n(9662),o=n(8554);t.exports=function(t,e){var n=t[e];return o(n)?void 0:r(n)}},7854:function(t,e,n){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},2597:function(t,e,n){var r=n(1702),o=n(7908),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,n){var r=n(9781),o=n(7293),i=n(317);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,n){var r=n(1702),o=n(7293),i=n(4326),s=Object,l=r("".split);t.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?l(t,""):s(t)}:s},2788:function(t,e,n){var r=n(1702),o=n(614),i=n(5465),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return s(t)}),t.exports=i.inspectSource},9909:function(t,e,n){var r,o,i,s=n(4811),l=n(7854),a=n(111),c=n(8880),h=n(2597),d=n(5465),u=n(6200),p=n(3501),f="Object already initialized",m=l.TypeError,g=l.WeakMap,y=function(t){return i(t)?o(t):r(t,{})},w=function(t){return function(e){var n;if(!a(e)||(n=o(e)).type!==t)throw m("Incompatible receiver, "+t+" required");return n}};if(s||d.state){var v=d.state||(d.state=new g);v.get=v.get,v.has=v.has,v.set=v.set,r=function(t,e){if(v.has(t))throw m(f);return e.facade=t,v.set(t,e),e},o=function(t){return v.get(t)||{}},i=function(t){return v.has(t)}}else{var b=u("state");p[b]=!0,r=function(t,e){if(h(t,b))throw m(f);return e.facade=t,c(t,b,e),e},o=function(t){return h(t,b)?t[b]:{}},i=function(t){return h(t,b)}}t.exports={set:r,get:o,has:i,enforce:y,getterFor:w}},3157:function(t,e,n){var r=n(4326);t.exports=Array.isArray||function(t){return"Array"==r(t)}},614:function(t,e,n){var r=n(4154),o=r.all;t.exports=r.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},4705:function(t,e,n){var r=n(7293),o=n(614),i=/#|\.prototype\./,s=function(t,e){var n=a[l(t)];return n==h||n!=c&&(o(e)?r(e):!!e)},l=s.normalize=function(t){return String(t).replace(i,".").toLowerCase()},a=s.data={},c=s.NATIVE="N",h=s.POLYFILL="P";t.exports=s},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,n){var r=n(614),o=n(4154),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:r(t)||t===i}:function(t){return"object"==typeof t?null!==t:r(t)}},1913:function(t){t.exports=!1},2190:function(t,e,n){var r=n(5005),o=n(614),i=n(7976),s=n(3307),l=Object;t.exports=s?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,l(t))}},6244:function(t,e,n){var r=n(7466);t.exports=function(t){return r(t.length)}},6339:function(t,e,n){var r=n(1702),o=n(7293),i=n(614),s=n(2597),l=n(9781),a=n(6530).CONFIGURABLE,c=n(2788),h=n(9909),d=h.enforce,u=h.get,p=String,f=Object.defineProperty,m=r("".slice),g=r("".replace),y=r([].join),w=l&&!o((function(){return 8!==f((function(){}),"length",{value:8}).length})),v=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===m(p(e),0,7)&&(e="["+g(p(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||a&&t.name!==e)&&(l?f(t,"name",{value:e,configurable:!0}):t.name=e),w&&n&&s(n,"arity")&&t.length!==n.arity&&f(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?l&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=d(t);return s(r,"source")||(r.source=y(v,"string"==typeof e?e:"")),t};Function.prototype.toString=b((function(){return i(this)&&u(this).source||c(this)}),"toString")},4758:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},3070:function(t,e,n){var r=n(9781),o=n(4664),i=n(3353),s=n(9670),l=n(4948),a=TypeError,c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,d="enumerable",u="configurable",p="writable";e.f=r?i?function(t,e,n){if(s(t),e=l(e),s(n),"function"===typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var r=h(t,e);r&&r[p]&&(t[e]=n.value,n={configurable:u in n?n[u]:r[u],enumerable:d in n?n[d]:r[d],writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(s(t),e=l(e),s(n),o)try{return c(t,e,n)}catch(r){}if("get"in n||"set"in n)throw a("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},1236:function(t,e,n){var r=n(9781),o=n(6916),i=n(5296),s=n(9114),l=n(5656),a=n(4948),c=n(2597),h=n(4664),d=Object.getOwnPropertyDescriptor;e.f=r?d:function(t,e){if(t=l(t),e=a(e),h)try{return d(t,e)}catch(n){}if(c(t,e))return s(!o(i.f,t,e),t[e])}},8006:function(t,e,n){var r=n(6324),o=n(748),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},7976:function(t,e,n){var r=n(1702);t.exports=r({}.isPrototypeOf)},6324:function(t,e,n){var r=n(1702),o=n(2597),i=n(5656),s=n(1318).indexOf,l=n(3501),a=r([].push);t.exports=function(t,e){var n,r=i(t),c=0,h=[];for(n in r)!o(l,n)&&o(r,n)&&a(h,n);while(e.length>c)o(r,n=e[c++])&&(~s(h,n)||a(h,n));return h}},5296:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);e.f=o?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},2140:function(t,e,n){var r=n(6916),o=n(614),i=n(111),s=TypeError;t.exports=function(t,e){var n,l;if("string"===e&&o(n=t.toString)&&!i(l=r(n,t)))return l;if(o(n=t.valueOf)&&!i(l=r(n,t)))return l;if("string"!==e&&o(n=t.toString)&&!i(l=r(n,t)))return l;throw s("Can't convert object to primitive value")}},3887:function(t,e,n){var r=n(5005),o=n(1702),i=n(8006),s=n(5181),l=n(9670),a=o([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=i.f(l(t)),n=s.f;return n?a(e,n(t)):e}},4488:function(t,e,n){var r=n(8554),o=TypeError;t.exports=function(t){if(r(t))throw o("Can't call method on "+t);return t}},6200:function(t,e,n){var r=n(2309),o=n(9711),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,e,n){var r=n(7854),o=n(3072),i="__core-js_shared__",s=r[i]||o(i,{});t.exports=s},2309:function(t,e,n){var r=n(1913),o=n(5465);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.29.1",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,n){var r=n(7392),o=n(7293);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},1400:function(t,e,n){var r=n(9303),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},5656:function(t,e,n){var r=n(8361),o=n(4488);t.exports=function(t){return r(o(t))}},9303:function(t,e,n){var r=n(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},7466:function(t,e,n){var r=n(9303),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},7908:function(t,e,n){var r=n(4488),o=Object;t.exports=function(t){return o(r(t))}},7593:function(t,e,n){var r=n(6916),o=n(111),i=n(2190),s=n(8173),l=n(2140),a=n(5112),c=TypeError,h=a("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,a=s(t,h);if(a){if(void 0===e&&(e="default"),n=r(a,t,e),!o(n)||i(n))return n;throw c("Can't convert object to primitive value")}return void 0===e&&(e="number"),l(t,e)}},4948:function(t,e,n){var r=n(7593),o=n(2190);t.exports=function(t){var e=r(t,"string");return o(e)?e:e+""}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(n){return"Object"}}},9711:function(t,e,n){var r=n(1702),o=0,i=Math.random(),s=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+s(++o+i,36)}},3307:function(t,e,n){var r=n(6293);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,n){var r=n(9781),o=n(7293);t.exports=r&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,n){var r=n(7854),o=n(614),i=r.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},5112:function(t,e,n){var r=n(7854),o=n(2309),i=n(2597),s=n(9711),l=n(6293),a=n(3307),c=r.Symbol,h=o("wks"),d=a?c["for"]||c:c&&c.withoutSetter||s;t.exports=function(t){return i(h,t)||(h[t]=l&&i(c,t)?c[t]:d("Symbol."+t)),h[t]}},7658:function(t,e,n){"use strict";var r=n(2109),o=n(7908),i=n(6244),s=n(3658),l=n(7207),a=n(7293),c=a((function(){return 4294967297!==[].push.call({length:4294967296},1)})),h=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},d=c||!h();r({target:"Array",proto:!0,arity:1,forced:d},{push:function(t){var e=o(this),n=i(e),r=arguments.length;l(n+r);for(var a=0;a<r;a++)e[n]=arguments[a],n++;return s(e,n),n}})},541:function(t,e,n){"use strict";var r=n(2109),o=n(7908),i=n(6244),s=n(3658),l=n(5117),a=n(7207),c=1!==[].unshift(0),h=function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(t){return t instanceof TypeError}},d=c||!h();r({target:"Array",proto:!0,arity:1,forced:d},{unshift:function(t){var e=o(this),n=i(e),r=arguments.length;if(r){a(n+r);var c=n;while(c--){var h=c+r;c in e?e[h]=e[c]:l(e,h)}for(var d=0;d<r;d++)e[d]=arguments[d]}return s(e,n+r)}})},2740:function(e){"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}!function(){r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,{a:e}),e}}(),function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.p=""}();var o={};return function(){"use strict";if("undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}r(7658);var n=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tiptap-editor"},[e("editor-menu-bar",{attrs:{editor:t.editor},scopedSlots:t._u([{key:"default",fn:function({commands:n,isActive:r}){return[e("div",{staticClass:"menubar"},[e("div",{staticClass:"toolbar"},[e("button",{staticClass:"menubar__button",class:{"is-active":r.heading({level:1})},on:{click:function(t){return n.heading({level:1})}}},[t._v(" H1 ")]),e("button",{staticClass:"menubar__button",class:{"is-active":r.heading({level:2})},on:{click:function(t){return n.heading({level:2})}}},[t._v(" H2 ")]),e("button",{staticClass:"menubar__button",class:{"is-active":r.heading({level:3})},on:{click:function(t){return n.heading({level:3})}}},[t._v(" H3 ")]),e("button",{staticClass:"menubar__button",class:{"is-active":r.bullet_list()},on:{click:n.bullet_list}},[e("icon",{attrs:{name:"ul"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.ordered_list()},on:{click:n.ordered_list}},[e("icon",{attrs:{name:"ol"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.bold()},on:{click:n.bold}},[e("icon",{attrs:{name:"bold"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.italic()},on:{click:n.italic}},[e("icon",{attrs:{name:"italic"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.strike()},on:{click:n.strike}},[e("icon",{attrs:{name:"strike"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.underline()},on:{click:n.underline}},[e("icon",{attrs:{name:"underline"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.code()},on:{click:n.code}},[e("icon",{attrs:{name:"code"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.paragraph()},on:{click:n.paragraph}},[e("icon",{attrs:{name:"paragraph"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.blockquote()},on:{click:n.blockquote}},[e("icon",{attrs:{name:"quote"}})],1),e("button",{staticClass:"menubar__button",class:{"is-active":r.code_block()},on:{click:n.code_block}},[e("icon",{attrs:{name:"code_block"}})],1),e("button",{staticClass:"menubar__button",on:{click:function(t){return n.createTable({rowsCount:3,colsCount:3,withHeaderRow:!1})}}},[e("icon",{attrs:{name:"table"}})],1),r.table()?e("span",[e("button",{staticClass:"menubar__button",on:{click:n.deleteTable}},[e("icon",{attrs:{name:"delete_table"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.addColumnBefore}},[e("icon",{attrs:{name:"add_col_before"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.addColumnAfter}},[e("icon",{attrs:{name:"add_col_after"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.deleteColumn}},[e("icon",{attrs:{name:"delete_col"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.addRowBefore}},[e("icon",{attrs:{name:"add_row_before"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.addRowAfter}},[e("icon",{attrs:{name:"add_row_after"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.deleteRow}},[e("icon",{attrs:{name:"delete_row"}})],1),e("button",{staticClass:"menubar__button",on:{click:n.toggleCellMerge}},[e("icon",{attrs:{name:"combine_cells"}})],1)]):t._e()])])]}}])}),e("editor-content",{staticClass:"tiptap-editor__content",attrs:{editor:t.editor}})],1)},o=[];function i(t){this.content=t}i.prototype={constructor:i,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),s=r.content.slice();return-1==o?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new i(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new i(n)},addToStart:function(t,e){return new i([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new i(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(-1==s?o.length:s,0,e,n),new i(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=i.from(t),t.size?new i(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=i.from(t),t.size?new i(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=i.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach((function(e,n){t[e]=n})),t},get size(){return this.content.length>>1}},i.from=function(t){if(t instanceof i)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new i(e)};var s=i;function l(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let t=0;o.text[t]==i.text[t];t++)n++;return n}if(o.content.size||i.content.size){let t=l(o.content,i.content,n+1);if(null!=t)return t}n+=o.nodeSize}else n+=o.nodeSize}}function a(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),c=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let t=0,e=Math.min(s.text.length,l.text.length);while(t<e&&s.text[s.text.length-t-1]==l.text[l.text.length-t-1])t++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let t=a(s.content,l.content,n-1,r-1);if(t)return t}n-=c,r-=c}else n-=c,r-=c}}class c{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,e,n,r=0,o){for(let i=0,s=0;s<e;i++){let l=this.content[i],a=s+l.nodeSize;if(a>t&&!1!==n(l,r+s,o||null,i)&&l.content.size){let o=s+1;l.nodesBetween(Math.max(0,t-o),Math.min(l.content.size,e-o),n,r+o)}s=a}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let o="",i=!0;return this.nodesBetween(t,e,((s,l)=>{s.isText?(o+=s.text.slice(Math.max(t,l)-l,e-l),i=!n):s.isLeaf?(r?o+="function"===typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new c(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let o=0,i=0;i<e;o++){let s=this.content[o],l=i+s.nodeSize;l>t&&((i<t||l>e)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=l}return new c(n,r)}cutByIndex(t,e){return t==e?c.empty:0==t&&e==this.content.length?this:new c(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new c(r,o)}addToStart(t){return new c([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new c(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return l(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return a(this,t,e,n)}findIndex(t,e=-1){if(0==t)return d(0,t);if(t==this.size)return d(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t||e>0?d(n+1,i):d(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return c.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new c(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return c.empty;let e,n=0;for(let r=0;r<t.length;r++){let o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new c(e||t,n)}static from(t){if(!t)return c.empty;if(t instanceof c)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new c([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}c.empty=new c([],0);const h={index:0,offset:0};function d(t,e){return h.index=t,h.offset=e,h}function u(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!u(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!u(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class p{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);return n.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return p.none;if(t instanceof p)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}p.none=[];class f extends Error{}class m{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=y(this.content,t+this.openStart,e);return n&&new m(n,this.openStart,this.openEnd)}removeBetween(t,e){return new m(g(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return m.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new m(c.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=t.lastChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.lastChild)r++;return new m(t,n,r)}}function g(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(g(i.content,e-o-1,n-o-1)))}function y(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=y(s.content,e-i-1,n);return l&&t.replaceChild(o,s.copy(l))}function w(t,e,n){if(n.openStart>t.depth)throw new f("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new f("Inconsistent open depths");return v(t,e,n,0)}function v(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=v(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:o,end:s}=N(n,t);return C(i,M(t,o,s,e,r))}{let r=t.parent,o=r.content;return C(r,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}}return C(i,O(t,e,r))}function b(t,e){if(!e.type.compatibleContent(t.type))throw new f("Cannot join "+e.type.name+" onto "+t.type.name)}function x(t,e,n){let r=t.node(n);return b(r,e.node(n)),r}function k(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function S(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(k(t.nodeAfter,r),i++));for(let l=i;l<s;l++)k(o.child(l),r);e&&e.depth==n&&e.textOffset&&k(e.nodeBefore,r)}function C(t,e){return t.type.checkContent(e),t.copy(e)}function M(t,e,n,r,o){let i=t.depth>o&&x(t,e,o+1),s=r.depth>o&&x(n,r,o+1),l=[];return S(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(b(i,s),k(C(i,M(t,e,n,r,o+1)),l)):(i&&k(C(i,O(t,e,o+1)),l),S(e,n,o,l),s&&k(C(s,O(n,r,o+1)),l)),S(r,null,o,l),new c(l)}function O(t,e,n){let r=[];if(S(null,t,n,r),t.depth>n){let o=x(t,e,n+1);k(C(o,O(t,e,n+1)),r)}return S(e,null,n,r),new c(r)}function N(t,e){let n=e.depth-t.openStart,r=e.node(n),o=r.copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(c.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}m.empty=new m(c.empty,0,0);class E{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return t=this.resolveDepth(t),0==t?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let o=0;o<t;o++)r+=n.child(o).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new R(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,o=e;for(let i=t;;){let{index:t,offset:e}=i.content.findIndex(o),s=o-e;if(n.push(i,t,r+e),!s)break;if(i=i.child(t),i.isText)break;o=s-1,r+=e+1}return new E(e,n,o)}static resolveCached(t,e){for(let r=0;r<A.length;r++){let n=A[r];if(n.pos==e&&n.doc==t)return n}let n=A[D]=E.resolve(t,e);return D=(D+1)%T,n}}let A=[],D=0,T=12;class R{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const z=Object.create(null);class _{constructor(t,e,n,r=p.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||c.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||z)&&p.sameSet(this.marks,n||p.none)}copy(t=null){return t==this.content?this:new _(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new _(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return m.empty;let r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),l=r.node(i),a=l.content.cut(r.pos-s,o.pos-s);return new m(a,r.depth-i,o.depth-i)}replace(t,e,n){return w(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return E.resolveCached(this,t)}resolveNoCache(t){return E.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),$(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=c.empty,r=0,o=n.childCount){let i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let l=r;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=p.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!p.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=c.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)}}_.prototype.text=void 0;class I extends _{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new I(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new I(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function $(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class P{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new B(t,e);if(null==n.next)return P.empty;let r=V(n);n.next&&n.err("Unexpected trailing text");let o=G(q(r));return X(o,n),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];function o(i,s){let l=i.matchFragment(t,n);if(l&&(!e||l.validEnd))return c.from(s.map((t=>t.createAndFill())));for(let t=0;t<i.next.length;t++){let{type:e,next:n}=i.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=o(n,s.concat(e));if(t)return t}}return null}return o(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];while(n.length){let r=n.shift(),o=r.match;if(o.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<o.next.length;t++){let{type:i,next:s}=o.next[t];i.isLeaf||i.hasRequiredAttrs()||i.name in e||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),e[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}return e(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let o=0;o<e.next.length;o++)r+=(o?", ":"")+e.next[o].type.name+"->"+t.indexOf(e.next[o].next);return r})).join("\n")}}P.empty=new P(!0);class B{constructor(t,e){this.string=t,this.nodeTypes=e,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()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function V(t){let e=[];do{e.push(F(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function F(t){let e=[];do{e.push(L(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function L(t){let e=W(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=H(t,e)}return e}function j(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function H(t,e){let n=j(t),r=n;return t.eat(",")&&(r="}"!=t.next?j(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function J(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let t=n[i];t.groups.indexOf(e)>-1&&o.push(t)}return 0==o.length&&t.err("No node type or group '"+e+"' found"),o}function W(t){if(t.eat("(")){let e=V(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=J(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}function q(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((t=>t.to=e))}function i(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(i(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(e,s),o(i(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(i(t.expr,e),s),o(i(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(e)].concat(i(t.expr,e));if("range"==t.type){let s=e;for(let e=0;e<t.min;e++){let e=n();o(i(t.expr,s),e),s=e}if(-1==t.max)o(i(t.expr,s),s);else for(let e=t.min;e<t.max;e++){let e=n();r(s,e),o(i(t.expr,s),e),s=e}return[r(s)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(t.exprs[r],e);if(r==t.exprs.length-1)return s;o(s,e=n())}}}function K(t,e){return e-t}function U(t,e){let n=[];return r(e),n.sort(K);function r(e){let o=t[e];if(1==o.length&&!o[0].term)return r(o[0].to);n.push(e);for(let t=0;t<o.length;t++){let{term:e,to:i}=o[t];e||-1!=n.indexOf(i)||r(i)}}}function G(t){let e=Object.create(null);return n(U(t,0));function n(r){let o=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<o.length;t++)o[t][0]==e&&(r=o[t][1]);U(t,n).forEach((t=>{r||o.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let i=e[r.join(",")]=new P(r.indexOf(t.length-1)>-1);for(let t=0;t<o.length;t++){let r=o[t][1].sort(K);i.next.push({type:o[t][0],next:e[r.join(",")]||n(r)})}return i}}function X(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],o=!t.validEnd,i=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Y(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Z(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(void 0===o){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=e.default}n[r]=o}return n}function Q(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new et(t[n]);return e}class tt{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Q(n.attrs),this.defaultAttrs=Y(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==P.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:Z(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _(this,this.computeAttrs(t),c.from(e),p.setFrom(n))}createChecked(t=null,e,n){return e=c.from(e),this.checkContent(e),new _(this,this.computeAttrs(t),e,p.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),e=c.from(e),e.size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),o=r&&r.fillBefore(c.empty,!0);return o?new _(this,t,e.append(o),p.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.none:t}static compile(t,e){let n=Object.create(null);t.forEach(((t,r)=>n[t]=new tt(t,e,r)));let r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class et{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class nt{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=Q(r.attrs),this.excluded=null;let o=Y(this.attrs);this.instance=o?new p(this,o):null}create(t=null){return!t&&this.instance?this.instance:new p(this,Z(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,o)=>n[t]=new nt(t,r++,e,o))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}class rt{constructor(t){this.cached=Object.create(null);let e=this.spec={};for(let r in t)e[r]=t[r];e.nodes=s.from(t.nodes),e.marks=s.from(t.marks||{}),this.nodes=tt.compile(this.spec.nodes,this),this.marks=nt.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let t=this.nodes[r],e=t.spec.content||"",o=t.spec.marks;t.contentMatch=n[e]||(n[e]=P.parse(e,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==o?null:o?ot(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let r in this.marks){let t=this.marks[r],e=t.spec.excludes;t.excluded=null==e?[t]:""==e?[]:ot(this,e.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)}node(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof tt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new I(n,n.defaultAttrs,t,p.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return _.fromJSON(this,t)}markFromJSON(t){return p.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function ot(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let e in t.marks){let r=t.marks[e];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class it{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((t=>{t.tag?this.tags.push(t):t.style&&this.styles.push(t)})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new ft(this,e,!1);return n.addAll(t,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new ft(this,e,!0);return n.addAll(t,e.from,e.to),m.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(gt(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(t)||r.context&&!n.matchesContext(r.context)||i.length>t.length&&(61!=i.charCodeAt(t.length)||i.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r],o=null==t.priority?50:t.priority;if(o<n)break}e.splice(r,0,t)}for(let r in t.marks){let e=t.marks[r].spec.parseDOM;e&&e.forEach((t=>{n(t=wt(t)),t.mark||t.ignore||t.clearMark||(t.mark=r)}))}for(let r in t.nodes){let e=t.nodes[r].spec.parseDOM;e&&e.forEach((t=>{n(t=wt(t)),t.node||t.ignore||t.mark||(t.node=r)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new it(t,it.schemaRules(t)))}}const st={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},lt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},at={ol:!0,ul:!0},ct=1,ht=2,dt=4;function ut(t,e,n){return null!=e?(e?ct:0)|("full"===e?ht:0):t&&"pre"==t.whitespace?ct|ht:n&~dt}class pt{constructor(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=p.none,this.stashMarks=[],this.match=i||(s&dt?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(c.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&ct)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=c.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(c.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,n=this.pendingMarks;e<n.length;e++){let r=n[e];(this.type?this.type.allowsMarkType(r.type):vt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!st.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class ft{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let r,o=e.topNode,i=ut(null,e.preserveWhitespace,0)|(n?dt:0);r=o?new pt(o.type,o.attrs,p.none,p.none,!0,e.topMatch||o.type.contentMatch,i):new pt(n?null:t.schema.topNodeType,null,p.none,p.none,!0,null,i),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){let e=t.getAttribute("style");if(e){let n=this.readStyles(yt(e));if(!n)return;let[r,o]=n,i=this.top;for(let t=0;t<o.length;t++)this.removePendingMark(o[t],i);for(let t=0;t<r.length;t++)this.addPendingMark(r[t]);this.addElement(t);for(let t=0;t<r.length;t++)this.removePendingMark(r[t],i);for(let t=0;t<o.length;t++)this.addPendingMark(o[t])}else this.addElement(t)}}addTextNode(t){let e=t.nodeValue,n=this.top;if(n.options&ht||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(n.options&ct)e=n.options&ht?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)}addElement(t,e){let n,r=t.nodeName.toLowerCase();at.hasOwnProperty(r)&&this.parser.normalizeLists&&mt(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:lt.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let e,n=this.top,i=this.needsBlock;if(st.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),e=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),e&&this.sync(n),this.needsBlock=i}else this.addElementByRule(t,o,!1===o.consuming?n:void 0)}leafFallback(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))}ignoreFallback(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=p.none,n=p.none;t:for(let r=0;r<t.length;r+=2)for(let o;;){let i=this.parser.matchStyle(t[r],t[r+1],this,o);if(!i)continue t;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.forEach((t=>{i.clearMark(t)&&(n=t.addToSet(n))})):e=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(e),!1!==i.consuming)break;o=i}return[e,n]}addElementByRule(t,e,n){let r,o,i;if(e.node)o=this.parser.schema.nodes[e.node],o.isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs||null,e.preserveWhitespace);else{let t=this.parser.schema.marks[e.mark];i=t.create(e.attrs),this.addPendingMark(i)}let s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t)));else{let n=t;"string"==typeof e.contentElement?n=t.querySelector(e.contentElement):"function"==typeof e.contentElement?n=e.contentElement(t):e.contentElement&&(n=e.contentElement),this.findAround(t,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(t,e,n){let r=e||0;for(let o=e?t.childNodes[e]:t.firstChild,i=null==n?null:t.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(o);this.findAtPoint(t,r)}findPlace(t){let e,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(let r=0;r<e.length;r++)this.enterInner(e[r],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let n=e.activeMarks;for(let r=0;r<t.marks.length;r++)e.type&&!e.type.allowsMarkType(t.marks[r].type)||(n=t.marks[r].addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n){let r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r}enterInner(t,e=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let i=ut(t,r,o.options);o.options&dt&&0==o.content.length&&(i|=dt),this.nodes.push(new pt(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){let t=e.compareDocumentPosition(this.find[r].node);t&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(t,s)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;s>=o;s--)if(i(t-1,s))return!0;return!1}{let t=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!t||t.name!=l&&-1==t.groups.indexOf(l))return!1;s--}}return!0};return i(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(t){let e=bt(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let n=this.open;n>=0;n--){let r=this.nodes[n],o=r.pendingMarks.lastIndexOf(t);if(o>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);let e=r.popFromStashMark(t);e&&r.type&&r.type.allowsMarkType(e.type)&&(r.activeMarks=e.addToSet(r.activeMarks))}if(r==e)break}}}function mt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&at.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}function gt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function yt(t){let e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];while(e=n.exec(t))r.push(e[1],e[2].trim());return r}function wt(t){let e={};for(let n in t)e[n]=t[n];return e}function vt(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=t=>{i.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:o}=t.edge(n);if(r==e)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}function bt(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class xt{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=St(e).createDocumentFragment());let r=n,o=[];return t.forEach((t=>{if(o.length||t.marks.length){let n=0,i=0;while(n<o.length&&i<t.marks.length){let e=t.marks[i];if(this.marks[e.type.name]){if(!e.eq(o[n][0])||!1===e.type.spec.spanning)break;n++,i++}else i++}while(n<o.length)r=o.pop()[1];while(i<t.marks.length){let n=t.marks[i++],s=this.serializeMark(n,t.isInline,e);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=xt.renderSpec(St(e),this.nodes[t.type.name](t));if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&xt.renderSpec(St(n),r(t,e))}static renderSpec(t,e,n=null){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let r,o=e[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?t.createElementNS(n,o):t.createElement(o),l=e[1],a=1;if(l&&"object"==typeof l&&null==l.nodeType&&!Array.isArray(l)){a=2;for(let t in l)if(null!=l[t]){let e=t.indexOf(" ");e>0?s.setAttributeNS(t.slice(0,e),t.slice(e+1),l[t]):s.setAttribute(t,l[t])}}for(let c=a;c<e.length;c++){let o=e[c];if(0===o){if(c<e.length-1||c>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:e,contentDOM:i}=xt.renderSpec(t,o,n);if(s.appendChild(e),i){if(r)throw new RangeError("Multiple content holes");r=i}}}return{dom:s,contentDOM:r}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new xt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=kt(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return kt(t.marks)}}function kt(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function St(t){return t.document||window.document}r(541);const Ct=65535,Mt=Math.pow(2,16);function Ot(t,e){return t+e*Mt}function Nt(t){return t&Ct}function Et(t){return(t-(t&Ct))/Mt}const At=1,Dt=2,Tt=4,Rt=8;class zt{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(this.delInfo&Rt)>0}get deletedBefore(){return(this.delInfo&(At|Tt))>0}get deletedAfter(){return(this.delInfo&(Dt|Tt))>0}get deletedAcross(){return(this.delInfo&Tt)>0}}class _t{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&_t.empty)return _t.empty}recover(t){let e=0,n=Nt(t);if(!this.inverted)for(let r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+Et(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>t)break;let a=this.ranges[s+o],c=this.ranges[s+i],h=l+a;if(t<=h){let o=a?t==l?-1:t==h?1:e:e,i=l+r+(o<0?0:c);if(n)return i;let d=t==(e<0?l:h)?null:Ot(s/3,t-l),u=t==l?Dt:t==h?At:Tt;return(e<0?t!=l:t!=h)&&(u|=Rt),new zt(i,u,d)}r+=c-a}return n?t+r:new zt(t+r,0,null)}touches(t,e){let n=0,r=Nt(e),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let e=this.ranges[s]-(this.inverted?n:0);if(e>t)break;let l=this.ranges[s+o],a=e+l;if(t<=a&&s==3*r)return!0;n+=this.ranges[s+i]-l}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),l=i+(this.inverted?0:o),a=this.ranges[r+e],c=this.ranges[r+n];t(s,s+a,l,l+c),o+=c-a}}invert(){return new _t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?_t.empty:new _t(t<0?[0,-t,0]:[0,0,t])}}_t.empty=new _t([]);class It{constructor(t=[],e,n=0,r=t.length){this.maps=t,this.mirror=e,this.from=n,this.to=r}slice(t=0,e=this.maps.length){return new It(this.maps,this.mirror,t,e)}copy(){return new It(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,n=this.maps.length;e<t.maps.length;e++){let r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new It;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this.maps[o],i=n.mapResult(t,e);if(null!=i.recover){let e=this.getMirror(o);if(null!=e&&e>o&&e<this.to){o=e,t=this.maps[e].recover(i.recover);continue}}r|=i.delInfo,t=i.pos}return n?t:new zt(t,r,null)}}const $t=Object.create(null);class Pt{getMap(){return _t.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=$t[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in $t)throw new RangeError("Duplicate use of step JSON ID "+t);return $t[t]=e,e.prototype.jsonID=t,e}}class Bt{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Bt(t,null)}static fail(t){return new Bt(null,t)}static fromReplace(t,e,n,r){try{return Bt.ok(t.replace(e,n,r))}catch(o){if(o instanceof f)return Bt.fail(o.message);throw o}}}function Vt(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Vt(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return c.fromArray(r)}class Ft extends Pt{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new m(Vt(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),r),e.openStart,e.openEnd);return Bt.fromReplace(t,this.from,this.to,o)}invert(){return new Lt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Ft(e.pos,n.pos,this.mark)}merge(t){return t instanceof Ft&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ft(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ft(e.from,e.to,t.markFromJSON(e.mark))}}Pt.jsonID("addMark",Ft);class Lt extends Pt{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new m(Vt(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return Bt.fromReplace(t,this.from,this.to,n)}invert(){return new Ft(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Lt(e.pos,n.pos,this.mark)}merge(t){return t instanceof Lt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Lt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Lt(e.from,e.to,t.markFromJSON(e.mark))}}Pt.jsonID("removeMark",Lt);class jt extends Pt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Bt.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new m(c.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new jt(this.pos,e.marks[n]);return new jt(this.pos,this.mark)}}return new Ht(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new jt(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new jt(e.pos,t.markFromJSON(e.mark))}}Pt.jsonID("addNodeMark",jt);class Ht extends Pt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Bt.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new m(c.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new jt(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ht(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ht(e.pos,t.markFromJSON(e.mark))}}Pt.jsonID("removeNodeMark",Ht);class Jt extends Pt{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&qt(t,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new _t([this.from,this.to-this.from,this.slice.size])}invert(t){return new Jt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deletedAcross&&n.deletedAcross?null:new Jt(e.pos,Math.max(e.pos,n.pos),this.slice)}merge(t){if(!(t instanceof Jt)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?m.empty:new m(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Jt(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?m.empty:new m(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Jt(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Jt(e.from,e.to,m.fromJSON(t,e.slice),!!e.structure)}}Pt.jsonID("replace",Jt);class Wt extends Pt{constructor(t,e,n,r,o,i,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(t){if(this.structure&&(qt(t,this.from,this.gapFrom)||qt(t,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Bt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?Bt.fromReplace(t,this.from,this.to,n):Bt.fail("Content does not fit in gap")}getMap(){return new _t([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Wt(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||o>n.pos?null:new Wt(e.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Wt(e.from,e.to,e.gapFrom,e.gapTo,m.fromJSON(t,e.slice),e.insert,!!e.structure)}}function qt(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;while(o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount)i--,o--;if(o>0){let t=r.node(i).maybeChild(r.indexAfter(i));while(o>0){if(!t||t.isLeaf)return!0;t=t.firstChild,o--}}return!1}function Kt(t,e,n,r){let o,i,s=[],l=[];t.doc.nodesBetween(e,n,((t,a,c)=>{if(!t.isInline)return;let h=t.marks;if(!r.isInSet(h)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,e),d=Math.min(a+t.nodeSize,n),u=r.addToSet(h);for(let t=0;t<h.length;t++)h[t].isInSet(u)||(o&&o.to==c&&o.mark.eq(h[t])?o.to=d:s.push(o=new Lt(c,d,h[t])));i&&i.to==c?i.to=d:l.push(i=new Ft(c,d,r))}})),s.forEach((e=>t.step(e))),l.forEach((e=>t.step(e)))}function Ut(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,((t,s)=>{if(!t.isInline)return;i++;let l=null;if(r instanceof nt){let e,n=t.marks;while(e=r.isInSet(n))(l||(l=[])).push(e),n=e.removeFromSet(n)}else r?r.isInSet(t.marks)&&(l=[r]):l=t.marks;if(l&&l.length){let r=Math.min(s+t.nodeSize,n);for(let t=0;t<l.length;t++){let n,a=l[t];for(let t=0;t<o.length;t++){let e=o[t];e.step==i-1&&a.eq(o[t].style)&&(n=e)}n?(n.to=r,n.step=i):o.push({style:a,from:Math.max(s,e),to:r,step:i})}}})),o.forEach((e=>t.step(new Lt(e.from,e.to,e.style))))}function Gt(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let l=0;l<o.childCount;l++){let e=o.child(l),a=s+e.nodeSize,c=r.matchType(e.type);if(c){r=c;for(let r=0;r<e.marks.length;r++)n.allowsMarkType(e.marks[r].type)||t.step(new Lt(s,a,e.marks[r]))}else i.push(new Jt(s,a,m.empty));s=a}if(!r.validEnd){let e=r.fillBefore(c.empty,!0);t.replace(s,s,new m(e,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function Xt(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Yt(t){let e=t.parent,n=e.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let e=t.$from.node(r),o=t.$from.index(r),i=t.$to.indexAfter(r);if(r<t.depth&&e.canReplace(o,i,n))return r;if(0==r||e.type.spec.isolating||!Xt(e,o,i))break}return null}function Zt(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,h=l,d=c.empty,u=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=c.from(r.node(m).copy(d)),u++):a--;let p=c.empty,f=0;for(let m=i,g=!1;m>n;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=c.from(o.node(m).copy(p)),f++):h++;t.step(new Wt(a,h,s,l,new m(d.append(p),u,f),d.size-u,!0))}function Qt(t,e,n=null,r=t){let o=ee(t,e),i=o&&ne(r,e);return i?o.map(te).concat({type:e,attrs:n}).concat(i.map(te)):null}function te(t){return{type:t,attrs:null}}function ee(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function ne(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=s.length?s[s.length-1]:e,a=l.contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return a&&a.validEnd?s:null}function re(t,e,n){let r=c.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let t=n[s].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=c.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new Wt(o,i,o,i,new m(r,0,0),n.length,!0))}function oe(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{if(e.isTextblock&&!e.hasMarkup(r,o)&&ie(t.doc,t.mapping.slice(i).map(n),r)){t.clearIncompatible(t.mapping.slice(i).map(n,1),r);let s=t.mapping.slice(i),l=s.map(n,1),a=s.map(n+e.nodeSize,1);return t.step(new Wt(l,a,l+1,a-1,new m(c.from(r.create(o,null,e.marks)),0,0),1,!0)),!1}}))}function ie(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function se(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Wt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new m(c.from(s),0,0),1,!0))}function le(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,h=n-2;c>i;c--,h--){let t=o.node(c),e=o.index(c);if(t.type.spec.isolating)return!1;let n=t.content.cutByIndex(e,t.childCount),i=r&&r[h]||t;if(i!=t&&(n=n.replaceChild(0,i.type.create(i.attrs))),!t.canReplace(e+1,t.childCount)||!i.type.validContent(n))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function ae(t,e,n=1,r){let o=t.doc.resolve(e),i=c.empty,s=c.empty;for(let l=o.depth,a=o.depth-n,h=n-1;l>a;l--,h--){i=c.from(o.node(l).copy(i));let t=r&&r[h];s=c.from(t?t.type.create(t.attrs,s):o.node(l).copy(s))}t.step(new Jt(e,e,new m(i.append(s),n,n),!0))}function ce(t,e){let n=t.resolve(e),r=n.index();return he(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function he(t,e){return!(!t||!e||t.isLeaf||!t.canAppend(e))}function de(t,e,n){let r=new Jt(e-n,e+n,m.empty,!0);t.step(r)}function ue(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let t=r.index(o);if(r.node(o).canReplaceWith(t,t,n))return r.before(o+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let t=r.indexAfter(o);if(r.node(o).canReplaceWith(t,t,n))return r.after(o+1);if(t<r.node(o).childCount)return null}return null}function pe(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let t=r.depth;t>=0;t--){let e=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,n=r.index(t)+(e>0?1:0),s=r.node(t),l=!1;if(1==i)l=s.canReplace(n,n,o);else{let t=s.contentMatchAt(n).findWrapping(o.firstChild.type);l=t&&s.canReplaceWith(n,n,t[0])}if(l)return 0==e?r.pos:e<0?r.before(t+1):r.after(t+1)}return null}function fe(t,e,n=e,r=m.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return me(o,i,r)?new Jt(e,n,r):new ge(o,i,r).fit()}function me(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}Pt.jsonID("replaceAround",Wt);class ge{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=c.empty;for(let r=0;r<=t.depth;r++){let e=t.node(r);this.frontier.push({type:e.type,match:e.contentMatchAt(t.indexAfter(r))})}for(let r=t.depth;r>0;r--)this.placed=c.from(t.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){while(this.unplaced.size){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;while(i&&s&&1==o.childCount)o=o.firstChild.content,i--,s--;let l=new m(o,i,s);return t>-1?new Wt(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new Jt(n.pos,r.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let o=e.firstChild;if(e.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){t=n;break}e=o.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,r=null;n?(r=ve(this.unplaced.content,n-1).firstChild,t=r.content):t=this.unplaced.content;let o=t.firstChild;for(let i=this.depth;i>=0;i--){let t,{type:s,match:l}=this.frontier[i],a=null;if(1==e&&(o?l.matchType(o.type)||(a=l.fillBefore(c.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:i,parent:r,inject:a};if(2==e&&o&&(t=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:i,parent:r,wrap:t};if(r&&l.matchType(r.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ve(t,e);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new m(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ve(t,e);if(r.childCount<=1&&e>0){let o=t.size-e<=e+r.size;this.unplaced=new m(ye(t,e-1,1),e-1,o?e-1:n)}else this.unplaced=new m(ye(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:r,wrap:o}){while(this.depth>e)this.closeFrontierNode();if(o)for(let c=0;c<o.length;c++)this.openFrontierNode(o[c]);let i=this.unplaced,s=n?n.content:i.content,l=i.openStart-t,a=0,h=[],{match:d,type:u}=this.frontier[e];if(r){for(let t=0;t<r.childCount;t++)h.push(r.child(t));d=d.matchFragment(r)}let p=s.size+t-(i.content.size-i.openEnd);while(a<s.childCount){let t=s.child(a),e=d.matchType(t.type);if(!e)break;a++,(a>1||0==l||t.content.size)&&(d=e,h.push(be(t.mark(u.allowedMarks(t.marks)),1==a?l:0,a==s.childCount?p:-1)))}let f=a==s.childCount;f||(p=-1),this.placed=we(this.placed,e,c.from(h)),this.frontier[e].match=d,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let c=0,m=s;c<p;c++){let t=m.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),m=t.content}this.unplaced=f?0==t?m.empty:new m(ye(i.content,t-1,1),t-1,p<0?i.openEnd:t-1):new m(ye(i.content,t,a),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!xe(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);while(n>1&&r==this.$to.end(--n))++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),i=xe(t,e,r,n,o);if(i){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],o=xe(t,n,r,e,!0);if(!o||o.childCount)continue t}return{depth:e,fit:i,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;while(this.depth>e.depth)this.closeFrontierNode();e.fit.childCount&&(this.placed=we(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=we(this.placed,this.depth,c.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop(),e=t.match.fillBefore(c.empty,!0);e.childCount&&(this.placed=we(this.placed,this.frontier.length,e))}}function ye(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ye(t.firstChild.content,e-1,n)))}function we(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(we(t.lastChild.content,e-1,n)))}function ve(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function be(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,be(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(c.empty,!0)))),t.copy(r)}function xe(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!ke(n,i.content,s)?l:null}function ke(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Se(t){return t.spec.defining||t.spec.definingForContent}function Ce(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(me(o,i,r))return t.step(new Jt(e,n,r));let s=Ee(o,t.doc.resolve(n));0==s[s.length-1]&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let u=o.depth,p=o.pos-1;u>0;u--,p--){let t=o.node(u).type.spec;if(t.defining||t.definingAsContext||t.isolating)break;s.indexOf(u)>-1?l=u:o.before(u)==p&&s.splice(1,0,-u)}let a=s.indexOf(l),c=[],h=r.openStart;for(let u=r.content,p=0;;p++){let t=u.firstChild;if(c.push(t),p==r.openStart)break;u=t.content}for(let u=h-1;u>=0;u--){let t=c[u].type,e=Se(t);if(e&&o.node(a).type!=t)h=u;else if(e||!t.isTextblock)break}for(let u=r.openStart;u>=0;u--){let e=(u+h+1)%(r.openStart+1),l=c[e];if(l)for(let c=0;c<s.length;c++){let h=s[(c+a)%s.length],d=!0;h<0&&(d=!1,h=-h);let u=o.node(h-1),p=o.index(h-1);if(u.canReplaceWith(p,p,l.type,l.marks))return t.replace(o.before(h),d?i.after(h):n,new m(Me(r.content,0,r.openStart,e),e,r.openEnd))}}let d=t.steps.length;for(let u=s.length-1;u>=0;u--){if(t.replace(e,n,r),t.steps.length>d)break;let l=s[u];l<0||(e=o.before(l),n=i.after(l))}}function Me(t,e,n,r,o){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Me(o.content,e+1,n,r,o)))}if(e>r){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(c.empty,!0))}return t}function Oe(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=ue(t.doc,e,r.type);null!=o&&(e=n=o)}t.replaceRange(e,n,new m(c.from(r),0,0))}function Ne(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Ee(r,o);for(let s=0;s<i.length;s++){let e=i[s],n=s==i.length-1;if(n&&0==e||r.node(e).type.contentMatch.validEnd)return t.delete(r.start(e),o.end(e));if(e>0&&(n||r.node(e-1).canReplace(r.index(e-1),o.indexAfter(e-1))))return t.delete(r.before(e),o.after(e))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function Ee(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let r=t.start(o);if(r<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(r==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==r-1)&&n.push(o)}return n}class Ae extends Pt{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return Bt.fail("No node at attribute step's position");let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return Bt.fromReplace(t,this.pos,this.pos+1,new m(c.from(r),0,e.isLeaf?0:1))}getMap(){return _t.empty}invert(t){return new Ae(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ae(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ae(e.pos,e.attr,e.value)}}Pt.jsonID("attr",Ae);let De=class extends Error{};De=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},De.prototype=Object.create(Error.prototype),De.prototype.constructor=De,De.prototype.name="TransformError";class Te{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new It}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new De(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=m.empty){let r=fe(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,n){return this.replace(t,e,new m(c.from(n),0,0))}delete(t,e){return this.replace(t,e,m.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return Ce(this,t,e,n),this}replaceRangeWith(t,e,n){return Oe(this,t,e,n),this}deleteRange(t,e){return Ne(this,t,e),this}lift(t,e){return Zt(this,t,e),this}join(t,e=1){return de(this,t,e),this}wrap(t,e){return re(this,t,e),this}setBlockType(t,e=t,n,r=null){return oe(this,t,e,n,r),this}setNodeMarkup(t,e,n=null,r){return se(this,t,e,n,r),this}setNodeAttribute(t,e,n){return this.step(new Ae(t,e,n)),this}addNodeMark(t,e){return this.step(new jt(t,e)),this}removeNodeMark(t,e){if(!(e instanceof p)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(e=e.isInSet(n.marks),!e)return this}return this.step(new Ht(t,e)),this}split(t,e=1,n){return ae(this,t,e,n),this}addMark(t,e,n){return Kt(this,t,e,n),this}removeMark(t,e,n){return Ut(this,t,e,n),this}clearIncompatible(t,e,n){return Gt(this,t,e,n),this}}const Re=Object.create(null);class ze{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new _e(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=m.empty){let n=e.content.lastChild,r=null;for(let s=0;s<e.openEnd;s++)r=n,n=n.lastChild;let o=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=t.mapping.slice(o);t.replaceRange(c.map(l.pos),c.map(a.pos),s?m.empty:e),0==s&&Je(t,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],l=t.mapping.slice(n),a=l.map(i.pos),c=l.map(s.pos);o?t.deleteRange(a,c):(t.replaceRangeWith(a,c,e),Je(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new Pe(t):He(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let o=t.depth-1;o>=0;o--){let r=e<0?He(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):He(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(r)return r}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Le(t.node(0))}static atStart(t){return He(t,t,0,0,1)||new Le(t)}static atEnd(t){return He(t,t,t.content.size,t.childCount,-1)||new Le(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Re[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Re)throw new RangeError("Duplicate use of selection JSON ID "+t);return Re[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}}ze.prototype.visible=!0;class _e{constructor(t,e){this.$from=t,this.$to=e}}let Ie=!1;function $e(t){Ie||t.parent.inlineContent||(Ie=!0,console["warn"]("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Pe extends ze{constructor(t,e=t){$e(t),$e(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return ze.near(n);let r=t.resolve(e.map(this.anchor));return new Pe(r.parent.inlineContent?r:n,n)}replace(t,e=m.empty){if(super.replace(t,e),e==m.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof Pe&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Be(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Pe(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=ze.findFrom(e,n,!0)||ze.findFrom(e,-n,!0);if(!t)return ze.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r?t=e:(t=(ze.findFrom(t,-n,!0)||ze.findFrom(t,n,!0)).$anchor,t.pos<e.pos!=r<0&&(t=e))),new Pe(t,e)}}ze.jsonID("text",Pe);class Be{constructor(t,e){this.anchor=t,this.head=e}map(t){return new Be(t.map(this.anchor),t.map(this.head))}resolve(t){return Pe.between(t.resolve(this.anchor),t.resolve(this.head))}}class Ve extends ze{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),o=t.resolve(r);return n?ze.near(o):new Ve(o)}content(){return new m(c.from(this.node),0,0)}eq(t){return t instanceof Ve&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Fe(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ve(t.resolve(e.anchor))}static create(t,e){return new Ve(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}Ve.prototype.visible=!1,ze.jsonID("node",Ve);class Fe{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new Be(n,n):new Fe(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&Ve.isSelectable(n)?new Ve(e):ze.near(e)}}class Le extends ze{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=m.empty){if(e==m.empty){t.delete(0,t.doc.content.size);let e=ze.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new Le(t)}map(t){return new Le(t)}eq(t){return t instanceof Le}getBookmark(){return je}}ze.jsonID("all",Le);const je={map(){return this},resolve(t){return new Le(t)}};function He(t,e,n,r,o,i=!1){if(e.inlineContent)return Pe.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let r=e.child(s);if(r.isAtom){if(!i&&Ve.isSelectable(r))return Ve.create(t,n-(o<0?r.nodeSize:0))}else{let e=He(t,r,n+o,o<0?r.childCount:0,o,i);if(e)return e}n+=r.nodeSize*o}return null}function Je(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Jt||o instanceof Wt))return;let i,s=t.mapping.maps[r];s.forEach(((t,e,n,r)=>{null==i&&(i=r)})),t.setSelection(ze.near(t.doc.resolve(i),n))}const We=1,qe=2,Ke=4;class Ue extends Te{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|We)&~qe,this.storedMarks=null,this}get selectionSet(){return(this.updated&We)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=qe,this}ensureMarks(t){return p.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qe)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&~qe,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),n=null==n?e:n,!t)return this.deleteRange(e,n);let o=this.storedMarks;if(!o){let t=this.doc.resolve(e);o=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(ze.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ke,this}get scrolledIntoView(){return(this.updated&Ke)>0}}function Ge(t,e){return e&&t?t.bind(e):t}class Xe{constructor(t,e,n){this.name=t,this.init=Ge(e.init,n),this.apply=Ge(e.apply,n)}}const Ye=[new Xe("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Xe("selection",{init(t,e){return t.selection||ze.atStart(e.doc)},apply(t){return t.selection}}),new Xe("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Xe("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ze{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ye.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new Xe(t.key,t.spec.state,t))}))}}class Qe{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=e){let e=this.config.plugins[n];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],n=this.applyInner(t),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let l=r?r[i].n:0,a=r?r[i].state:this,c=l<e.length&&s.spec.appendTransaction.call(s,l?e.slice(l):e,a,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",t),!r){r=[];for(let t=0;t<this.config.plugins.length;t++)r.push(t<i?{state:n,n:e.length}:{state:this,n:0})}e.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new Qe(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}return e}get tr(){return new Ue(this)}static create(t){let e=new Ze(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new Qe(e);for(let r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n}reconfigure(t){let e=new Ze(this.schema,t.plugins),n=e.fields,r=new Qe(e);for(let o=0;o<n.length;o++){let e=n[o].name;r[e]=this.hasOwnProperty(e)?this[e]:n[o].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((t=>t.toJSON()))),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let r=new Ze(t.schema,t.plugins),o=new Qe(r);return r.fields.forEach((r=>{if("doc"==r.name)o.doc=_.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=ze.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=l.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o}}function tn(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=tn(o,e,{})),n[r]=o}return n}class en{constructor(t){this.spec=t,this.props={},t.props&&tn(t.props,this,this.props),this.key=t.key?t.key.key:rn("plugin")}getState(t){return t[this.key]}}const nn=Object.create(null);function rn(t){return t in nn?t+"$"+ ++nn[t]:(nn[t]=0,t+"$")}class on{constructor(t="key"){this.key=rn(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const sn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ln=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let an=null;const cn=function(t,e,n){let r=an||(an=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},hn=function(t,e,n,r){return n&&(un(t,e,n,r,-1)||un(t,e,n,r,1))},dn=/^(img|br|input|textarea|hr)$/i;function un(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:pn(t))){let n=t.parentNode;if(!n||1!=n.nodeType||mn(t)||dn.test(t.nodeName)||"false"==t.contentEditable)return!1;e=sn(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if(t=t.childNodes[e+(o<0?-1:0)],"false"==t.contentEditable)return!1;e=o<0?pn(t):0}}}function pn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function fn(t,e,n){for(let r=0==e,o=e==pn(t);r||o;){if(t==n)return!0;let e=sn(t);if(t=t.parentNode,!t)return!1;r=r&&0==e,o=o&&e==pn(t)}}function mn(t){let e;for(let n=t;n;n=n.parentNode)if(e=n.pmViewDesc)break;return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const gn=function(t){return t.focusNode&&hn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function yn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function wn(t){let e=t.activeElement;while(e&&e.shadowRoot)e=e.shadowRoot.activeElement;return e}const vn="undefined"!=typeof navigator?navigator:null,bn="undefined"!=typeof document?document:null,xn=vn&&vn.userAgent||"",kn=/Edge\/(\d+)/.exec(xn),Sn=/MSIE \d/.exec(xn),Cn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xn),Mn=!!(Sn||Cn||kn),On=Sn?document.documentMode:Cn?+Cn[1]:kn?+kn[1]:0,Nn=!Mn&&/gecko\/(\d+)/i.test(xn);Nn&&(/Firefox\/(\d+)/.exec(xn)||[0,0])[1];const En=!Mn&&/Chrome\/(\d+)/.exec(xn),An=!!En,Dn=En?+En[1]:0,Tn=!Mn&&!!vn&&/Apple Computer/.test(vn.vendor),Rn=Tn&&(/Mobile\/\w+/.test(xn)||!!vn&&vn.maxTouchPoints>2),zn=Rn||!!vn&&/Mac/.test(vn.platform),_n=/Android \d/.test(xn),In=!!bn&&"webkitFontSmoothing"in bn.documentElement.style,$n=In?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Pn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Bn(t,e){return"number"==typeof t?t:t[e]}function Vn(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Fn(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;;s=ln(s)){if(!s)break;if(1!=s.nodeType)continue;let t=s,n=t==i.body,l=n?Pn(i):Vn(t),a=0,c=0;if(e.top<l.top+Bn(r,"top")?c=-(l.top-e.top+Bn(o,"top")):e.bottom>l.bottom-Bn(r,"bottom")&&(c=e.bottom-l.bottom+Bn(o,"bottom")),e.left<l.left+Bn(r,"left")?a=-(l.left-e.left+Bn(o,"left")):e.right>l.right-Bn(r,"right")&&(a=e.right-l.right+Bn(o,"right")),a||c)if(n)i.defaultView.scrollBy(a,c);else{let n=t.scrollLeft,r=t.scrollTop;c&&(t.scrollTop+=c),a&&(t.scrollLeft+=a);let o=t.scrollLeft-n,i=t.scrollTop-r;e={left:e.left-o,top:e.top-i,right:e.right-o,bottom:e.bottom-i}}if(n)break}}function Ln(t){let e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=t.root.elementFromPoint(i,s);if(!r||r==t.dom||!t.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=o-20){e=r,n=l.top;break}}return{refDOM:e,refTop:n,stack:jn(t.dom)}}function jn(t){let e=[],n=t.ownerDocument;for(let r=t;r;r=ln(r))if(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t==n)break;return e}function Hn({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Jn(n,0==r?0:r-e)}function Jn(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Wn=null;function qn(t){if(t.setActive)return t.setActive();if(Wn)return t.focus(Wn);let e=jn(t);t.focus(null==Wn?{get preventScroll(){return Wn={preventScroll:!0},!0}}:void 0),Wn||(Wn=!1,Jn(e,0))}function Kn(t,e){let n,r,o=2e8,i=0,s=e.top,l=e.top;for(let a=t.firstChild,c=0;a;a=a.nextSibling,c++){let t;if(1==a.nodeType)t=a.getClientRects();else{if(3!=a.nodeType)continue;t=cn(a).getClientRects()}for(let h=0;h<t.length;h++){let d=t[h];if(d.top<=s&&d.bottom>=l){s=Math.max(d.bottom,s),l=Math.min(d.top,l);let t=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(t<o){n=a,o=t,r=t&&3==n.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==a.nodeType&&t&&(i=c+(e.left>=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=c+1)}}return n&&3==n.nodeType?Un(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:Kn(n,r)}function Un(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let n=er(r,1);if(n.top!=n.bottom&&Gn(e,n))return{node:t,offset:o+(e.left>=(n.left+n.right)/2?1:0)}}return{node:t,offset:0}}function Gn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Xn(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Yn(t,e,n){let{node:r,offset:o}=Kn(e,n),i=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();i=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function Zn(t,e,n,r){let o=-1;for(let i=e,s=!1;;){if(i==t.dom)break;let e=t.docView.nearestDesc(i,!0);if(!e)return null;if(1==e.dom.nodeType&&(e.node.isBlock&&e.parent&&!s||!e.contentDOM)){let t=e.dom.getBoundingClientRect();if(e.node.isBlock&&e.parent&&!s&&(s=!0,t.left>r.left||t.top>r.top?o=e.posBefore:(t.right<r.left||t.bottom<r.top)&&(o=e.posAfter)),!e.contentDOM&&o<0){let n=e.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2;return n?e.posBefore:e.posAfter}}i=e.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Qn(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=t.childNodes[i];if(1==n.nodeType){let t=n.getClientRects();for(let r=0;r<t.length;r++){let o=t[r];if(Gn(e,o))return Qn(n,e,o)}}if((i=(i+1)%r)==o)break}return t}function tr(t,e){let n,r=t.dom.ownerDocument,o=0;if(r.caretPositionFromPoint)try{let t=r.caretPositionFromPoint(e.left,e.top);t&&({offsetNode:n,offset:o}=t)}catch(a){}if(!n&&r.caretRangeFromPoint){let t=r.caretRangeFromPoint(e.left,e.top);t&&({startContainer:n,startOffset:o}=t)}let i,s=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!s||!t.dom.contains(1!=s.nodeType?s.parentNode:s)){let n=t.dom.getBoundingClientRect();if(!Gn(e,n))return null;if(s=Qn(t.dom,e,n),!s)return null}if(Tn)for(let c=s;n&&c;c=ln(c))c.draggable&&(n=void 0);if(s=Xn(s,e),n){if(Nn&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let t,r=n.childNodes[o];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&o++}n==t.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?i=t.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(i=Zn(t,n,o,e))}null==i&&(i=Yn(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:i,inside:l?l.posAtStart-l.border:-1}}function er(t,e){let n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}const nr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rr(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=In||Nn;if(3==r.nodeType){if(!s||!nr.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let t=o,e=o,i=n<0?1:-1;return n<0&&!o?(e++,i=-1):n>=0&&o==r.nodeValue.length?(t--,i=1):n<0?t--:e++,or(er(cn(r,t,e),1),i<0)}{let t=er(cn(r,o,o),n);if(Nn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let e=er(cn(r,o-1,o-1),-1);if(e.top==t.top){let n=er(cn(r,o,o+1),-1);if(n.top!=t.top)return or(n,n.left<e.left)}}return t}}let l=t.state.doc.resolve(e-(i||0));if(!l.parent.inlineContent){if(null==i&&o&&(n<0||o==pn(r))){let t=r.childNodes[o-1];if(1==t.nodeType)return ir(t.getBoundingClientRect(),!1)}if(null==i&&o<pn(r)){let t=r.childNodes[o];if(1==t.nodeType)return ir(t.getBoundingClientRect(),!0)}return ir(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==pn(r))){let t=r.childNodes[o-1],e=3==t.nodeType?cn(t,pn(t)-(s?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return or(er(e,1),!1)}if(null==i&&o<pn(r)){let t=r.childNodes[o];while(t.pmViewDesc&&t.pmViewDesc.ignoreForCoords)t=t.nextSibling;let e=t?3==t.nodeType?cn(t,0,s?0:1):1==t.nodeType?t:null:null;if(e)return or(er(e,-1),!0)}return or(er(3==r.nodeType?cn(r):r,-n),n>=0)}function or(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ir(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function sr(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function lr(t,e,n){let r=e.selection,o="up"==n?r.$from:r.$to;return sr(t,e,(()=>{let{node:e}=t.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let r=rr(t,o.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=cn(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let o=e[t];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}const ar=/[\u0590-\u08ac]/;function cr(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return ar.test(r.parent.textContent)&&l.modify?sr(t,e,(()=>{let{focusNode:e,focusOffset:o,anchorNode:i,anchorOffset:s}=t.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:d}=t.domSelectionRange(),u=h&&!c.contains(1==h.nodeType?h:h.parentNode)||e==h&&o==d;try{l.collapse(i,s),e&&(e!=i||o!=s)&&l.extend&&l.extend(e,o)}catch(p){}return null!=a&&(l.caretBidiLevel=a),u})):"left"==n||"backward"==n?i:s}let hr=null,dr=null,ur=!1;function pr(t,e,n){return hr==e&&dr==n?ur:(hr=e,dr=n,ur="up"==n||"down"==n?lr(t,e,n):cr(t,e,n))}const fr=0,mr=1,gr=2,yr=3;class wr{constructor(t,e,n,r){this.parent=t,this.children=e,this.dom=n,this.contentDOM=r,this.dirty=fr,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,n=this.posAtStart;;e++){let r=this.children[e];if(r==t)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){let n,r;if(t==this.contentDOM)n=t.childNodes[e-1];else{while(t.parentNode!=this.contentDOM)t=t.parentNode;n=t.previousSibling}while(n&&(!(r=n.pmViewDesc)||r.parent!=this))n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(t==this.contentDOM)n=t.childNodes[e];else{while(t.parentNode!=this.contentDOM)t=t.parentNode;n=t.nextSibling}while(n&&(!(r=n.pmViewDesc)||r.parent!=this))n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>sn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,r=t;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!e||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==t.nodeType?t:t.parentNode):o==t))return i;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let n=e;n;n=n.parent)if(n==this)return e}posFromDOM(t,e,n){for(let r=t;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;e<this.children.length;e++){let r=this.children[e],o=n+r.size;if(n==t&&o!=n){while(!r.border&&r.children.length)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let e=this.children[n],i=o+e.size;if(i>t||e instanceof Mr){r=t-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof vr&&o.side>=0;n--);if(e<=0){let t,r=!0;for(;;n--,r=!1)if(t=n?this.children[n-1]:null,!t||t.dom.parentNode==this.contentDOM)break;return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?sn(t.dom)+1:0}}{let t,r=!0;for(;;n++,r=!1)if(t=n<this.children.length?this.children[n]:null,!t||t.dom.parentNode==this.contentDOM)break;return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?sn(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,n=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],l=i+n.size;if(-1==r&&t<=l){let o=i+n.border;if(t>=o&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,o);t=i;for(let e=s;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=sn(n.dom)+1;break}t-=n.size}-1==r&&(r=0)}if(r>-1&&(l>e||s==this.children.length-1)){e=l;for(let t=s+1;t<this.children.length;t++){let n=this.children[t];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=sn(n.dom);break}e+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:n}=this.domFromPos(t,0);if(1!=e.nodeType||n==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[n]}setSelection(t,e,n,r=!1){let o=Math.min(t,e),i=Math.max(t,e);for(let u=0,p=0;u<this.children.length;u++){let s=this.children[u],l=p+s.size;if(o>p&&i<l)return s.setSelection(t-p-s.border,e-p-s.border,n,r);p=l}let s=this.domFromPos(t,t?-1:1),l=e==t?s:this.domFromPos(e,e?-1:1),a=n.getSelection(),c=!1;if((Nn||Tn)&&t==e){let{node:t,offset:e}=s;if(3==t.nodeType){if(c=!(!e||"\n"!=t.nodeValue[e-1]),c&&e==t.nodeValue.length)for(let n,r=t;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:sn(n)+1});break}let t=r.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let n=t.childNodes[e-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Nn&&a.focusNode&&a.focusNode!=l.node&&1==a.focusNode.nodeType){let t=a.focusNode.childNodes[a.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||c&&Tn)&&hn(s.node,s.offset,a.anchorNode,a.anchorOffset)&&hn(l.node,l.offset,a.focusNode,a.focusOffset))return;let h=!1;if((a.extend||t==e)&&!c){a.collapse(s.node,s.offset);try{t!=e&&a.extend(l.node,l.offset),h=!0}catch(d){}}if(!h){if(t>e){let t=s;s=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){let r=n+o.border,s=i-o.border;if(t>=r&&e<=s)return this.dirty=t==n||e==i?gr:mr,void(t!=r||e!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-r,e-r):o.dirty=yr);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?yr:gr}n=i}this.dirty=gr}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?gr:mr;e.dirty<n&&(e.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class vr extends wr{constructor(t,e,n,r){let o,i=e.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!e.type.spec.raw){if(1!=i.nodeType){let t=document.createElement("span");t.appendChild(i),i=t}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(t,[],i,null),this.widget=e,this.widget=e,o=this}matchesWidget(t){return this.dirty==fr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class br extends wr{constructor(t,e,n,r){super(t,[],e,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class xr extends wr{constructor(t,e,n,r){super(t,[],n,r),this.mark=e}static create(t,e,n,r){let o=r.nodeViews[e.type.name],i=o&&o(e,r,n);return i&&i.dom||(i=xt.renderSpec(document,e.type.spec.toDOM(e,n))),new xr(t,e,i.dom,i.contentDOM||i.dom)}parseRule(){return this.dirty&yr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(t){return this.dirty!=yr&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=fr){let t=this.parent;while(!t.node)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=fr}}slice(t,e,n){let r=xr.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;e<i&&(o=Hr(o,e,i,n)),t>0&&(o=Hr(o,0,t,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}}class kr extends wr{constructor(t,e,n,r,o,i,s,l,a){super(t,[],o,i),this.node=e,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s,i&&this.updateChildren(l,a)}static create(t,e,n,r,o,i){let s,l=o.nodeViews[e.type.name],a=l&&l(e,o,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i),n,r),c=a&&a.dom,h=a&&a.contentDOM;if(e.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(e.text);else c||({dom:c,contentDOM:h}=xt.renderSpec(document,e.type.spec.toDOM(e)));h||e.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),e.type.spec.draggable&&(c.draggable=!0));let d=c;return c=zr(c,n,e),a?s=new Or(t,e,n,r,c,h||null,d,a,o,i+1):e.isText?new Cr(t,e,n,r,c,d,o):new kr(t,e,n,r,c,h||null,d,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let 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(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>c.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,n){return this.dirty==fr&&t.eq(this.node)&&_r(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,r=e,o=t.composing?this.localCompositionInfo(t,e):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,l=new $r(this,i&&i.node,t);Vr(this.node,this.innerDeco,((e,o,i)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t):e.type.side>=0&&!i&&l.syncToMarks(o==this.node.childCount?p.none:this.node.child(o).marks,n,t),l.placeWidget(e,t,r)}),((e,i,a,c)=>{let h;l.syncToMarks(e.marks,n,t),l.findNodeMatch(e,i,a,c)||s&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(h=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(e,i,a,h,t)||l.updateNextNode(e,i,a,t,c)||l.addNode(e,i,a,t,r),r+=e.nodeSize})),l.syncToMarks([],n,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==gr)&&(i&&this.protectLocalComposition(t,i),Nr(this.contentDOM,this.children,t),Rn&&Fr(this.dom))}localCompositionInfo(t,e){let{from:n,to:r}=t.state.selection;if(!(t.state.selection instanceof Pe)||n<e||r>e+this.node.content.size)return null;let o=t.domSelectionRange(),i=Lr(o.focusNode,o.focusOffset);if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let t=i.nodeValue,o=jr(this.node.content,t,n-e,r-e);return o<0?null:{node:i,pos:o,text:t}}return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:r}){if(this.getDesc(e))return;let o=e;for(;;o=o.parentNode){if(o.parentNode==this.contentDOM)break;while(o.previousSibling)o.parentNode.removeChild(o.previousSibling);while(o.nextSibling)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new br(this,o,e,r);t.input.compositionNodes.push(i),this.children=Hr(this.children,n,n+r.length,t,i)}update(t,e,n,r){return!(this.dirty==yr||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)}updateInner(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=fr}updateOuterDeco(t){if(_r(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tr(this.dom,this.nodeDOM,Dr(this.outerDeco,this.node,e),Dr(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Sr(t,e,n,r,o){return zr(r,e,t),new kr(void 0,t,e,n,r,r,r,o,0)}class Cr extends kr{constructor(t,e,n,r,o,i,s){super(t,e,n,r,o,null,i,s,0)}parseRule(){let t=this.nodeDOM.parentNode;while(t&&t!=this.dom&&!t.pmIsDeco)t=t.parentNode;return{skip:t||!0}}update(t,e,n,r){return!(this.dirty==yr||this.dirty!=fr&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),this.dirty==fr&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=fr,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let r=this.node.cut(t,e),o=document.createTextNode(r.text);return new Cr(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=yr)}get domAtom(){return!1}}class Mr extends wr{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==fr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Or extends kr{constructor(t,e,n,r,o,i,s,l,a,c){super(t,e,n,r,o,i,s,a,c),this.spec=l}update(t,e,n,r){if(this.dirty==yr)return!1;if(this.spec.update){let o=this.spec.update(t,e,n);return o&&this.updateInner(t,e,n,r),o}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,r){this.spec.setSelection?this.spec.setSelection(t,e,n):super.setSelection(t,e,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Nr(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){while(l!=r)r=Ir(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof xr){let e=r?r.previousSibling:t.lastChild;Nr(s.contentDOM,s.children,n),r=e?e.nextSibling:t.firstChild}}while(r)r=Ir(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Er=function(t){t&&(this.nodeName=t)};Er.prototype=Object.create(null);const Ar=[new Er];function Dr(t,e,n){if(0==t.length)return Ar;let r=n?Ar[0]:new Er,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Er(s.nodeName));for(let t in s){let i=s[t];null!=i&&(n&&1==o.length&&o.push(r=new Er(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+i:"style"==t?r.style=(r.style?r.style+";":"")+i:"nodeName"!=t&&(r[t]=i))}}}return o}function Tr(t,e,n,r){if(n==Ar&&r==Ar)return e;let o=e;for(let i=0;i<r.length;i++){let e=r[i],s=n[i];if(i){let n;s&&s.nodeName==e.nodeName&&o!=t&&(n=o.parentNode)&&n.nodeName.toLowerCase()==e.nodeName||(n=document.createElement(e.nodeName),n.pmIsDeco=!0,n.appendChild(o),s=Ar[0]),o=n}Rr(o,s||Ar[0],e)}return o}function Rr(t,e,n){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==o.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<o.length;e++)-1==r.indexOf(o[e])&&t.classList.add(o[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;while(n=r.exec(e.style))t.style.removeProperty(n[1])}n.style&&(t.style.cssText+=n.style)}}function zr(t,e,n){return Tr(t,t,Ar,Dr(e,n,1!=t.nodeType))}function _r(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ir(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class $r{constructor(t,e,n){this.lock=e,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=Pr(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,n){let r=0,o=this.stack.length>>1,i=Math.min(o,t.length);while(r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning)r++;while(r<o)this.destroyRest(),this.top.dirty=fr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;while(o<t.length){this.stack.push(this.top,this.index+1);let r=-1;for(let e=this.index;e<Math.min(this.index+3,this.top.children.length);e++){let n=this.top.children[e];if(n.matchesMark(t[o])&&!this.isLocked(n.dom)){r=e;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=xr.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(t,e,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,n))i=this.top.children.indexOf(o,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let r=this.top.children[s];if(r.matchesNode(t,e,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,e,n,r,o){let i=this.top.children[r];return i.dirty==yr&&i.dom==i.contentDOM&&(i.dirty=gr),!!i.update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,n,r,o){for(let i=this.index;i<this.top.children.length;i++){let s=this.top.children[i];if(s instanceof kr){let l=this.preMatch.matched.get(s);if(null!=l&&l!=o)return!1;let a=s.dom,c=this.isLocked(a)&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&s.dirty!=yr&&_r(e,s.outerDeco));if(!c&&s.update(t,e,n,r))return this.destroyBetween(this.index,i),s.dom!=a&&(this.changed=!0),this.index++,!0;break}}return!1}addNode(t,e,n,r,o){this.top.children.splice(this.index++,0,kr.create(this.top,t,e,n,r,o)),this.changed=!0}placeWidget(t,e,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new vr(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;while(t instanceof xr)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Cr)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Tn||An)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let n=document.createElement(t);"IMG"==t&&(n.className="ProseMirror-separator",n.alt=""),"BR"==t&&(n.className="ProseMirror-trailingBreak");let r=new Mr(this.top,[],n,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Pr(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];t:while(o>0){let l;for(;;)if(r){let t=n.children[r-1];if(!(t instanceof xr)){l=t,r--;break}n=t,r=t.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function Br(t,e){return t.type.side-e.type.side}function Vr(t,e,n,r){let o=e.locals(t),i=0;if(0==o.length){for(let n=0;n<t.childCount;n++){let s=t.child(n);r(s,o,e.forChild(i,s),n),i+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){if(s<o.length&&o[s].to==i){let t,e=o[s++];while(s<o.length&&o[s].to==i)(t||(t=[e])).push(o[s++]);if(t){t.sort(Br);for(let e=0;e<t.length;e++)n(t[e],c,!!a)}else n(e,c,!!a)}let h,d;if(a)d=-1,h=a,a=null;else{if(!(c<t.childCount))break;d=c,h=t.child(c++)}for(let t=0;t<l.length;t++)l[t].to<=i&&l.splice(t--,1);while(s<o.length&&o[s].from<=i&&o[s].to>i)l.push(o[s++]);let u=i+h.nodeSize;if(h.isText){let t=u;s<o.length&&o[s].from<t&&(t=o[s].from);for(let e=0;e<l.length;e++)l[e].to<t&&(t=l[e].to);t<u&&(a=h.cut(t-i),h=h.cut(0,t-i),u=t,d=-1)}let p=h.isInline&&!h.isLeaf?l.filter((t=>!t.inline)):l.slice();r(h,p,e.forChild(i,h),d),i=u}}function Fr(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Lr(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=pn(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}function jr(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;while(o<t.childCount){let e=t.child(o++);if(i+=e.nodeSize,!e.isText)break;a+=e.text}if(i>=n){let t=l<r?a.lastIndexOf(e,r-l-1):-1;if(t>=0&&t+e.length+l>=n)return l+t;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Hr(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,h=l+=a.size;c>=n||h<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),h>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Jr(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l,a,c=r.resolve(s);if(gn(n)){l=c;while(o&&!o.node)o=o.parent;let t=o.node;if(o&&t.isAtom&&Ve.isSelectable(t)&&o.parent&&(!t.isInline||!fn(n.focusNode,n.focusOffset,o.dom))){let t=o.posBefore;a=new Ve(s==t?c:r.resolve(t))}}else{let e=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(e<0)return null;l=r.resolve(e)}if(!a){let n="pointer"==e||t.state.selection.head<c.pos&&!i?1:-1;a=eo(t,l,c,n)}return a}function Wr(t){return t.editable?t.hasFocus():ro(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qr(t,e=!1){let n=t.state.selection;if(Qr(t,n),Wr(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&An){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&hn(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset))return t.input.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Zr(t);else{let r,o,{anchor:i,head:s}=n;!Kr||n instanceof Pe||(n.$from.parent.inlineContent||(r=Ur(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Ur(t,n.to))),t.docView.setSelection(i,s,t.root,e),Kr&&(r&&Xr(r),o&&Xr(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Yr(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Kr=Tn||An&&Dn<63;function Ur(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Tn&&o&&"false"==o.contentEditable)return Gr(o);if((!o||"false"==o.contentEditable)&&(!i||"false"==i.contentEditable)){if(o)return Gr(o);if(i)return Gr(i)}}function Gr(t){return t.contentEditable="true",Tn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Xr(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Yr(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Wr(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}function Zr(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,sn(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Mn&&On<=11&&(r.disabled=!0,r.disabled=!1)}function Qr(t,e){if(e instanceof Ve){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(to(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else to(t)}function to(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function eo(t,e,n,r){return t.someProp("createSelectionBetween",(r=>r(t,e,n)))||Pe.between(e,n,r)}function no(t){return!(t.editable&&!t.hasFocus())&&ro(t)}function ro(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(n){return!1}}function oo(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return hn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function io(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&ze.findFrom(i,e)}function so(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function lo(t,e,n){let r=t.state.selection;if(!(r instanceof Pe)){if(r instanceof Ve&&r.node.isInline)return so(t,new Pe(e>0?r.$to:r.$from));{let n=io(t.state,e);return!!n&&so(t,n)}}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){let n=io(t.state,e);return!!(n&&n instanceof Ve)&&so(t,n)}if(!(zn&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=e<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=t.docView.descAt(s))&&!n.contentDOM)&&(Ve.isSelectable(i)?so(t,new Ve(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):!!In&&so(t,new Pe(t.state.doc.resolve(e<0?s:s+i.nodeSize))))}}function ao(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function co(t){let e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function ho(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Nn&&1==n.nodeType&&r<ao(n)&&co(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(co(t))o=n,i=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(po(n))break;{let e=n.previousSibling;while(e&&co(e))o=n.parentNode,i=sn(e),e=e.previousSibling;if(e)n=e,r=ao(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?fo(t,n,r):o&&fo(t,o,i)}function uo(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=ao(n);for(;;)if(r<s){if(1!=n.nodeType)break;let t=n.childNodes[r];if(!co(t))break;o=n,i=++r}else{if(po(n))break;{let e=n.nextSibling;while(e&&co(e))o=e.parentNode,i=sn(e)+1,e=e.nextSibling;if(e)n=e,r=0,s=ao(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}o&&fo(t,o,i)}function po(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function fo(t,e,n){let r=t.domSelection();if(gn(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout((()=>{t.state==o&&qr(t)}),50)}function mo(t,e,n){let r=t.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1)return!1;if(zn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=io(t.state,e);if(n&&n instanceof Ve)return so(t,n)}if(!o.parent.inlineContent){let n=e<0?o:i,s=r instanceof Le?ze.near(n,e):ze.findFrom(n,e);return!!s&&so(t,s)}return!1}function go(t,e){if(!(t.state.selection instanceof Pe))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=t.state.tr;return e<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),t.dispatch(r),!0}return!1}function yo(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function wo(t){if(!Tn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;yo(t,n,"true"),setTimeout((()=>yo(t,n,"false")),20)}return!1}function vo(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function bo(t,e){let n=e.keyCode,r=vo(e);return 8==n||zn&&72==n&&"c"==r?go(t,-1)||ho(t):46==n||zn&&68==n&&"c"==r?go(t,1)||uo(t):13==n||27==n||(37==n||zn&&66==n&&"c"==r?lo(t,-1,r)||ho(t):39==n||zn&&70==n&&"c"==r?lo(t,1,r)||uo(t):38==n||zn&&80==n&&"c"==r?mo(t,-1,r)||ho(t):40==n||zn&&78==n&&"c"==r?wo(t)||mo(t,1,r)||uo(t):r==(zn?"m":"c")&&(66==n||73==n||89==n||90==n))}function xo(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:r,openStart:o,openEnd:i}=e;while(o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount){o--,i--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let s=t.someProp("clipboardSerializer")||xt.fromSchema(t.state.schema),l=Ro(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c,h=a.firstChild,d=0;while(h&&1==h.nodeType&&(c=Do[h.nodeName.toLowerCase()])){for(let t=c.length-1;t>=0;t--){let e=l.createElement(c[t]);while(a.firstChild)e.appendChild(a.firstChild);a.appendChild(e),d++}h=a.firstChild}h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let u=t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n");return{dom:a,text:u}}function ko(t,e,n,r,o){let i,s,l=o.parent.type.spec.code;if(!n&&!e)return null;let a=e&&(r||l||!n);if(a){if(t.someProp("transformPastedText",(n=>{e=n(e,l||r,t)})),l)return e?new m(c.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):m.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,o,r,t)));if(n)s=n;else{let n=o.marks(),{schema:r}=t.state,s=xt.fromSchema(r);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=i.appendChild(document.createElement("p"));t&&e.appendChild(s.serializeNode(r.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),i=zo(n),In&&_o(i);let h=i&&i.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let c=+d[3];c>0;c--){let t=i.firstChild;while(t&&1!=t.nodeType)t=t.nextSibling;if(!t)break;i=t}if(!s){let e=t.someProp("clipboardParser")||t.someProp("domParser")||it.fromSchema(t.state.schema);s=e.parseSlice(i,{preserveWhitespace:!(!a&&!d),context:o,ruleFromNode(t){return"BR"!=t.nodeName||t.nextSibling||!t.parentNode||So.test(t.parentNode.nodeName)?null:{ignore:!0}}})}if(d)s=Io(Ao(s,+d[1],+d[2]),d[4]);else if(s=m.maxOpen(Co(s.content,o),!0),s.openStart||s.openEnd){let t=0,e=0;for(let n=s.content.firstChild;t<s.openStart&&!n.type.spec.isolating;t++,n=n.firstChild);for(let n=s.content.lastChild;e<s.openEnd&&!n.type.spec.isolating;e++,n=n.lastChild);s=Ao(s,t,e)}return t.someProp("transformPasted",(e=>{s=e(s,t)})),s}const So=/^(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 Co(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,o=e.node(n),i=o.contentMatchAt(e.index(n)),s=[];if(t.forEach((t=>{if(!s)return;let e,n=i.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&r.length&&Oo(n,r,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=No(s[s.length-1],r.length));let e=Mo(t,n);s.push(e),i=i.matchType(e.type),r=n}})),s)return c.from(s)}return t}function Mo(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,c.from(t));return t}function Oo(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Oo(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));let s=r.contentMatchAt(r.childCount);if(s.matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(c.from(Mo(n,t,o+1))))}}function No(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,No(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(c.empty,!0);return t.copy(n.append(r))}function Eo(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return o<r-1&&(l=Eo(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,t.childCount>1||i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(c.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Ao(t,e,n){return e<t.openStart&&(t=new m(Eo(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new m(Eo(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Do={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let To=null;function Ro(){return To||(To=document.implementation.createHTMLDocument("title"))}function zo(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=Ro().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);if((n=o&&Do[o[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"</"+t+">")).reverse().join("")),r.innerHTML=t,n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}function _o(t){let e=t.querySelectorAll(An?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Io(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(l){return t}let{content:o,openStart:i,openEnd:s}=t;for(let a=n.length-2;a>=0;a-=2){let t=r.nodes[n[a]];if(!t||t.hasRequiredAttrs())break;o=c.from(t.create(n[a+1],o)),i++,s++}return new m(o,i,s)}const $o={},Po={},Bo={touchstart:!0,touchmove:!0};class Vo{constructor(){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.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Fo(t){for(let e in $o){let n=$o[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!Wo(t,e)||Jo(t,e)||!t.editable&&e.type in Po||n(t,e)},Bo[e]?{passive:!0}:void 0)}Tn&&t.dom.addEventListener("input",(()=>null)),Ho(t)}function Lo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function jo(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ho(t){t.someProp("handleDOMEvents",(e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>Jo(t,e))}))}function Jo(t,e){return t.someProp("handleDOMEvents",(n=>{let r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function Wo(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function qo(t,e){Jo(t,e)||!$o[e.type]||!t.editable&&e.type in Po||$o[e.type](t,e)}function Ko(t){return{left:t.clientX,top:t.clientY}}function Uo(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Go(t,e,n,r,o){if(-1==r)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,(e=>s>i.depth?e(t,n,i.nodeAfter,i.before(s),o,!0):e(t,n,i.node(s),i.before(s),o,!1))))return!0;return!1}function Xo(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Yo(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&Ve.isSelectable(r))&&(Xo(t,new Ve(n),"pointer"),!0)}function Zo(t,e){if(-1==e)return!1;let n,r,o=t.state.selection;o instanceof Ve&&(n=o.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let t=s>i.depth?i.nodeAfter:i.node(s);if(Ve.isSelectable(t)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Xo(t,Ve.create(t.state.doc,r),"pointer"),!0)}function Qo(t,e,n,r,o){return Go(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(n=>n(t,e,r)))||(o?Zo(t,n):Yo(t,n))}function ti(t,e,n,r){return Go(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(n=>n(t,e,r)))}function ei(t,e,n,r){return Go(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(n=>n(t,e,r)))||ni(t,n,r)}function ni(t,e,n){if(0!=n.button)return!1;let r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Xo(t,Pe.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let e=i>o.depth?o.nodeAfter:o.node(i),n=o.before(i);if(e.inlineContent)Xo(t,Pe.create(r,n+1,n+1+e.content.size),"pointer");else{if(!Ve.isSelectable(e))continue;Xo(t,Ve.create(r,n),"pointer")}return!0}}function ri(t){return di(t)}Po.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!si(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!_n||!An||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!Rn||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||bo(t,n)?n.preventDefault():Lo(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,yn(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},Po.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},Po.keypress=(t,e)=>{let n=e;if(si(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||zn&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof Pe)||!r.$from.sameParent(r.$to)){let e=String.fromCharCode(n.charCode);/[\r\n]/.test(e)||t.someProp("handleTextInput",(n=>n(t,r.$from.pos,r.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const oi=zn?"metaKey":"ctrlKey";$o.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ri(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Uo(n,t.input.lastClick)&&!n[oi]&&("singleClick"==t.input.lastClick.type?i="doubleClick":"doubleClick"==t.input.lastClick.type&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(Ko(n));s&&("singleClick"==i?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new ii(t,s,n,!!r)):("doubleClick"==i?ti:ei)(t,s.pos,s.inside,n)?n.preventDefault():Lo(t,"pointer"))};class ii{constructor(t,e,n,r){let o,i;if(this.view=t,this.pos=e,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[oi],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{let n=t.state.doc.resolve(e.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,l=s?t.docView.nearestDesc(s,!0):null;this.target=l?l.dom:null;let{selection:a}=t.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||a instanceof Ve&&a.from<=i&&a.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Nn||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Lo(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>qr(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Ko(t))),this.updateAllowDefault(t),this.allowDefault||!e?Lo(this.view,"pointer"):Qo(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||Tn&&this.mightDrag&&!this.mightDrag.node.isAtom||An&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Xo(this.view,ze.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Lo(this.view,"pointer")}move(t){this.updateAllowDefault(t),Lo(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function si(t,e){return!!t.composing||!!(Tn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}$o.touchstart=t=>{t.input.lastTouch=Date.now(),ri(t),Lo(t,"pointer")},$o.touchmove=t=>{t.input.lastTouch=Date.now(),Lo(t,"pointer")},$o.contextmenu=t=>ri(t);const li=_n?5e3:-1;function ai(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>di(t)),e))}function ci(t){t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hi());while(t.input.compositionNodes.length>0)t.input.compositionNodes.pop().markParentsDirty()}function hi(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function di(t,e=!1){if(!(_n&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ci(t),e||t.docView&&t.docView.dirty){let e=Jr(t);return e&&!e.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(e)):t.updateState(t.state),!0}return!1}}function ui(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}Po.compositionstart=Po.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),di(t,!0),t.markCursor=null;else if(di(t),Nn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){t.domSelection().collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}ai(t,li)},Po.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,ai(t,20))};const pi=Mn&&On<15||Rn&&$n<604;function fi(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}function mi(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gi(t,r.value,null,t.input.shiftKey,e):gi(t,r.textContent,r.innerHTML,t.input.shiftKey,e)}),50)}function gi(t,e,n,r,o){let i=ko(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,o,i||m.empty))))return!0;if(!i)return!1;let s=fi(i),l=s?t.state.tr.replaceSelectionWith(s,t.input.shiftKey):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}$o.copy=Po.cut=(t,e)=>{let n=e,r=t.state.selection,o="cut"==n.type;if(r.empty)return;let i=pi?null:n.clipboardData,s=r.content(),{dom:l,text:a}=xo(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):ui(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Po.paste=(t,e)=>{let n=e;if(t.composing&&!_n)return;let r=pi?null:n.clipboardData;r&&gi(t,r.getData("text/plain"),r.getData("text/html"),t.input.shiftKey,n)?n.preventDefault():mi(t,n)};class yi{constructor(t,e){this.slice=t,this.move=e}}const wi=zn?"altKey":"ctrlKey";$o.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Ko(n));if(i&&i.pos>=o.from&&i.pos<=(o instanceof Ve?o.to-1:o.to));else if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(Ve.create(t.state.doc,r.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&t.dispatch(t.state.tr.setSelection(Ve.create(t.state.doc,e.posBefore)))}let s=t.state.selection.content(),{dom:l,text:a}=xo(t,s);n.dataTransfer.clearData(),n.dataTransfer.setData(pi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",pi||n.dataTransfer.setData("text/plain",a),t.dragging=new yi(s,!n[wi])},$o.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},Po.dragover=Po.dragenter=(t,e)=>e.preventDefault(),Po.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Ko(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",(e=>{s=e(s,t)})):s=ko(t,n.dataTransfer.getData(pi?"Text":"text/plain"),pi?null:n.dataTransfer.getData("text/html"),!1,i);let l=!(!r||n[wi]);if(t.someProp("handleDrop",(e=>e(t,n,s||m.empty,l))))return void n.preventDefault();if(!s)return;n.preventDefault();let a=s?pe(t.state.doc,i.pos,s):i.pos;null==a&&(a=i.pos);let c=t.state.tr;l&&c.deleteSelection();let h=c.mapping.map(a),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(u))return;let p=c.doc.resolve(h);if(d&&Ve.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Ve(p));else{let e=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach(((t,n,r,o)=>e=o)),c.setSelection(eo(t,p,c.doc.resolve(e)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},$o.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&qr(t)}),20))},$o.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},$o.beforeinput=(t,e)=>{let n=e;if(An&&_n&&"deleteContentBackward"==n.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,yn(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let r in Po)$o[r]=Po[r];function vi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class bi{constructor(t,e){this.toDOM=t,this.spec=e||Mi,this.side=this.spec.side||0}map(t,e,n,r){let{pos:o,deleted:i}=t.mapResult(e.from+r,this.side<0?-1:1);return i?null:new Si(o-n,o-n,this)}valid(){return!0}eq(t){return this==t||t instanceof bi&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&vi(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class xi{constructor(t,e){this.attrs=t,this.spec=e||Mi}map(t,e,n,r){let o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Si(o,i,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof xi&&vi(this.attrs,t.attrs)&&vi(this.spec,t.spec)}static is(t){return t.type instanceof xi}destroy(){}}class ki{constructor(t,e){this.attrs=t,this.spec=e||Mi}map(t,e,n,r){let o=t.mapResult(e.from+r,1);if(o.deleted)return null;let i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Si(o.pos-n,i.pos-n,this)}valid(t,e){let n,{index:r,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(n=t.child(r)).isText&&o+n.nodeSize==e.to}eq(t){return this==t||t instanceof ki&&vi(this.attrs,t.attrs)&&vi(this.spec,t.spec)}destroy(){}}class Si{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new Si(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new Si(t,t,new bi(e,n))}static inline(t,e,n,r){return new Si(t,e,new xi(n,r))}static node(t,e,n,r){return new Si(t,e,new ki(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof xi}}const Ci=[],Mi={};class Oi{constructor(t,e){this.local=t.length?t:Ci,this.children=e.length?e:Ci}static create(t,e){return e.length?_i(e,t,0,Mi):Ni}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<e&&this.children[i+1]>t){let s=this.children[i]+1;this.children[i+2].findInner(t-s,e-s,n,r+s,o)}}map(t,e,n){return this==Ni||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Mi)}mapInner(t,e,n,r,o){let i;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(t,n,r);l&&l.type.valid(e,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?Ai(this.children,i||[],t,e,n,r,o):i?new Oi(i.sort(Ii),Ci):Ni}add(t,e){return e.length?this==Ni?Oi.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,o=0;t.forEach(((t,i)=>{let s,l=i+n;if(s=Ri(e,t,l)){r||(r=this.children.slice());while(o<r.length&&r[o]<i)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(t,s,l+1):r.splice(o,0,i,i+t.nodeSize,_i(s,t,l+1,Mi)),o+=3}}));let i=Di(o?zi(e):e,-n);for(let s=0;s<i.length;s++)i[s].type.valid(t,i[s])||i.splice(s--,1);return new Oi(i.length?this.local.concat(i).sort(Ii):this.local,r||this.children)}remove(t){return 0==t.length||this==Ni?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+e,s=n[o+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>i&&e.to<s&&(t[n]=null,(r||(r=[])).push(e));if(!r)continue;n==this.children&&(n=this.children.slice());let l=n[o+2].removeInner(r,i+1);l!=Ni?n[o+2]=l:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<t.length;i++)if(o=t[i])for(let t=0;t<r.length;t++)r[t].eq(o,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Oi(r,n):Ni}forChild(t,e){if(this==Ni)return this;if(e.isLeaf)return Oi.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=t){this.children[s]==t&&(n=this.children[s+2]);break}let o=t+1,i=o+e.content.size;for(let s=0;s<this.local.length;s++){let t=this.local[s];if(t.from<i&&t.to>o&&t.type instanceof xi){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let t=new Oi(r.sort(Ii),Ci);return n?new Ei([t,n]):t}return n||Ni}eq(t){if(this==t)return!0;if(!(t instanceof Oi)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return $i(this.localsInner(t))}localsInner(t){if(this==Ni)return Ci;if(t.inlineContent||!this.local.some(xi.is))return this.local;let e=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof xi||e.push(this.local[n]);return e}}Oi.empty=new Oi([],[]),Oi.removeOverlap=$i;const Ni=Oi.empty;class Ei{constructor(t){this.members=t}map(t,e){const n=this.members.map((n=>n.map(t,e,Mi)));return Ei.from(n)}forChild(t,e){if(e.isLeaf)return Oi.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(t,e);o!=Ni&&(o instanceof Ei?n=n.concat(o.members):n.push(o))}return Ei.from(n)}eq(t){if(!(t instanceof Ei)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<o.length;t++)e.push(o[t])}else e=o}return e?$i(n?e:e.sort(Ii)):Ci}static from(t){switch(t.length){case 0:return Ni;case 1:return t[0];default:return new Ei(t.every((t=>t instanceof Oi))?t:t.reduce(((t,e)=>t.concat(e instanceof Oi?e:e.members)),[]))}}}function Ai(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,h=i;c<n.maps.length;c++){let t=0;n.maps[c].forEach(((e,n,r,i)=>{let s=i-r-(n-e);for(let a=0;a<l.length;a+=3){let i=l[a+1];if(i<0||e>i+h-t)continue;let c=l[a]+h-t;n>=c?l[a+1]=e<=c?-2:-1:r>=o&&s&&(l[a]+=s,l[a+1]+=s)}t+=s})),h=n.maps[c].map(h,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(-2==l[c+1]){a=!0,l[c+1]=-1;continue}let e=n.map(t[c]+i),h=e-o;if(h<0||h>=r.content.size){a=!0;continue}let d=n.map(t[c+1]+i,-1),u=d-o,{index:p,offset:f}=r.content.findIndex(h),m=r.maybeChild(p);if(m&&f==h&&f+m.nodeSize==u){let r=l[c+2].mapInner(n,m,e+1,t[c]+i+1,s);r!=Ni?(l[c]=h,l[c+1]=u,l[c+2]=r):(l[c+1]=-2,a=!0)}else a=!0}if(a){let a=Ti(l,t,e,n,o,i,s),c=_i(a,r,0,s);e=c.local;for(let t=0;t<l.length;t+=3)l[t+1]<0&&(l.splice(t,3),t-=3);for(let t=0,e=0;t<c.children.length;t+=3){let n=c.children[t];while(e<l.length&&l[e]<n)e+=3;l.splice(e,0,c.children[t],c.children[t+1],c.children[t+2])}}return new Oi(e.sort(Ii),l)}function Di(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Si(o.from+e,o.to+e,o.type))}return n}function Ti(t,e,n,r,o,i,s){function l(t,e){for(let i=0;i<t.local.length;i++){let l=t.local[i].map(r,o,e);l?n.push(l):s.onRemove&&s.onRemove(t.local[i].spec)}for(let n=0;n<t.children.length;n+=3)l(t.children[n+2],t.children[n]+e+1)}for(let a=0;a<t.length;a+=3)-1==t[a+1]&&l(t[a+2],e[a]+i+1);return n}function Ri(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i,s=0;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function zi(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function _i(t,e,n,r){let o=[],i=!1;e.forEach(((e,s)=>{let l=Ri(t,e,s+n);if(l){i=!0;let t=_i(l,e,n+s+1,r);t!=Ni&&o.push(s,s+e.nodeSize,t)}}));let s=Di(i?zi(t):t,-n).sort(Ii);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new Oi(s,o):Ni}function Ii(t,e){return t.from-e.from||t.to-e.to}function $i(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Pi(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Pi(e,o+1,i.copy(r.to,i.to)))}}return e}function Pi(t,e,n){while(e<t.length&&Ii(n,t[e])>0)e++;t.splice(e,0,n)}function Bi(t){let e=[];return t.someProp("decorations",(n=>{let r=n(t.state);r&&r!=Ni&&e.push(r)})),t.cursorWrapper&&e.push(Oi.create(t.state.doc,[t.cursorWrapper.deco])),Ei.from(e)}const Vi={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Fi=Mn&&On<=11;class Li{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ji{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Li,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Mn&&On<=11&&t.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),Fi&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Vi)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(no(this.view)){if(this.suppressingSelectionUpdates)return qr(this.view);if(Mn&&On<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&hn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let o=t.focusNode;o;o=ln(o))n.add(o);for(let o=t.anchorNode;o;o=ln(o))if(n.has(o)){e=o;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);let n=t.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&no(t)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,l=[];if(t.editable)for(let c=0;c<e.length;c++){let t=this.registerMutation(e[c],l);t&&(o=o<0?t.from:Math.min(t.from,o),i=i<0?t.to:Math.max(t.to,i),t.typeOver&&(s=!0))}if(Nn&&l.length>1){let t=l.filter((t=>"BR"==t.nodeName));if(2==t.length){let e=t[0],n=t[1];e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}}let a=null;o<0&&r&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&gn(n)&&(a=Jr(t))&&a.eq(ze.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,qr(t),this.currentSelection.set(n),t.scrollToSelection()):(o>-1||r)&&(o>-1&&(t.docView.markDirty(o,i),Wi(t)),this.handleDOMChange(o,i,s,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||qr(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;n<t.addedNodes.length;n++)e.push(t.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};let r=t.previousSibling,o=t.nextSibling;if(Mn&&On<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:n,nextSibling:i}=t.addedNodes[e];(!n||Array.prototype.indexOf.call(t.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(t.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==t.target?sn(r)+1:0,s=n.localPosFromDOM(t.target,i,-1),l=o&&o.parentNode==t.target?sn(o):t.target.childNodes.length,a=n.localPosFromDOM(t.target,l,1);return{from:s,to:a}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let Hi=new WeakMap,Ji=!1;function Wi(t){if(!Hi.has(t)&&(Hi.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=Nn,Ji)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."),Ji=!0}}function qi(t){let e;function n(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0);let r=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return hn(l.node,l.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}function Ki(t,e,n){let r,{node:o,fromOffset:i,toOffset:s,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h=c.anchorNode;if(h&&t.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:c.anchorOffset}],gn(c)||r.push({node:c.focusNode,offset:c.focusOffset})),An&&8===t.input.lastKeyCode)for(let g=s;g>i;g--){let t=o.childNodes[g-1],e=t.pmViewDesc;if("BR"==t.nodeName&&!e){s=g;break}if(!e||e.size)break}let d=t.state.doc,u=t.someProp("domParser")||it.fromSchema(t.state.schema),p=d.resolve(l),f=null,m=u.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Ui,context:p});if(r&&null!=r[0].pos){let t=r[0].pos,e=r[1]&&r[1].pos;null==e&&(e=t),f={anchor:t+l,head:e+l}}return{doc:m,sel:f,from:l,to:a}}function Ui(t){let e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(Tn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||Tn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Gi=/^(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 Xi(t,e,n,r,o){if(e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=Jr(t,e);if(n&&!t.state.selection.eq(n)){if(An&&_n&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,yn(13,"Enter")))))return;let r=t.state.tr.setSelection(n);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),t.dispatch(r)}return}let i=t.state.doc.resolve(e),s=i.sharedDepth(n);e=i.before(s+1),n=t.state.doc.resolve(n).after(s+1);let l,a,c=t.state.selection,h=Ki(t,e,n),d=t.state.doc,u=d.slice(h.from,h.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(l=t.state.selection.to,a="end"):(l=t.state.selection.from,a="start"),t.input.lastKeyCode=null;let p=es(u.content,h.doc.content,h.from,l,a);if((Rn&&t.input.lastIOSEnter>Date.now()-225||_n)&&o.some((t=>1==t.nodeType&&!Gi.test(t.nodeName)))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",(e=>e(t,yn(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!p){if(!(r&&c instanceof Pe&&!c.empty&&c.$head.sameParent(c.$anchor))||t.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let e=Yi(t,t.state.doc,h.sel);e&&!e.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(e))}return}p={start:c.from,endA:c.to,endB:c.to}}if(An&&t.cursorWrapper&&h.sel&&h.sel.anchor==t.cursorWrapper.deco.from&&h.sel.head==h.sel.anchor){let t=p.endB-p.start;h.sel={anchor:h.sel.anchor+t,head:h.sel.anchor+t}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof Pe&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Mn&&On<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>h.from&&"  "==h.doc.textBetween(p.start-h.from-1,p.start-h.from+1)&&(p.start--,p.endA--,p.endB--);let f,m=h.doc.resolveNoCache(p.start-h.from),g=h.doc.resolveNoCache(p.endB-h.from),y=d.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Rn&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!w&&m.pos<h.doc.content.size&&(f=ze.findFrom(h.doc.resolve(m.pos+1),1,!0))&&f.head==g.pos)&&t.someProp("handleKeyDown",(e=>e(t,yn(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>p.start&&Qi(d,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",(e=>e(t,yn(8,"Backspace")))))return void(_n&&An&&t.domObserver.suppressSelectionUpdates());An&&_n&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),_n&&!w&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==p.endA&&(p.endB-=2,g=h.doc.resolveNoCache(p.endB-h.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,yn(13,"Enter"))}))}),20));let v,b,x,k=p.start,S=p.endA;if(w)if(m.pos==g.pos)Mn&&On<=11&&0==m.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>qr(t)),20)),v=t.state.tr.delete(k,S),b=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(x=Zi(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))v=t.state.tr,"add"==x.type?v.addMark(k,S,x.mark):v.removeMark(k,S,x.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let e=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",(n=>n(t,k,S,e))))return;v=t.state.tr.insertText(e,k,S)}if(v||(v=t.state.tr.replace(k,S,h.doc.slice(p.start-h.from,p.endB-h.from))),h.sel){let e=Yi(t,v.doc,h.sel);e&&!(An&&_n&&t.composing&&e.empty&&(p.start!=p.endB||t.input.lastAndroidDelete<Date.now()-100)&&(e.head==k||e.head==v.mapping.map(S)-1)||Mn&&e.empty&&e.head==k)&&v.setSelection(e)}b&&v.ensureMarks(b),t.dispatch(v.scrollIntoView())}function Yi(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:eo(t,e.resolve(n.anchor),e.resolve(n.head))}function Zi(t,e){let n,r,o,i=t.firstChild.marks,s=e.firstChild.marks,l=i,a=s;for(let c=0;c<s.length;c++)l=s[c].removeFromSet(l);for(let c=0;c<i.length;c++)a=i[c].removeFromSet(a);if(1==l.length&&0==a.length)r=l[0],n="add",o=t=>t.mark(r.addToSet(t.marks));else{if(0!=l.length||1!=a.length)return null;r=a[0],n="remove",o=t=>t.mark(r.removeFromSet(t.marks))}let h=[];for(let c=0;c<e.childCount;c++)h.push(o(e.child(c)));if(c.from(h).eq(t))return{mark:r,type:n}}function Qi(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||ts(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(ts(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||ts(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function ts(t,e,n){let r=t.depth,o=e?t.end():t.pos;while(r>0&&(e||t.indexAfter(r)==t.node(r).childCount))r--,o++,e=!1;if(n){let e=t.node(r).maybeChild(t.indexAfter(r));while(e&&!e.isLeaf)e=e.firstChild,o++}return o}function es(t,e,n,r,o){let i=t.findDiffStart(e,n);if(null==i)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if("end"==o){let t=Math.max(0,i-Math.min(s,l));r-=s+t-i}if(s<i&&t.size<e.size){let t=r<=i&&r>=s?i-r:0;i-=t,l=i+(l-s),s=i}else if(l<i){let t=r<=i&&r>=l?i-r:0;i-=t,s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}class ns{constructor(t,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 Vo,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(hs),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=ss(this),is(this),this.nodeViews=as(this),this.docView=Sr(this.state.doc,rs(this),Bi(this),this.dom,this),this.domObserver=new ji(this,((t,e,n,r)=>Xi(this,t,e,n,r))),this.domObserver.start(),Fo(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ho(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(hs),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let n in this._props)e[n]=this._props[n];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){let n=this.state,r=!1,o=!1;t.storedMarks&&this.composing&&(ci(this),o=!0),this.state=t;let i=n.plugins!=t.plugins||this._props.plugins!=e.plugins;if(i||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=as(this);cs(t,this.nodeViews)&&(this.nodeViews=t,r=!0)}(i||e.handleDOMEvents!=this._props.handleDOMEvents)&&Ho(this),this.editable=ss(this),is(this);let s=Bi(this),l=rs(this),a=n.plugins==t.plugins||n.doc.eq(t.doc)?t.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(t.doc,l,s);!c&&t.selection.eq(n.selection)||(o=!0);let h="preserve"==a&&o&&null==this.dom.style.overflowAnchor&&Ln(this);if(o){this.domObserver.stop();let e=c&&(Mn||An)&&!this.composing&&!n.selection.empty&&!t.selection.empty&&ls(n.selection,t.selection);if(c){let n=An?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(t.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Sr(t.doc,l,s,this.dom,this)),n&&!this.trackWrites&&(e=!0)}e||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&oo(this))?qr(this,e):(Qr(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==a?this.dom.scrollTop=0:"to selection"==a?this.scrollToSelection():h&&Hn(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof Ve){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&Fn(this,e.getBoundingClientRect(),t)}else Fn(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;while(t=this.pluginViews.pop())t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}someProp(t,e){let n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[t];if(null!=r&&(n=e?e(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[t];if(null!=r&&(n=e?e(r):r))return n}}hasFocus(){if(Mn){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;while(t&&this.dom!=t&&this.dom.contains(t)){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&qn(this.dom),qr(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return t||document}posAtCoords(t){return tr(this,t)}coordsAtPos(t,e=1){return rr(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return pr(this,e||this.state,t)}pasteHTML(t,e){return gi(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return gi(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(jo(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Bi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return qo(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return Tn&&11===this.root.nodeType&&wn(this.dom.ownerDocument)==this.dom?qi(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function rs(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),e.translate="no",t.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t&&(e.class+=" "+n[t]),"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))})),[Si.node(0,t.state.doc.content.size,e)]}function is(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Si.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ss(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function ls(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function as(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function cs(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function hs(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function ds(t={}){return new en({view(e){return new us(e,t)}})}class us{constructor(t,e){this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let n=t=>{this[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent;if(n){let n=e.nodeBefore,r=e.nodeAfter;if(n||r){let e=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(e){let o=e.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos);t={left:e.left-this.width/2,right:e.left+this.width/2,top:e.top,bottom:e.bottom}}let r,o,i=this.editorView.dom.offsetParent;if(this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!i||i==document.body&&"static"==getComputedStyle(i).position)r=-pageXOffset,o=-pageYOffset;else{let t=i.getBoundingClientRect();r=t.left-i.scrollLeft,o=t.top-i.scrollTop}this.element.style.left=t.left-r+"px",this.element.style.top=t.top-o+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,e,t):r;if(e&&!o){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=pe(this.editorView.state.doc,t,this.editorView.dragging.slice);null!=e&&(t=e)}this.setCursor(t),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}for(var ps={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},fs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ms="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),gs=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),ys="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ws=gs||ms&&+ms[1]<57,vs=0;vs<10;vs++)ps[48+vs]=ps[96+vs]=String(vs);for(vs=1;vs<=24;vs++)ps[vs+111]="F"+vs;for(vs=65;vs<=90;vs++)ps[vs]=String.fromCharCode(vs+32),fs[vs]=String.fromCharCode(vs);for(var bs in ps)fs.hasOwnProperty(bs)||(fs[bs]=ps[bs]);function xs(t){var e=ws&&(t.ctrlKey||t.altKey||t.metaKey)||ys&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key,n=!e&&t.key||(t.shiftKey?fs:ps)[t.keyCode]||t.key||"Unidentified";return"Esc"==n&&(n="Escape"),"Del"==n&&(n="Delete"),"Left"==n&&(n="ArrowLeft"),"Up"==n&&(n="ArrowUp"),"Right"==n&&(n="ArrowRight"),"Down"==n&&(n="ArrowDown"),n}const ks="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Ss(t){let e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let l=0;l<i.length-1;l++){let t=i[l];if(/^(cmd|meta|m)$/i.test(t))o=!0;else if(/^a(lt)?$/i.test(t))e=!0;else if(/^(c|ctrl|control)$/i.test(t))n=!0;else if(/^s(hift)?$/i.test(t))r=!0;else{if(!/^mod$/i.test(t))throw new Error("Unrecognized modifier name: "+t);ks?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function Cs(t){let e=Object.create(null);for(let n in t)e[Ss(n)]=t[n];return e}function Ms(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Os(t){return new en({props:{handleKeyDown:Ns(t)}})}function Ns(t){let e=Cs(t);return function(t,n){let r,o=xs(n),i=e[Ms(o,n)];if(i&&i(t.state,t.dispatch,t))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=e[Ms(o,n,!1)];if(r&&r(t.state,t.dispatch,t))return!0}if((n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=ps[n.keyCode])&&r!=o){let o=e[Ms(r,n)];if(o&&o(t.state,t.dispatch,t))return!0}}return!1}}class Es extends ze{constructor(t){super(t,t)}map(t,e){let n=t.resolve(e.map(this.head));return Es.valid(n)?new Es(n):ze.near(n)}content(){return m.empty}eq(t){return t instanceof Es&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Es(t.resolve(e.pos))}getBookmark(){return new As(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!Ds(t)||!Ts(t))return!1;let n=e.type.spec.allowGapCursor;if(null!=n)return n;let r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,e,n=!1){t:for(;;){if(!n&&Es.valid(t))return t;let r=t.pos,o=null;for(let n=t.depth;;n--){let i=t.node(n);if(e>0?t.indexAfter(n)<i.childCount:t.index(n)>0){o=i.child(e>0?t.indexAfter(n):t.index(n)-1);break}if(0==n)return null;r+=e;let s=t.doc.resolve(r);if(Es.valid(s))return s}for(;;){let i=e>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ve.isSelectable(o)){t=t.doc.resolve(r+o.nodeSize*e),n=!1;continue t}break}o=i,r+=e;let s=t.doc.resolve(r);if(Es.valid(s))return s}return null}}}Es.prototype.visible=!1,Es.findFrom=Es.findGapCursorFrom,ze.jsonID("gapcursor",Es);class As{constructor(t){this.pos=t}map(t){return new As(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return Es.valid(e)?new Es(e):ze.near(e)}}function Ds(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(0!=n)for(let t=r.child(n-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}function Ts(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(let t=r.child(n);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}function Rs(){return new en({props:{decorations:Ps,createSelectionBetween(t,e,n){return e.pos==n.pos&&Es.valid(n)?new Es(n):null},handleClick:Is,handleKeyDown:zs,handleDOMEvents:{beforeinput:$s}}})}const zs=Ns({ArrowLeft:_s("horiz",-1),ArrowRight:_s("horiz",1),ArrowUp:_s("vert",-1),ArrowDown:_s("vert",1)});function _s(t,e){const n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){let i=t.selection,s=e>0?i.$to:i.$from,l=i.empty;if(i instanceof Pe){if(!o.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=t.doc.resolve(e>0?s.after():s.before())}let a=Es.findGapCursorFrom(s,e,l);return!!a&&(r&&r(t.tr.setSelection(new Es(a))),!0)}}function Is(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Es.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Ve.isSelectable(t.state.doc.nodeAt(o.inside)))&&(t.dispatch(t.state.tr.setSelection(new Es(r))),!0)}function $s(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof Es))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=c.empty;for(let s=r.length-1;s>=0;s--)o=c.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new m(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Ps(t){if(!(t.selection instanceof Es))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Oi.create(t.doc,[Si.widget(t.selection.head,e,{key:"gapcursor"})])}const Bs=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Vs(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Fs=(t,e,n)=>{let r=Vs(t,n);if(!r)return!1;let o=Hs(r);if(!o){let n=r.blockRange(),o=n&&Yt(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&ol(t,o,e))return!0;if(0==r.parent.content.size&&(Ls(i,"end")||Ve.isSelectable(i))){let n=fe(t.doc,r.before(),r.after(),m.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(Ls(i,"end")?ze.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):Ve.create(r.doc,o.pos-i.nodeSize)),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function Ls(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const js=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Hs(r)}let s=i&&i.nodeBefore;return!(!s||!Ve.isSelectable(s))&&(e&&e(t.tr.setSelection(Ve.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Hs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Js(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Ws=(t,e,n)=>{let r=Js(t,n);if(!r)return!1;let o=Ks(r);if(!o)return!1;let i=o.nodeAfter;if(ol(t,o,e))return!0;if(0==r.parent.content.size&&(Ls(i,"start")||Ve.isSelectable(i))){let n=fe(t.doc,r.before(),r.after(),m.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(Ls(i,"start")?ze.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Ve.create(r.doc,r.mapping.map(o.pos))),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},qs=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Ks(r)}let s=i&&i.nodeAfter;return!(!s||!Ve.isSelectable(s))&&(e&&e(t.tr.setSelection(Ve.create(t.doc,i.pos)).scrollIntoView()),!0)};function Ks(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Us=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Yt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Gs=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)};function Xs(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Ys=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Xs(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let r=n.after(),o=t.tr.replaceWith(r,r,s.createAndFill());o.setSelection(ze.near(o.doc.resolve(r),1)),e(o.scrollIntoView())}return!0},Zs=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Le||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Xs(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(n,i.createAndFill());s.setSelection(Pe.create(s.doc,n+1)),e(s.scrollIntoView())}return!0},Qs=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(le(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Yt(r);return null!=o&&(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function tl(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Ve&&e.selection.node.isBlock)return!(!r.parentOffset||!le(e.doc,r.pos))&&(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let i=o.parentOffset==o.parent.content.size,s=e.tr;(e.selection instanceof Pe||e.selection instanceof Le)&&s.deleteSelection();let l=0==r.depth?null:Xs(r.node(-1).contentMatchAt(r.indexAfter(-1))),a=t&&t(o.parent,i),c=a?[a]:i&&l?[{type:l}]:void 0,h=le(s.doc,s.mapping.map(r.pos),1,c);if(c||h||!le(s.doc,s.mapping.map(r.pos),1,l?[{type:l}]:void 0)||(l&&(c=[{type:l}]),h=!0),h&&(s.split(s.mapping.map(r.pos),1,c),!i&&!r.parentOffset&&r.parent.type!=l)){let t=s.mapping.map(r.before()),e=s.doc.resolve(t);l&&r.node(-1).canReplaceWith(e.index(),e.index()+1,l)&&s.setNodeMarkup(s.mapping.map(r.before()),l)}n(s.scrollIntoView())}return!0}}const el=tl(),nl=(t,e)=>(e&&e(t.tr.setSelection(new Le(t.doc))),!0);function rl(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!ce(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}function ol(t,e,n){let r,o,i=e.nodeBefore,s=e.nodeAfter;if(i.type.spec.isolating||s.type.spec.isolating)return!1;if(rl(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&o.matchType(r[0]||s.type).validEnd){if(n){let o=e.pos+s.nodeSize,l=c.empty;for(let t=r.length-1;t>=0;t--)l=c.from(r[t].create(null,l));l=c.from(i.copy(l));let a=t.tr.step(new Wt(e.pos-1,o,e.pos,o,new m(l,1,0),r.length,!0)),h=o+2*r.length;ce(a.doc,h)&&a.join(h),n(a.scrollIntoView())}return!0}let a=ze.findFrom(e,1),h=a&&a.$from.blockRange(a.$to),d=h&&Yt(h);if(null!=d&&d>=e.depth)return n&&n(t.tr.lift(h,d).scrollIntoView()),!0;if(l&&Ls(s,"start",!0)&&Ls(i,"end")){let r=i,o=[];for(;;){if(o.push(r),r.isTextblock)break;r=r.lastChild}let l=s,a=1;for(;!l.isTextblock;l=l.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,l.content)){if(n){let r=c.empty;for(let t=o.length-1;t>=0;t--)r=c.from(o[t].copy(r));let i=t.tr.step(new Wt(e.pos-o.length,e.pos+s.nodeSize,e.pos+a,e.pos+s.nodeSize-a,new m(r,o.length,0),0,!0));n(i.scrollIntoView())}return!0}}return!1}function il(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;while(o.node(i).isInline){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(e.tr.setSelection(Pe.create(e.doc,t<0?o.start(i):o.end(i)))),!0)}}const sl=il(-1),ll=il(1);function al(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&Qt(s,t,e);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}function cl(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)o=!0;else{let e=n.doc.resolve(i),r=e.index();o=e.parent.canReplaceWith(r,r+1,t)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,t,e)}r(o.scrollIntoView())}return!0}}function hl(t,e,n){for(let r=0;r<e.length;r++){let{$from:o,$to:i}=e[r],s=0==o.depth&&(t.inlineContent&&t.type.allowsMarkType(n));if(t.nodesBetween(o.pos,i.pos,(t=>{if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)})),s)return!0}return!1}function dl(t,e=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!hl(n.doc,s,t))return!1;if(r)if(i)t.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{let o=!1,i=n.tr;for(let e=0;!o&&e<s.length;e++){let{$from:r,$to:i}=s[e];o=n.doc.rangeHasMark(r.pos,i.pos,t)}for(let n=0;n<s.length;n++){let{$from:r,$to:l}=s[n];if(o)i.removeMark(r.pos,l.pos,t);else{let n=r.pos,o=l.pos,s=r.nodeAfter,a=l.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,h=a&&a.isText?/\s*$/.exec(a.text)[0].length:0;n+c<o&&(n+=c,o-=h),i.addMark(n,o,t.create(e))}}r(i.scrollIntoView())}return!0}}function ul(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}let pl=ul(Bs,Fs,js),fl=ul(Bs,Ws,qs);const ml={Enter:ul(Gs,Zs,Qs,el),"Mod-Enter":Ys,Backspace:pl,"Mod-Backspace":pl,"Shift-Backspace":pl,Delete:fl,"Mod-Delete":fl,"Mod-a":nl},gl={"Ctrl-h":ml["Backspace"],"Alt-Backspace":ml["Mod-Backspace"],"Ctrl-d":ml["Delete"],"Ctrl-Alt-Backspace":ml["Mod-Delete"],"Alt-Delete":ml["Mod-Delete"],"Alt-d":ml["Mod-Delete"],"Ctrl-a":sl,"Ctrl-e":ll};for(let r in ml)gl[r]=ml[r];const yl="undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform(),wl=yl?gl:ml;class vl{constructor(t,e){this.match=t,this.match=t,this.handler="string"==typeof e?bl(e):e}}function bl(t){return function(e,n,r,o){let i=t;if(n[1]){let t=n[0].lastIndexOf(n[1]);i+=n[0].slice(t+n[1].length),r+=t;let e=r-o;e>0&&(i=n[0].slice(t-e,t)+i,r=o)}return e.tr.insertText(i,r,o)}}const xl=500;function kl({rules:t}){let e=new en({state:{init(){return null},apply(t,e){let n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput(n,r,o,i){return Sl(n,r,o,i,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout((()=>{let{$cursor:r}=n.state.selection;r&&Sl(n,r.pos,r.pos,"",t,e)}))}}},isInputRules:!0});return e}function Sl(t,e,n,r,o,i){if(t.composing)return!1;let s=t.state,l=s.doc.resolve(e);if(l.parent.type.spec.code)return!1;let a=l.parent.textBetween(Math.max(0,l.parentOffset-xl),l.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let l=o[c].match.exec(a),h=l&&o[c].handler(s,l,e-(l[0].length-r.length),n);if(h)return t.dispatch(h.setMeta(i,{transform:h,from:e,to:n,text:r})),!0}return!1}const Cl=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(t))){if(e){let n=t.tr,r=o.transform;for(let t=r.steps.length-1;t>=0;t--)n.step(r.steps[t].invert(r.docs[t]));if(o.text){let e=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,t.schema.text(o.text,e))}else n.delete(o.from,o.to);e(n)}return!0}}return!1};new vl(/--$/,"—"),new vl(/\.\.\.$/,"…"),new vl(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new vl(/"$/,"”"),new vl(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new vl(/'$/,"’");function Ml(t,e,n=null,r){return new vl(t,((t,o,i,s)=>{let l=n instanceof Function?n(o):n,a=t.tr.delete(i,s),c=a.doc.resolve(i),h=c.blockRange(),d=h&&Qt(h,e,l);if(!d)return null;a.wrap(h,d);let u=a.doc.resolve(i-1).nodeBefore;return u&&u.type==e&&ce(a.doc,i-1)&&(!r||r(o,u))&&a.join(i-1),a}))}function Ol(t,e,n=null){return new vl(t,((t,r,o,i)=>{let s=t.doc.resolve(o),l=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,l):null}))}
  2. /*!
  3. * tiptap-utils v1.13.0
  4. * (c) 2021 überdosis GbR (limited liability)
  5. * @license MIT
  6. */
  7. function Nl(t,e){return e?t.createChecked(null,e):t.createAndFill()}function El(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach((n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)})),t.cached.tableNodeTypes=e,e}function Al(t,e,n,r,o){const i=El(t),s=[],l=[];for(let c=0;c<n;c+=1){const t=Nl(i.cell,o);if(t&&l.push(t),r){const t=Nl(i.header_cell,o);t&&s.push(t)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&0===c?s:l));return i.table.createChecked(null,a)}function Dl(t,e){return Array.isArray(t)&&t.indexOf(e.type)>-1||e.type===t}function Tl(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Rl(t){return e=>Tl(e.$from,t)}function zl(t){return t instanceof Ve}function _l(t){return function(e){if(zl(e)){const{node:n}=e,{$from:r}=e;if(Dl(t,n))return{node:n,pos:r.pos,depth:r.depth}}}}function Il(t,e){const{from:n,to:r}=t.selection;let o=[];t.doc.nodesBetween(n,r,(t=>{o=[...o,...t.marks]}));const i=o.find((t=>t.type.name===e.name));return i?i.attrs:{}}function $l(t=null,e=null){if(!t||!e)return!1;const n=t.parent.childAfter(t.parentOffset);if(!n.node)return!1;const r=n.node.marks.find((t=>t.type===e));if(!r)return!1;let o=t.index(),i=t.start()+n.offset,s=o+1,l=i+n.node.nodeSize;while(o>0&&r.isInSet(t.parent.child(o-1).marks))o-=1,i-=t.parent.child(o).nodeSize;while(s<t.parent.childCount&&r.isInSet(t.parent.child(s).marks))l+=t.parent.child(s).nodeSize,s+=1;return{from:i,to:l}}function Pl(t,e){const{from:n,to:r}=t.selection;let o=[];t.doc.nodesBetween(n,r,(t=>{o=[...o,t]}));const i=o.reverse().find((t=>t.type.name===e.name));return i?i.attrs:{}}function Bl(t,e){const{from:n,$from:r,to:o,empty:i}=t.selection;return i?!!e.isInSet(t.storedMarks||r.marks()):!!t.doc.rangeHasMark(n,o,e)}function Vl(t,e,n={}){const r=t=>t.type===e,o=_l(e)(t.selection)||Rl(r)(t.selection);return Object.keys(n).length&&o?o.node.hasMarkup(e,{...o.node.attrs,...n}):!!o}var Fl=r(2740),Ll=r.n(Fl);function jl(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&0==s.startIndex){if(0==o.index(s.depth-1))return!1;let t=n.doc.resolve(s.start-2);a=new R(t,t,s.depth),s.endIndex<s.parent.childCount&&(s=new R(o,n.doc.resolve(i.end(s.depth)),s.depth)),l=!0}let c=Qt(a,t,e,s);return!!c&&(r&&r(Hl(n.tr,s,c,l,t).scrollIntoView()),!0)}}function Hl(t,e,n,r,o){let i=c.empty;for(let d=n.length-1;d>=0;d--)i=c.from(n[d].type.create(n[d].attrs,i));t.step(new Wt(e.start-(r?2:0),e.end,e.start,e.end,new m(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==o&&(s=c+1);let l=n.length-s,a=e.start+n.length-(r?2:0),h=e.parent;for(let c=e.startIndex,d=e.endIndex,u=!0;c<d;c++,u=!1)!u&&le(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=h.child(c).nodeSize;return t}function Jl(t){return function(e,n){let{$from:r,$to:o,node:i}=e.selection;if(i&&i.isBlock||r.depth<2||!r.sameParent(o))return!1;let s=r.node(-1);if(s.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let o=c.empty,i=r.index(-1)?1:r.index(-2)?2:3;for(let t=r.depth-i;t>=r.depth-3;t--)o=c.from(r.node(t).copy(o));let s=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;o=o.append(c.from(t.createAndFill()));let l=r.before(r.depth-(i-1)),a=e.tr.replace(l,r.after(-s),new m(o,4-i,0)),h=-1;a.doc.nodesBetween(l,a.doc.content.size,((t,e)=>{if(h>-1)return!1;t.isTextblock&&0==t.content.size&&(h=e+1)})),h>-1&&a.setSelection(ze.near(a.doc.resolve(h))),n(a.scrollIntoView())}return!0}let l=o.pos==r.end()?s.contentMatchAt(0).defaultType:null,a=e.tr.delete(r.pos,o.pos),h=l?[null,{type:l}]:void 0;return!!le(a.doc,r.pos,2,h)&&(n&&n(a.split(r.pos,2,h).scrollIntoView()),!0)}}function Wl(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,(e=>e.childCount>0&&e.firstChild.type==t));return!!i&&(!n||(r.node(i.depth-1).type==t?ql(e,n,t,i):Kl(e,n,i)))}}function ql(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Wt(i-1,s,i,s,new m(c.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new R(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=Yt(r);if(null==l)return!1;o.lift(r,l);let a=o.mapping.map(i,-1)-1;return ce(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function Kl(t,e,n){let r=t.tr,o=n.parent;for(let c=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)c-=o.child(f).nodeSize,r.delete(c-1,c+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==o.childCount,h=i.node(-1),d=i.index(-1);if(!h.canReplace(d+(l?0:1),d+1,s.content.append(a?c.empty:c.from(o))))return!1;let u=i.pos,p=u+s.nodeSize;return r.step(new Wt(u-(l?1:0),p+(a?1:0),u+1,p-1,new m((l?c.empty:c.from(o.copy(c.empty))).append(a?c.empty:c.from(o.copy(c.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Ul(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,(e=>e.childCount>0&&e.firstChild.type==t));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let r=a.lastChild&&a.lastChild.type==l.type,o=c.from(r?t.create():null),s=new m(c.from(t.create(null,c.from(l.type.create(null,o)))),r?3:1,0),h=i.start,d=i.end;n(e.tr.step(new Wt(h-(r?3:1),d,h,d,s,1,!0)).scrollIntoView())}return!0}}function Gl(t,e,n){let r=[];return n.doc.nodesBetween(t,e,((t,e)=>{r=[...r,...t.marks.map((n=>({start:e,end:e+t.nodeSize,mark:n})))]})),r}function Xl(t,e,n){return new vl(t,((t,r,o,i)=>{const s=n instanceof Function?n(r):n,{tr:l}=t,a=r.length-1;let c=i,h=o;if(r[a]){const n=o+r[0].indexOf(r[a-1]),s=n+r[a-1].length-1,d=n+r[a-1].lastIndexOf(r[a]),u=d+r[a].length,p=Gl(o,i,t).filter((t=>{const{excluded:n}=t.mark.type;return n.find((t=>t.name===e.name))})).filter((t=>t.end>n));if(p.length)return!1;u<s&&l.delete(u,s),d>n&&l.delete(n,d),h=n,c=h+r[a].length}return l.addMark(h,c,e.create(s)),l.removeStoredMark(e),l}))}function Yl(t,e,n){const r=o=>{const i=[];return o.forEach((o=>{if(o.isText){const{text:r}=o;let s,l=0;do{if(s=t.exec(r),s){const t=s.index,r=t+s[0].length,a=n instanceof Function?n(s[0]):n;t>0&&i.push(o.cut(l,t)),i.push(o.cut(t,r).mark(e.create(a).addToSet(o.marks))),l=r}}while(s);l<r.length&&i.push(o.cut(l))}else i.push(o.copy(r(o.content)))})),c.fromArray(i)};return new en({props:{transformPasted:t=>new m(r(t.content),t.openStart,t.openEnd)}})}function Zl(t,e,n){const r=(o,i)=>{const s=[];return o.forEach((o=>{if(o.isText){const{text:r,marks:l}=o;let a,c=0;const h=!!l.filter((t=>"link"===t.type.name))[0];while(!h&&null!==(a=t.exec(r)))if(i&&i.type.allowsMarkType(e)&&a[1]){const t=a.index,r=t+a[0].length,i=t+a[0].indexOf(a[1]),l=i+a[1].length,h=n instanceof Function?n(a):n;t>0&&s.push(o.cut(c,t)),s.push(o.cut(i,l).mark(e.create(h).addToSet(o.marks))),c=r}c<r.length&&s.push(o.cut(c))}else s.push(o.copy(r(o.content,o)))})),c.fromArray(s)};return new en({props:{transformPasted:t=>new m(r(t.content),t.openStart,t.openEnd)}})}function Ql(t){return(e,n)=>{const{tr:r,selection:o}=e;let{from:i,to:s}=o;const{$from:l,empty:a}=o;if(a){const e=$l(l,t);i=e.from,s=e.to}return r.removeMark(i,s,t),n(r)}}function ta(t,e,n=1,r){const o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,h=n-2;c>i;c--,h--){const t=o.node(c),e=o.index(c);if(t.type.spec.isolating)return!1;let n=t.content.cutByIndex(e,t.childCount);const i=r&&r[h]||t;if(i!=t&&(n=n.replaceChild(0,i.type.create(i.attrs))),!t.canReplace(e+1,t.childCount))return!1}const l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function ea(t){return function(e,n){const{$from:r,$to:o,node:i}=e.selection;if(i&&i.isBlock||r.depth<2||!r.sameParent(o))return!1;const s=r.node(-1);if(s.type!=t)return!1;if(0==r.parent.content.size){if(2==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let o=c.empty;const i=r.index(-1)>0;for(let t=r.depth-(i?1:2);t>=r.depth-3;t--)o=c.from(r.node(t).copy(o));o=o.append(c.from(t.createAndFill()));const s=e.tr.replace(r.before(i?null:-1),r.after(-3),new m(o,i?3:2,2));s.setSelection(e.selection.constructor.near(s.doc.resolve(r.pos+(i?3:2)))),n(s.scrollIntoView())}return!0}const l=o.pos==r.end()?s.contentMatchAt(r.indexAfter(-1)).defaultType:null,a=e.tr.delete(r.pos,o.pos);let h=l&&[{type:t},{type:l}];return h||(h=[{type:t},null]),!!ta(a.doc,r.pos,2,h)&&(n&&n(a.split(r.pos,2,h).scrollIntoView()),!0)}}function na(t,e,n={}){return(r,o,i)=>{const s=Vl(r,t,n);return s?cl(e)(r,o,i):cl(t,n)(r,o,i)}}function ra(t,e){return t.type===e.nodes.bullet_list||t.type===e.nodes.ordered_list||t.type===e.nodes.todo_list}function oa(t,e){return(n,r,o)=>{const{schema:i,selection:s}=n,{$from:l,$to:a}=s,c=l.blockRange(a);if(!c)return!1;const h=Rl((t=>ra(t,i)))(s);if(c.depth>=1&&h&&c.depth-h.depth<=1){if(h.node.type===t)return Wl(e)(n,r,o);if(ra(h.node,i)&&t.validContent(h.node.content)){const{tr:e}=n;return e.setNodeMarkup(h.pos,t),r&&r(e),!1}}return jl(t)(n,r,o)}}function ia(t,e={}){return(n,r,o)=>{const i=Vl(n,t,e);return i?Us(n,r):al(t,e)(n,r,o)}}function sa(t,e){return(n,r)=>{const{tr:o,selection:i,doc:s}=n,{ranges:l,empty:a}=i;if(a){const{from:n,to:r}=$l(i.$from,t);s.rangeHasMark(n,r,t)&&o.removeMark(n,r,t),o.addMark(n,r,t.create(e))}else l.forEach((n=>{const{$to:r,$from:i}=n;s.rangeHasMark(i.pos,r.pos,t)&&o.removeMark(i.pos,r.pos,t),o.addMark(i.pos,r.pos,t.create(e))}));return r(o)}}
  8. /*!
  9. * tiptap v1.32.1
  10. * (c) 2021 überdosis GbR (limited liability)
  11. * @license MIT
  12. */
  13. function la(t){return t.replace(/(?:^\w|[A-Z]|\b\w)/g,((t,e)=>0===e?t.toLowerCase():t.toUpperCase())).replace(/\s+/g,"")}class aa{constructor(t,{editor:e,extension:n,parent:r,node:o,view:i,decorations:s,getPos:l}){this.component=t,this.editor=e,this.extension=n,this.parent=r,this.node=o,this.view=i,this.decorations=s,this.isNode=!!this.node.marks,this.isMark=!this.isNode,this.getPos=this.isMark?this.getMarkPos:l,this.captureEvents=!0,this.dom=this.createDOM(),this.contentDOM=this.vm.$refs.content}createDOM(){const t=Ll().extend(this.component),e={editor:this.editor,node:this.node,view:this.view,getPos:()=>this.getPos(),decorations:this.decorations,selected:!1,options:this.extension.options,updateAttrs:t=>this.updateAttrs(t)};return"function"===typeof this.extension.setSelection&&(this.setSelection=this.extension.setSelection),"function"===typeof this.extension.update&&(this.update=this.extension.update),this.vm=new t({parent:this.parent,propsData:e}).$mount(),this.vm.$el}update(t,e){return t.type===this.node.type&&(t===this.node&&this.decorations===e||(this.node=t,this.decorations=e,this.updateComponentProps({node:t,decorations:e})),!0)}updateComponentProps(t){if(!this.vm._props)return;const e=Ll().config.silent;Ll().config.silent=!0,Object.entries(t).forEach((([t,e])=>{this.vm._props[t]=e})),Ll().config.silent=e}updateAttrs(t){if(!this.view.editable)return;const{state:e}=this.view,{type:n}=this.node,r=this.getPos(),o={...this.node.attrs,...t},i=this.isMark?e.tr.removeMark(r.from,r.to,n).addMark(r.from,r.to,n.create(o)):e.tr.setNodeMarkup(r,null,o);this.view.dispatch(i)}ignoreMutation(t){return"selection"!==t.type&&(!this.contentDOM||!this.contentDOM.contains(t.target))}stopEvent(t){if("function"===typeof this.extension.stopEvent)return this.extension.stopEvent(t);const e=!!this.extension.schema.draggable;if(e&&"mousedown"===t.type){const e=t.target.closest&&t.target.closest("[data-drag-handle]"),n=e&&(this.dom===e||this.dom.contains(e));n&&(this.captureEvents=!1,document.addEventListener("dragend",(()=>{this.captureEvents=!0}),{once:!0}))}const n="copy"===t.type,r="paste"===t.type,o="cut"===t.type,i=t.type.startsWith("drag")||"drop"===t.type;return!(e&&i||n||r||o)&&this.captureEvents}selectNode(){this.updateComponentProps({selected:!0})}deselectNode(){this.updateComponentProps({selected:!1})}getMarkPos(){const t=this.view.posAtDOM(this.dom),e=this.view.state.doc.resolve(t),n=$l(e,this.node.type);return n}destroy(){this.vm.$destroy()}}class ca{on(t,e){return this._callbacks=this._callbacks||{},this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){this._callbacks=this._callbacks||{};const n=this._callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){if(arguments.length){const n=this._callbacks?this._callbacks[t]:null;n&&(e?this._callbacks[t]=n.filter((t=>t!==e)):delete this._callbacks[t])}else this._callbacks={};return this}}class ha{constructor(t={}){this.options={...this.defaultOptions,...t}}init(){return null}bindEditor(t=null){this.editor=t}get name(){return null}get type(){return"extension"}get defaultOptions(){return{}}get plugins(){return[]}inputRules(){return[]}pasteRules(){return[]}keys(){return{}}}class da{constructor(t=[],e){t.forEach((t=>{t.bindEditor(e),t.init()})),this.extensions=t}get nodes(){return this.extensions.filter((t=>"node"===t.type)).reduce(((t,{name:e,schema:n})=>({...t,[e]:n})),{})}get options(){const{view:t}=this;return this.extensions.reduce(((e,n)=>({...e,[n.name]:new Proxy(n.options,{set(e,n,r){const o=e[n]!==r;return Object.assign(e,{[n]:r}),o&&t.updateState(t.state),!0}})})),{})}get marks(){return this.extensions.filter((t=>"mark"===t.type)).reduce(((t,{name:e,schema:n})=>({...t,[e]:n})),{})}get plugins(){return this.extensions.filter((t=>t.plugins)).reduce(((t,{plugins:e})=>[...t,...e]),[])}keymaps({schema:t}){const e=this.extensions.filter((t=>["extension"].includes(t.type))).filter((t=>t.keys)).map((e=>e.keys({schema:t}))),n=this.extensions.filter((t=>["node","mark"].includes(t.type))).filter((t=>t.keys)).map((e=>e.keys({type:t[`${e.type}s`][e.name],schema:t})));return[...e,...n].map((t=>Os(t)))}inputRules({schema:t,excludedExtensions:e}){if(!(e instanceof Array)&&e)return[];const n=e instanceof Array?this.extensions.filter((t=>!e.includes(t.name))):this.extensions,r=n.filter((t=>["extension"].includes(t.type))).filter((t=>t.inputRules)).map((e=>e.inputRules({schema:t}))),o=n.filter((t=>["node","mark"].includes(t.type))).filter((t=>t.inputRules)).map((e=>e.inputRules({type:t[`${e.type}s`][e.name],schema:t})));return[...r,...o].reduce(((t,e)=>[...t,...e]),[])}pasteRules({schema:t,excludedExtensions:e}){if(!(e instanceof Array)&&e)return[];const n=e instanceof Array?this.extensions.filter((t=>!e.includes(t.name))):this.extensions,r=n.filter((t=>["extension"].includes(t.type))).filter((t=>t.pasteRules)).map((e=>e.pasteRules({schema:t}))),o=n.filter((t=>["node","mark"].includes(t.type))).filter((t=>t.pasteRules)).map((e=>e.pasteRules({type:t[`${e.type}s`][e.name],schema:t})));return[...r,...o].reduce(((t,e)=>[...t,...e]),[])}commands({schema:t,view:e}){return this.extensions.filter((t=>t.commands)).reduce(((n,r)=>{const{name:o,type:i}=r,s={},l=r.commands({schema:t,...["node","mark"].includes(i)?{type:t[`${i}s`][o]}:{}}),a=(t,n)=>!!e.editable&&(e.focus(),t(n)(e.state,e.dispatch,e)),c=(t,e)=>{Array.isArray(e)?s[t]=t=>e.forEach((e=>a(e,t))):"function"===typeof e&&(s[t]=t=>a(e,t))};return"object"===typeof l?Object.entries(l).forEach((([t,e])=>{c(t,e)})):c(o,l),{...n,...s}}),{})}}function ua(t){{const e=document.createElement("style");e.type="text/css",e.textContent=t;const{head:n}=document,{firstChild:r}=n;r?n.insertBefore(e,r):n.appendChild(e)}}class pa extends ha{constructor(t={}){super(t)}get type(){return"mark"}get view(){return null}get schema(){return null}command(){return()=>{}}}function fa(t=0,e=0,n=0){return Math.min(Math.max(parseInt(t,10),e),n)}class ma extends ha{constructor(t={}){super(t)}get type(){return"node"}get view(){return null}get schema(){return null}command(){return()=>{}}}class ga extends ma{get name(){return"doc"}get schema(){return{content:"block+"}}}class ya extends ma{get name(){return"paragraph"}get schema(){return{content:"inline*",group:"block",draggable:!1,parseDOM:[{tag:"p"}],toDOM:()=>["p",0]}}commands({type:t}){return()=>cl(t)}}class wa extends ma{get name(){return"text"}get schema(){return{group:"inline"}}}var va='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n';class ba extends ca{constructor(t={}){super(),this.defaultOptions={editorProps:{},editable:!0,autoFocus:null,extensions:[],content:"",topNode:"doc",emptyDocument:{type:"doc",content:[{type:"paragraph"}]},useBuiltInExtensions:!0,disableInputRules:!1,disablePasteRules:!1,dropCursor:{},enableDropCursor:!0,enableGapCursor:!0,parseOptions:{},injectCSS:!0,onInit:()=>{},onTransaction:()=>{},onUpdate:()=>{},onFocus:()=>{},onBlur:()=>{},onPaste:()=>{},onDrop:()=>{}},this.events=["init","transaction","update","focus","blur","paste","drop"],this.init(t)}init(t={}){this.setOptions({...this.defaultOptions,...t}),this.focused=!1,this.selection={from:0,to:0},this.element=document.createElement("div"),this.extensions=this.createExtensions(),this.nodes=this.createNodes(),this.marks=this.createMarks(),this.schema=this.createSchema(),this.plugins=this.createPlugins(),this.keymaps=this.createKeymaps(),this.inputRules=this.createInputRules(),this.pasteRules=this.createPasteRules(),this.view=this.createView(),this.commands=this.createCommands(),this.setActiveNodesAndMarks(),this.options.injectCSS&&ua(va),null!==this.options.autoFocus&&this.focus(this.options.autoFocus),this.events.forEach((t=>{this.on(t,this.options[la(`on ${t}`)]||(()=>{}))})),this.emit("init",{view:this.view,state:this.state}),this.extensions.view=this.view}setOptions(t){this.options={...this.options,...t},this.view&&this.state&&this.view.updateState(this.state)}get builtInExtensions(){return this.options.useBuiltInExtensions?[new ga,new wa,new ya]:[]}get state(){return this.view?this.view.state:null}createExtensions(){return new da([...this.builtInExtensions,...this.options.extensions],this)}createPlugins(){return this.extensions.plugins}createKeymaps(){return this.extensions.keymaps({schema:this.schema})}createInputRules(){return this.extensions.inputRules({schema:this.schema,excludedExtensions:this.options.disableInputRules})}createPasteRules(){return this.extensions.pasteRules({schema:this.schema,excludedExtensions:this.options.disablePasteRules})}createCommands(){return this.extensions.commands({schema:this.schema,view:this.view})}createNodes(){return this.extensions.nodes}createMarks(){return this.extensions.marks}createSchema(){return new rt({topNode:this.options.topNode,nodes:this.nodes,marks:this.marks})}createState(){return Qe.create({schema:this.schema,doc:this.createDocument(this.options.content),plugins:[...this.plugins,kl({rules:this.inputRules}),...this.pasteRules,...this.keymaps,Os({Backspace:Cl}),Os(wl),...this.options.enableDropCursor?[ds(this.options.dropCursor)]:[],...this.options.enableGapCursor?[Rs()]:[],new en({key:new on("editable"),props:{editable:()=>this.options.editable}}),new en({props:{attributes:{tabindex:0},handleDOMEvents:{focus:(t,e)=>{this.focused=!0,this.emit("focus",{event:e,state:t.state,view:t});const n=this.state.tr.setMeta("focused",!0);this.view.dispatch(n)},blur:(t,e)=>{this.focused=!1,this.emit("blur",{event:e,state:t.state,view:t});const n=this.state.tr.setMeta("focused",!1);this.view.dispatch(n)}}}}),new en({props:this.options.editorProps})]})}createDocument(t,e=this.options.parseOptions){if(null===t)return this.schema.nodeFromJSON(this.options.emptyDocument);if("object"===typeof t)try{return this.schema.nodeFromJSON(t)}catch(n){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",n),this.schema.nodeFromJSON(this.options.emptyDocument)}if("string"===typeof t){const n=`<div>${t}</div>`,r=new window.DOMParser,o=r.parseFromString(n,"text/html").body.firstElementChild;return it.fromSchema(this.schema).parse(o,e)}return!1}createView(){return new ns(this.element,{state:this.createState(),handlePaste:(...t)=>{this.emit("paste",...t)},handleDrop:(...t)=>{this.emit("drop",...t)},dispatchTransaction:this.dispatchTransaction.bind(this)})}setParentComponent(t=null){t&&this.view.setProps({nodeViews:this.initNodeViews({parent:t,extensions:[...this.builtInExtensions,...this.options.extensions]})})}initNodeViews({parent:t,extensions:e}){return e.filter((t=>["node","mark"].includes(t.type))).filter((t=>t.view)).reduce(((e,n)=>{const r=(e,r,o,i)=>{const s=n.view;return new aa(s,{editor:this,extension:n,parent:t,node:e,view:r,getPos:o,decorations:i})};return{...e,[n.name]:r}}),{})}dispatchTransaction(t){const e=this.state.apply(t);this.view.updateState(e),this.selection={from:this.state.selection.from,to:this.state.selection.to},this.setActiveNodesAndMarks(),this.emit("transaction",{getHTML:this.getHTML.bind(this),getJSON:this.getJSON.bind(this),state:this.state,transaction:t}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emitUpdate(t)}emitUpdate(t){this.emit("update",{getHTML:this.getHTML.bind(this),getJSON:this.getJSON.bind(this),state:this.state,transaction:t})}resolveSelection(t=null){if(this.selection&&null===t)return this.selection;if("start"===t||!0===t)return{from:0,to:0};if("end"===t){const{doc:t}=this.state;return{from:t.content.size,to:t.content.size}}return{from:t,to:t}}focus(t=null){if(this.view.focused&&null===t||!1===t)return;const{from:e,to:n}=this.resolveSelection(t);this.setSelection(e,n),setTimeout((()=>this.view.focus()),10)}setSelection(t=0,e=0){const{doc:n,tr:r}=this.state,o=fa(t,0,n.content.size),i=fa(e,0,n.content.size),s=Pe.create(n,o,i),l=r.setSelection(s);this.view.dispatch(l)}blur(){this.view.dom.blur()}getSchemaJSON(){return JSON.parse(JSON.stringify({nodes:this.extensions.nodes,marks:this.extensions.marks}))}getHTML(){const t=document.createElement("div"),e=xt.fromSchema(this.schema).serializeFragment(this.state.doc.content);return t.appendChild(e),t.innerHTML}getJSON(){return this.state.doc.toJSON()}setContent(t={},e=!1,n){const{doc:r,tr:o}=this.state,i=this.createDocument(t,n),s=Pe.create(r,0,r.content.size),l=o.setSelection(s).replaceSelectionWith(i,!1).setMeta("preventUpdate",!e);this.view.dispatch(l)}clearContent(t=!1){this.setContent(this.options.emptyDocument,t)}setActiveNodesAndMarks(){this.activeMarks=Object.entries(this.schema.marks).reduce(((t,[e,n])=>({...t,[e]:(t={})=>Bl(this.state,n,t)})),{}),this.activeMarkAttrs=Object.entries(this.schema.marks).reduce(((t,[e,n])=>({...t,[e]:Il(this.state,n)})),{}),this.activeNodes=Object.entries(this.schema.nodes).reduce(((t,[e,n])=>({...t,[e]:(t={})=>Vl(this.state,n,t)})),{})}getMarkAttrs(t=null){return this.activeMarkAttrs[t]}getNodeAttrs(t=null){return{...Pl(this.state,this.schema.nodes[t])}}get isActive(){return Object.entries({...this.activeMarks,...this.activeNodes}).reduce(((t,[e,n])=>({...t,[e]:(t={})=>n(t)})),{})}registerPlugin(t=null,e){const n="function"===typeof e?e(t,this.state.plugins):[t,...this.state.plugins],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(t=null){if(!t||!this.view.docView)return;const e=this.state.reconfigure({plugins:this.state.plugins.filter((e=>!e.key.startsWith(`${t}$`)))});this.view.updateState(e)}destroy(){this.view&&this.view.destroy()}}var xa={props:{editor:{default:null,type:Object}},watch:{editor:{immediate:!0,handler(t){t&&t.element&&this.$nextTick((()=>{this.$el.appendChild(t.element.firstChild),t.setParentComponent(this)}))}}},render(t){return t("div")},beforeDestroy(){this.editor.element=this.$el}};class ka{constructor({options:t}){this.options=t,this.preventHide=!1,this.mousedownHandler=this.handleClick.bind(this),this.options.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.blurHandler=()=>{this.preventHide?this.preventHide=!1:this.options.editor.emit("menubar:focusUpdate",!1)},this.options.editor.on("blur",this.blurHandler)}handleClick(){this.preventHide=!0}destroy(){this.options.element.removeEventListener("mousedown",this.mousedownHandler),this.options.editor.off("blur",this.blurHandler)}}function Sa(t){return new en({key:new on("menu_bar"),view(e){return new ka({editorView:e,options:t})}})}var Ca={props:{editor:{default:null,type:Object}},data(){return{focused:!1}},watch:{editor:{immediate:!0,handler(t){t&&this.$nextTick((()=>{t.registerPlugin(Sa({editor:t,element:this.$el})),this.focused=t.focused,t.on("focus",(()=>{this.focused=!0})),t.on("menubar:focusUpdate",(t=>{this.focused=t}))}))}}},render(){return this.editor?this.$scopedSlots.default({focused:this.focused,focus:this.editor.focus,commands:this.editor.commands,isActive:this.editor.isActive,getMarkAttrs:this.editor.getMarkAttrs.bind(this.editor),getNodeAttrs:this.editor.getNodeAttrs.bind(this.editor)}):null}};function Ma(t,e,n){const r=document.createRange();return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,Math.max(e,0)),r}function Oa(t,e){const n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function Na(t,e,n=!1){const{node:r,offset:o}=t.docView.domFromPos(e);let i,s;if(3===r.nodeType)n&&o<r.nodeValue.length?(Oa(Ma(r,o-1,o),-1),"right"):o<r.nodeValue.length&&(Oa(Ma(r,o,o+1),-1),"left");else if(r.firstChild){if(o<r.childNodes.length){const t=r.childNodes[o];Oa(3===t.nodeType?Ma(t):t,-1),"left"}if((!s||s.top===s.bottom)&&o){const t=r.childNodes[o-1];Oa(3===t.nodeType?Ma(t):t,1),"right"}}else r.getBoundingClientRect(),"left";const l=s[i];return{top:s.top,bottom:s.bottom,left:l,right:l}}class Ea{constructor({options:t,editorView:e}){this.options={element:null,keepInBounds:!0,onUpdate:()=>!1,...t},this.editorView=e,this.isActive=!1,this.left=0,this.bottom=0,this.top=0,this.preventHide=!1,this.mousedownHandler=this.handleClick.bind(this),this.options.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.focusHandler=({view:t})=>{this.update(t)},this.options.editor.on("focus",this.focusHandler),this.blurHandler=({event:t})=>{this.preventHide?this.preventHide=!1:this.hide(t)},this.options.editor.on("blur",this.blurHandler)}handleClick(){this.preventHide=!0}update(t,e){const{state:n}=t;if(t.composing)return;if(e&&e.doc.eq(n.doc)&&e.selection.eq(n.selection))return;if(n.selection.empty)return void this.hide();const{from:r,to:o}=n.selection,i=Na(t,r),s=Na(t,o,!0),l=this.options.element.offsetParent;if(!l)return void this.hide();const a=l.getBoundingClientRect(),c=this.options.element.getBoundingClientRect(),h=(i.left+s.left)/2-a.left;this.left=Math.round(this.options.keepInBounds?Math.min(a.width-c.width/2,Math.max(h,c.width/2)):h),this.bottom=Math.round(a.bottom-i.top),this.top=Math.round(s.bottom-a.top),this.isActive=!0,this.sendUpdate()}sendUpdate(){this.options.onUpdate({isActive:this.isActive,left:this.left,bottom:this.bottom,top:this.top})}hide(t){t&&t.relatedTarget&&this.options.element.parentNode&&this.options.element.parentNode.contains(t.relatedTarget)||(this.isActive=!1,this.sendUpdate())}destroy(){this.options.element.removeEventListener("mousedown",this.mousedownHandler),this.options.editor.off("focus",this.focusHandler),this.options.editor.off("blur",this.blurHandler)}}function Aa(t){return new en({key:new on("menu_bubble"),view(e){return new Ea({editorView:e,options:t})}})}Boolean;var Da=function(){var t=this,e=t._self._c;return e("div",{staticClass:"icon",class:[`icon--${t.name}`,`icon--${t.size}`]},[e(t.icon,{tag:"component"})],1)},Ta=[],Ra=r(39),za=r.n(Ra),_a=r(5379),Ia=r.n(_a),$a=r(5726),Pa=r.n($a),Ba=r(7228),Va=r.n(Ba),Fa=r(3642),La=r.n(Fa),ja=r(3282),Ha=r.n(ja),Ja=r(8593),Wa=r.n(Ja),qa=r(2015),Ka=r.n(qa),Ua=r(1071),Ga=r.n(Ua),Xa=r(3649),Ya=r.n(Xa),Za=r(5517),Qa=r.n(Za),tc=r(4077),ec=r.n(tc),nc=r(4478),rc=r.n(nc),oc=r(8242),ic=r.n(oc),sc=r(3998),lc=r.n(sc),ac=r(3028),cc=r.n(ac),hc=r(6803),dc=r.n(hc),uc=r(7674),pc=r.n(uc),fc=r(3524),mc=r.n(fc),gc=r(7260),yc=r.n(gc),wc=r(8710),vc=r.n(wc),bc=r(3899),xc=r.n(bc),kc=r(6499),Sc=r.n(kc),Cc=r(3145),Mc=r.n(Cc),Oc=r(7059),Nc=r.n(Oc),Ec=r(8559),Ac=r.n(Ec),Dc=r(1358),Tc=r.n(Dc),Rc=r(2585),zc=r.n(Rc);const _c={add_col_after:za(),add_col_before:Ia(),add_row_after:Pa(),add_row_before:Va(),bold:La(),checklist:Ha(),code:Wa(),code_block:Ka(),combine_cells:Ga(),delete_col:Ya(),delete_row:Qa(),delete_table:ec(),github:rc(),hr:ic(),image:lc(),italic:cc(),link:dc(),mention:pc(),ol:mc(),paragraph:yc(),quote:vc(),redo:xc(),remove:Sc(),strike:Mc(),table:Nc(),ul:Ac(),underline:Tc(),undo:zc()};var Ic={};for(let[r,os]of Object.entries(_c))Ic["icon_"+r]=os;var $c={components:Ic,props:{name:{},size:{default:"normal"},modifier:{default:null},fixAlign:{default:!0}},computed:{icon:function(){return"icon_"+this.name}}},Pc=$c;function Bc(t,e,n,r,o,i,s,l){var a,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),s?(a=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=a):o&&(a=l?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(c.functional){c._injectStyles=a;var h=c.render;c.render=function(t,e){return a.call(e),h(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,a):[a]}return{exports:t,options:c}}var Vc,Fc,Lc=Bc(Pc,Da,Ta,!1,null,"e59f7832",null),jc=Lc.exports;r(4304);if("undefined"!=typeof WeakMap){let t=new WeakMap;Vc=e=>t.get(e),Fc=(e,n)=>(t.set(e,n),n)}else{const t=[],e=10;let n=0;Vc=e=>{for(let n=0;n<t.length;n+=2)if(t[n]==e)return t[n+1]},Fc=(r,o)=>(n==e&&(n=0),t[n++]=r,t[n++]=o)}var Hc=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,s=o+1;for(let t=1;i<this.width&&this.map[e+t]==n;t++)i++;for(let t=1;s<this.height&&this.map[e+this.width*t]==n;t++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(t);return"horiz"==e?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s||e.push(s))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let n=e+t*this.width;const r=(t+1)*this.width;while(n<r&&this.map[n]<o)n++;return n==r?i-1:this.map[n]}o=i}}static get(t){return Vc(t)||Fc(t,Jc(t))}};function Jc(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);const e=Wc(t),n=t.childCount,r=[];let o=0,i=null;const s=[];for(let c=0,h=e*n;c<h;c++)r[c]=0;for(let c=0,h=0;c<n;c++){const l=t.child(c);h++;for(let t=0;;t++){while(o<r.length&&0!=r[o])o++;if(t==l.childCount)break;const a=l.child(t),{colspan:d,rowspan:u,colwidth:p}=a.attrs;for(let t=0;t<u;t++){if(t+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:h,n:u-t});break}const l=o+t*e;for(let t=0;t<d;t++){0==r[l+t]?r[l+t]=h:(i||(i=[])).push({type:"collision",row:c,pos:h,n:d-t});const n=p&&p[t];if(n){const r=(l+t)%e*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=d,h+=a.nodeSize}const a=(c+1)*e;let d=0;while(o<a)0==r[o++]&&d++;d&&(i||(i=[])).push({type:"missing",row:c,n:d}),h++}const l=new Hc(e,n,r,i);let a=!1;for(let c=0;!a&&c<s.length;c+=2)null!=s[c]&&s[c+1]<n&&(a=!0);return a&&qc(l,s,t),l}function Wc(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let e=0;e<r;e++){const n=t.child(e);for(let t=0;t<n.childCount;t++){const o=n.child(t);e+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let t=0;t<o.childCount;t++){const e=o.child(t);i+=e.attrs.colspan,e.attrs.rowspan>1&&(n=!0)}-1==e?e=i:e!=i&&(e=Math.max(e,i))}return e}function qc(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let n=0;n<a.colspan;n++){const r=(o+n)%t.width,i=e[2*r];null==i||a.colwidth&&a.colwidth[n]==i||((l||(l=Kc(a)))[n]=i)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function Kc(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Uc(t,e){if("string"===typeof t)return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((t=>Number(t))):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const s in e){const n=e[s].getFromDOM,r=n&&n(t);null!=r&&(i[s]=r)}return i}function Gc(t,e){const n={};1!=t.attrs.colspan&&(n.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const o=e[r].setDOMAttr;o&&o(t.attrs[r],n)}return n}function Xc(t){const e=t.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const r in e)n[r]={default:e[r].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:t=>Uc(t,e)}],toDOM(t){return["td",Gc(t,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:t=>Uc(t,e)}],toDOM(t){return["th",Gc(t,e),0]}}}}function Yc(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Zc=new on("selectingCells");function Qc(t){for(let e=t.depth-1;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function th(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}function eh(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if("row"==e.node(n).type.spec.tableRole)return!0;return!1}function nh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&"cell"==e.node.type.spec.tableRole)return e.$anchor;const n=Qc(e.$head)||rh(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function rh(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n-e.nodeSize)}}function oh(t){return"row"==t.parent.type.spec.tableRole&&!!t.nodeAfter}function ih(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function sh(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function lh(t,e,n){const r=t.node(-1),o=Hc.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return null==s?null:t.node(0).resolve(i+s)}function ah(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some((t=>t>0))||(r.colwidth=null)),r}function ch(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let t=0;t<n;t++)r.colwidth.splice(e,0,0)}return r}function hh(t,e,n){const r=Yc(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var dh=class extends ze{constructor(t,e=t){const n=t.node(-1),r=Hc.get(n),o=t.start(-1),i=r.rectBetween(t.pos-o,e.pos-o),s=t.node(0),l=r.cellsInRect(i).filter((t=>t!=e.pos-o));l.unshift(e.pos-o);const a=l.map((t=>{const e=n.nodeAt(t);if(!e)throw RangeError(`No cell with offset ${t} found`);const r=o+t+1;return new _e(s.resolve(r),s.resolve(r+e.content.size))}));super(a[0].$from,a[0].$to,a),this.$anchorCell=t,this.$headCell=e}map(t,e){const n=t.resolve(e.map(this.$anchorCell.pos)),r=t.resolve(e.map(this.$headCell.pos));if(oh(n)&&oh(r)&&sh(n,r)){const t=this.$anchorCell.node(-1)!=n.node(-1);return t&&this.isRowSelection()?dh.rowSelection(n,r):t&&this.isColSelection()?dh.colSelection(n,r):new dh(n,r)}return Pe.between(n,r)}content(){const t=this.$anchorCell.node(-1),e=Hc.get(t),n=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let l=r.top;l<r.bottom;l++){const n=[];for(let i=l*e.width+r.left,s=r.left;s<r.right;s++,i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=e.findCell(s);let a=t.nodeAt(s);if(!a)throw RangeError(`No cell with offset ${s} found`);const c=r.left-l.left,h=l.right-r.right;if(c>0||h>0){let t=a.attrs;if(c>0&&(t=ah(t,0,c)),h>0&&(t=ah(t,t.colspan-h,h)),l.left<r.left){if(a=a.type.createAndFill(t),!a)throw RangeError(`Could not create cell with attrs ${JSON.stringify(t)}`)}else a=a.type.create(t,a.content)}if(l.top<r.top||l.bottom>r.bottom){const t={...a.attrs,rowspan:Math.min(l.bottom,r.bottom)-Math.max(l.top,r.top)};a=l.top<r.top?a.type.createAndFill(t):a.type.create(t,a.content)}n.push(a)}i.push(t.child(l).copy(c.from(n)))}const s=this.isColSelection()&&this.isRowSelection()?t:i;return new m(c.from(s),1,1)}replace(t,e=m.empty){const n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){const{$from:o,$to:s}=r[i],l=t.mapping.slice(n);t.replace(l.map(o.pos),l.map(s.pos),i?m.empty:e)}const o=ze.findFrom(t.doc.resolve(t.mapping.slice(n).map(this.to)),-1);o&&t.setSelection(o)}replaceWith(t,e){this.replace(t,new m(c.from(e),0,0))}forEachCell(t){const e=this.$anchorCell.node(-1),n=Hc.get(e),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let i=0;i<o.length;i++)t(e.nodeAt(o[i]),r+o[i])}isColSelection(){const t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,e=t){const n=t.node(-1),r=Hc.get(n),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(e.pos-o),l=t.node(0);return i.top<=s.top?(i.top>0&&(t=l.resolve(o+r.map[i.left])),s.bottom<r.height&&(e=l.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(e=l.resolve(o+r.map[s.left])),i.bottom<r.height&&(t=l.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new dh(t,e)}isRowSelection(){const t=this.$anchorCell.node(-1),e=Hc.get(t),n=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-n),o=e.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==e.width}eq(t){return t instanceof dh&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,e=t){const n=t.node(-1),r=Hc.get(n),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(e.pos-o),l=t.node(0);return i.left<=s.left?(i.left>0&&(t=l.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(e=l.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(e=l.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(t=l.resolve(o+r.map[r.width*(i.top+1)-1]))),new dh(t,e)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,e){return new dh(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){return new dh(t.resolve(e),t.resolve(n))}getBookmark(){return new uh(this.$anchorCell.pos,this.$headCell.pos)}};dh.prototype.visible=!1,ze.jsonID("cell",dh);var uh=class{constructor(t,e){this.anchor=t,this.head=e}map(t){return new uh(t.map(this.anchor),t.map(this.head))}resolve(t){const e=t.resolve(this.anchor),n=t.resolve(this.head);return"row"==e.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&e.index()<e.parent.childCount&&n.index()<n.parent.childCount&&sh(e,n)?new dh(e,n):ze.near(n,1)}};function ph(t){if(!(t.selection instanceof dh))return null;const e=[];return t.selection.forEachCell(((t,n)=>{e.push(Si.node(n,n+t.nodeSize,{class:"selectedCell"}))})),Oi.create(t.doc,e)}function fh({$from:t,$to:e}){if(t.pos==e.pos||t.pos<t.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0;o--,n++)if(t.after(o+1)<t.end(o))break;for(let i=e.depth;i>=0;i--,r--)if(e.before(i+1)>e.start(i))break;return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function mh({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const e=t.node(o);if("cell"===e.type.spec.tableRole||"header_cell"===e.type.spec.tableRole){n=e;break}}for(let o=e.depth;o>0;o--){const t=e.node(o);if("cell"===t.type.spec.tableRole||"header_cell"===t.type.spec.tableRole){r=t;break}}return n!==r&&0===e.parentOffset}function gh(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,s;if(r instanceof Ve&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)i=dh.create(o,r.from);else if("row"==s){const t=o.resolve(r.from+1);i=dh.rowSelection(t,t)}else if(!n){const t=Hc.get(r.node),e=r.from+1,n=e+t.map[t.width*t.height-1];i=dh.create(o,e+1,n)}}else r instanceof Pe&&fh(r)?i=Pe.create(o,r.from):r instanceof Pe&&mh(r)&&(i=Pe.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var yh=new on("fix-tables");function wh(t,e,n,r){const o=t.childCount,i=e.childCount;t:for(let s=0,l=0;s<i;s++){const i=e.child(s);for(let e=l,r=Math.min(o,s+3);e<r;e++)if(t.child(e)==i){l=e+1,n+=i.nodeSize;continue t}r(i,n),l<o&&t.child(l).sameMarkup(i)?wh(t.child(l),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function vh(t,e){let n;const r=(e,r)=>{"table"==e.type.spec.tableRole&&(n=bh(t,e,r,n))};return e?e.doc!=t.doc&&wh(e.doc,t.doc,0,r):t.doc.descendants(r),n}function bh(t,e,n,r){const o=Hc.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const t=o.problems[a];if("collision"==t.type){const o=e.nodeAt(t.pos);if(!o)continue;const s=o.attrs;for(let e=0;e<s.rowspan;e++)i[t.row+e]+=t.n;r.setNodeMarkup(r.mapping.map(n+1+t.pos),null,ah(s,s.colspan-t.n,t.n))}else if("missing"==t.type)i[t.row]+=t.n;else if("overlong_rowspan"==t.type){const o=e.nodeAt(t.pos);if(!o)continue;r.setNodeMarkup(r.mapping.map(n+1+t.pos),null,{...o.attrs,rowspan:o.attrs.rowspan-t.n})}else if("colwidth mismatch"==t.type){const o=e.nodeAt(t.pos);if(!o)continue;r.setNodeMarkup(r.mapping.map(n+1+t.pos),null,{...o.attrs,colwidth:t.colwidth})}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(null==s&&(s=a),l=a);for(let a=0,c=n+1;a<o.height;a++){const n=e.child(a),o=c+n.nodeSize,h=i[a];if(h>0){let e="cell";n.firstChild&&(e=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<h;n++){const n=Yc(t.schema)[e].createAndFill();n&&i.push(n)}const d=0!=a&&s!=a-1||l!=a?o-1:c+1;r.insert(r.mapping.map(d),i)}c=o}return r.setMeta(yh,{fixTables:!0})}function xh(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;while(1==e.childCount&&(n>0&&r>0||"table"==e.child(0).type.spec.tableRole))n--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if("row"==i)for(let a=0;a<e.childCount;a++){let t=e.child(a).content;const o=a?0:Math.max(0,n-1),i=a<e.childCount-1?0:Math.max(0,r-1);(o||i)&&(t=Sh(Yc(s).row,new m(t,o,i)).content),l.push(t)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?Sh(Yc(s).row,new m(e,n,r)).content:e)}return kh(s,l)}function kh(t,e){const n=[];for(let o=0;o<e.length;o++){const t=e[o];for(let e=t.childCount-1;e>=0;e--){const{rowspan:r,colspan:i}=t.child(e).attrs;for(let t=o;t<o+r;t++)n[t]=(n[t]||0)+i}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(c.empty),n[o]<r){const i=Yc(t).cell.createAndFill(),s=[];for(let t=n[o];t<r;t++)s.push(i);e[o]=e[o].append(c.from(s))}return{height:e.length,width:r,rows:e}}function Sh(t,e){const n=t.createAndFill(),r=new Te(n).replace(0,n.content.size,e);return r.doc}function Ch({width:t,height:e,rows:n},r,o){if(t!=r){const e=[],o=[];for(let t=0;t<n.length;t++){const i=n[t],s=[];for(let n=e[t]||0,o=0;n<r;o++){let l=i.child(o%i.childCount);n+l.attrs.colspan>r&&(l=l.type.createChecked(ah(l.attrs,l.attrs.colspan,n+l.attrs.colspan-r),l.content)),s.push(l),n+=l.attrs.colspan;for(let n=1;n<l.attrs.rowspan;n++)e[t+n]=(e[t+n]||0)+l.attrs.colspan}o.push(c.from(s))}n=o,t=r}if(e!=o){const t=[];for(let r=0,i=0;r<o;r++,i++){const s=[],l=n[i%e];for(let t=0;t<l.childCount;t++){let e=l.child(t);r+e.attrs.rowspan>o&&(e=e.type.create({...e.attrs,rowspan:Math.max(1,o-e.attrs.rowspan)},e.content)),s.push(e)}t.push(c.from(s))}n=t,e=o}return{width:t,height:e,rows:n}}function Mh(t,e,n,r,o,i,s){const l=t.doc.type.schema,a=Yc(l);let h,d;if(o>e.width)for(let c=0,u=0;c<e.height;c++){const i=n.child(c);u+=i.nodeSize;const l=[];let p;p=null==i.lastChild||i.lastChild.type==a.cell?h||(h=a.cell.createAndFill()):d||(d=a.header_cell.createAndFill());for(let t=e.width;t<o;t++)l.push(p);t.insert(t.mapping.slice(s).map(u-1+r),l)}if(i>e.height){const l=[];for(let t=0,r=(e.height-1)*e.width;t<Math.max(e.width,o);t++){const o=!(t>=e.width)&&n.nodeAt(e.map[r+t]).type==a.header_cell;l.push(o?d||(d=a.header_cell.createAndFill()):h||(h=a.cell.createAndFill()))}const u=a.row.create(null,c.from(l)),p=[];for(let t=e.height;t<i;t++)p.push(u);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p)}return!(!h&&!d)}function Oh(t,e,n,r,o,i,s,l){if(0==s||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const o=s*e.width+c,i=e.map[o];if(e.map[o-e.width]==i){a=!0;const o=n.nodeAt(i),{top:h,left:d}=e.findCell(i);t.setNodeMarkup(t.mapping.slice(l).map(i+r),null,{...o.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,d,n)),o.type.createAndFill({...o.attrs,rowspan:h+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return a}function Nh(t,e,n,r,o,i,s,l){if(0==s||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const o=c*e.width+s,i=e.map[o];if(e.map[o-1]==i){a=!0;const o=n.nodeAt(i),h=e.colCount(i),d=t.mapping.slice(l).map(i+r);t.setNodeMarkup(d,null,ah(o.attrs,s-h,o.attrs.colspan-(s-h))),t.insert(d+o.nodeSize,o.type.createAndFill(ah(o.attrs,0,s-h))),c+=o.attrs.rowspan-1}}return a}function Eh(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=Hc.get(i);const{top:l,left:a}=r,c=a+o.width,h=l+o.height,d=t.tr;let u=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=Hc.get(i),u=d.mapping.maps.length}Mh(d,s,i,n,c,h,u)&&p(),Oh(d,s,i,n,a,c,l,u)&&p(),Oh(d,s,i,n,a,c,h,u)&&p(),Nh(d,s,i,n,l,h,a,u)&&p(),Nh(d,s,i,n,l,h,c,u)&&p();for(let f=l;f<h;f++){const t=s.positionAt(f,a,i),e=s.positionAt(f,c,i);d.replace(d.mapping.slice(u).map(t+n),d.mapping.slice(u).map(e+n),new m(o.rows[f-l],0,0))}p(),d.setSelection(new dh(d.doc.resolve(n+s.positionAt(l,a,i)),d.doc.resolve(n+s.positionAt(h-1,c-1,i)))),e(d)}var Ah=Ns({ArrowLeft:Th("horiz",-1),ArrowRight:Th("horiz",1),ArrowUp:Th("vert",-1),ArrowDown:Th("vert",1),"Shift-ArrowLeft":Rh("horiz",-1),"Shift-ArrowRight":Rh("horiz",1),"Shift-ArrowUp":Rh("vert",-1),"Shift-ArrowDown":Rh("vert",1),Backspace:zh,"Mod-Backspace":zh,Delete:zh,"Mod-Delete":zh});function Dh(t,e,n){return!n.eq(t.selection)&&(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Th(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof dh)return Dh(n,r,ze.near(i.$headCell,e));if("horiz"!=t&&!i.empty)return!1;const s=Ph(o,t,e);if(null==s)return!1;if("horiz"==t)return Dh(n,r,ze.near(n.doc.resolve(i.head+e),e));{const o=n.doc.resolve(s),i=lh(o,t,e);let l;return l=i?ze.near(i,1):e<0?ze.near(n.doc.resolve(o.before(-1)),-1):ze.near(n.doc.resolve(o.after(-1)),1),Dh(n,r,l)}}}function Rh(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof dh)s=i;else{const r=Ph(o,t,e);if(null==r)return!1;s=new dh(n.doc.resolve(r))}const l=lh(s.$headCell,t,e);return!!l&&Dh(n,r,new dh(s.$anchorCell,l))}}function zh(t,e){const n=t.selection;if(!(n instanceof dh))return!1;if(e){const r=t.tr,o=Yc(t.schema).cell.createAndFill().content;n.forEachCell(((t,e)=>{t.content.eq(o)||r.replace(r.mapping.map(e+1),r.mapping.map(e+t.nodeSize-1),new m(o,0,0))})),r.docChanged&&e(r)}return!0}function _h(t,e){const n=t.state.doc,r=Qc(n.resolve(e));return!!r&&(t.dispatch(t.state.tr.setSelection(new dh(r))),!0)}function Ih(t,e,n){if(!eh(t.state))return!1;let r=xh(n);const o=t.state.selection;if(o instanceof dh){r||(r={width:1,height:1,rows:[c.from(Sh(Yc(t.state.schema).cell,n))]});const e=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),s=Hc.get(e).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=Ch(r,s.right-s.left,s.bottom-s.top),Eh(t.state,t.dispatch,i,s,r),!0}if(r){const e=nh(t.state),n=e.start(-1);return Eh(t.state,t.dispatch,n,Hc.get(e.node(-1)).findCell(e.pos-n),r),!0}return!1}function $h(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Bh(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof dh)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&null!=(o=Qc(t.state.selection.$anchor))&&(null==(n=Vh(t,e))?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(e,n){let r=Vh(t,n);const o=null==Zc.getState(t.state);if(!r||!sh(e,r)){if(!o)return;r=e}const i=new dh(e,r);if(o||!t.state.selection.eq(i)){const n=t.state.tr.setSelection(i);o&&n.setMeta(Zc,e.pos),t.dispatch(n)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),null!=Zc.getState(t.state)&&t.dispatch(t.state.tr.setMeta(Zc,-1))}function l(n){const o=n,l=Zc.getState(t.state);let a;if(null!=l)a=t.state.doc.resolve(l);else if(Bh(t,o.target)!=r&&(a=Vh(t,e),!a))return s();a&&i(a,o)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function Ph(t,e,n){if(!(t.state.selection instanceof Pe))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o),s=n<0?r.index(o):r.indexAfter(o);if(s!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),s="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(s)?i:null}}return null}function Bh(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e;return null}function Vh(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Qc(t.state.doc.resolve(n.pos)):null}var Fh=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Lh(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type==this.node.type&&(this.node=t,Lh(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))}};function Lh(t,e,n,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const h=t.firstChild;if(h){for(let t=0,n=0;t<h.childCount;t++){const{colspan:s,colwidth:d}=h.child(t).attrs;for(let t=0;t<s;t++,n++){const s=o==n?i:d&&d[t],h=s?s+"px":"";l+=s||r,s||(a=!1),c?(c.style.width!=h&&(c.style.width=h),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=h}}while(c){const t=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=t}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var jh=new on("tableColumnResizing");function Hh({handleWidth:t=5,cellMinWidth:e=25,View:n=Fh,lastColumnResizable:r=!0}={}){const o=new en({key:jh,state:{init(t,r){return o.spec.props.nodeViews[Yc(r.schema).table.name]=(t,r)=>new n(t,e,r),new Jh(-1,!1)},apply(t,e){return e.apply(t)}},props:{attributes:t=>{const e=jh.getState(t);return e&&e.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(n,o)=>{Wh(n,o,t,e,r)},mouseleave:t=>{qh(t)},mousedown:(t,n)=>{Kh(t,n,e)}},decorations:t=>{const e=jh.getState(t);if(e&&e.activeHandle>-1)return nd(t,e.activeHandle)},nodeViews:{}}});return o}var Jh=class{constructor(t,e){this.activeHandle=t,this.dragging=e}apply(t){const e=this,n=t.getMeta(jh);if(n&&null!=n.setHandle)return new Jh(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new Jh(e.activeHandle,n.setDragging);if(e.activeHandle>-1&&t.docChanged){let n=t.mapping.map(e.activeHandle,-1);return oh(t.doc.resolve(n))||(n=-1),new Jh(n,e.dragging)}return e}};function Wh(t,e,n,r,o){const i=jh.getState(t.state);if(i&&!i.dragging){const r=Gh(e.target);let s=-1;if(r){const{left:o,right:i}=r.getBoundingClientRect();e.clientX-o<=n?s=Xh(t,e,"left"):i-e.clientX<=n&&(s=Xh(t,e,"right"))}if(s!=i.activeHandle){if(!o&&-1!==s){const e=t.state.doc.resolve(s),n=e.node(-1),r=Hc.get(n),o=e.start(-1),i=r.colCount(e.pos-o)+e.nodeAfter.attrs.colspan-1;if(i==r.width-1)return}Zh(t,s)}}}function qh(t){const e=jh.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Zh(t,-1)}function Kh(t,e,n){const r=jh.getState(t.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const o=t.state.doc.nodeAt(r.activeHandle),i=Uh(t,r.activeHandle,o.attrs);function s(e){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",l);const r=jh.getState(t.state);(null==r?void 0:r.dragging)&&(Qh(t,r.activeHandle,Yh(r.dragging,e,n)),t.dispatch(t.state.tr.setMeta(jh,{setDragging:null})))}function l(e){if(!e.which)return s(e);const r=jh.getState(t.state);if(r&&r.dragging){const o=Yh(r.dragging,e,n);td(t,r.activeHandle,o,n)}}return t.dispatch(t.state.tr.setMeta(jh,{setDragging:{startX:e.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",l),e.preventDefault(),!0}function Uh(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e),s=i.node.childNodes[i.offset];let l=s.offsetWidth,a=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],a--);return l/a}function Gh(t){while(t&&"TD"!=t.nodeName&&"TH"!=t.nodeName)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Xh(t,e,n){const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;const{pos:o}=r,i=Qc(t.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;const s=Hc.get(i.node(-1)),l=i.start(-1),a=s.map.indexOf(i.pos-l);return a%s.width==0?-1:l+s.map[a-1]}function Yh(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Zh(t,e){t.dispatch(t.state.tr.setMeta(jh,{setHandle:e}))}function Qh(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=Hc.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){const t=c*i.width+l;if(c&&i.map[t]==i.map[t-i.width])continue;const e=i.map[t],r=o.nodeAt(e).attrs,h=1==r.colspan?0:l-i.colCount(e);if(r.colwidth&&r.colwidth[h]==n)continue;const d=r.colwidth?r.colwidth.slice():ed(r.colspan);d[h]=n,a.setNodeMarkup(s+e,null,{...r,colwidth:d})}a.docChanged&&t.dispatch(a)}function td(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=Hc.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=t.domAtPos(o.start(-1)).node;while(a&&"TABLE"!=a.nodeName)a=a.parentNode;a&&Lh(i,a.firstChild,a,r,l,n)}function ed(t){return Array(t).fill(0)}function nd(t,e){const n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return Oi.empty;const i=Hc.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let a=0;a<i.height;a++){const t=l+a*i.width-1;if((l==i.width||i.map[t]!=i.map[t+1])&&(0==a||i.map[t-1]!=i.map[t-1-i.width])){const e=i.map[t],r=s+e+o.nodeAt(e).nodeSize-1,l=document.createElement("div");l.className="column-resize-handle",n.push(Si.widget(r,l))}}return Oi.create(t.doc,n)}function rd(t){const e=t.selection,n=nh(t),r=n.node(-1),o=n.start(-1),i=Hc.get(r),s=e instanceof dh?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o);return{...s,tableStart:o,map:i,table:r}}function od(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;hh(e,r,o+i)&&(i=0==o||o==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const i=e.map[l],a=r.nodeAt(i);t.setNodeMarkup(t.mapping.map(n+i),null,ch(a.attrs,o-e.colCount(i))),s+=a.attrs.rowspan-1}else{const a=null==i?Yc(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function id(t,e){if(!eh(t))return!1;if(e){const n=rd(t);e(od(t.tr,n,n.left))}return!0}function sd(t,e){if(!eh(t))return!1;if(e){const n=rd(t);e(od(t.tr,n,n.right))}return!0}function ld(t,{map:e,table:n,tableStart:r},o){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+o,a=e.map[l],c=n.nodeAt(a),h=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(i).map(r+a),null,ah(h,o-e.colCount(a)));else{const e=t.mapping.slice(i).map(r+a);t.delete(e,e+c.nodeSize)}s+=h.rowspan}}function ad(t,e){if(!eh(t))return!1;if(e){const n=rd(t),r=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let t=n.right-1;;t--){if(ld(r,n,t),t==n.left)break;const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=Hc.get(e)}e(r)}return!0}function cd(t,e,n){var r;const o=Yc(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if((null==(r=e.nodeAt(t.map[i+n*t.width]))?void 0:r.type)!=o)return!1;return!0}function hd(t,{map:e,tableStart:n,table:r},o){var i;let s=n;for(let c=0;c<o;c++)s+=r.child(c).nodeSize;const l=[];let a=o>0?-1:0;cd(e,r,o+a)&&(a=0==o||o==e.height?null:0);for(let c=0,h=e.width*o;c<e.width;c++,h++)if(o>0&&o<e.height&&e.map[h]==e.map[h-e.width]){const o=e.map[h],i=r.nodeAt(o).attrs;t.setNodeMarkup(n+o,null,{...i,rowspan:i.rowspan+1}),c+=i.colspan-1}else{const t=null==a?Yc(r.type.schema).cell:null==(i=r.nodeAt(e.map[h+a*e.width]))?void 0:i.type,n=null==t?void 0:t.createAndFill();n&&l.push(n)}return t.insert(s,Yc(r.type.schema).row.create(null,l)),t}function dd(t,e){if(!eh(t))return!1;if(e){const n=rd(t);e(hd(t.tr,n,n.top))}return!0}function ud(t,e){if(!eh(t))return!1;if(e){const n=rd(t);e(hd(t.tr,n,n.bottom))}return!0}function pd(t,{map:e,table:n,tableStart:r},o){let i=0;for(let a=0;a<o;a++)i+=n.child(a).nodeSize;const s=i+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(i+r,s+r);for(let a=0,c=o*e.width;a<e.width;a++,c++){const i=e.map[c];if(o>0&&i==e.map[c-e.width]){const e=n.nodeAt(i).attrs;t.setNodeMarkup(t.mapping.slice(l).map(i+r),null,{...e,rowspan:e.rowspan-1}),a+=e.colspan-1}else if(o<e.width&&i==e.map[c+e.width]){const s=n.nodeAt(i),c=s.attrs,h=s.type.create({...c,rowspan:s.attrs.rowspan-1},s.content),d=e.positionAt(o+1,a,n);t.insert(t.mapping.slice(l).map(r+d),h),a+=c.colspan-1}}}function fd(t,e){if(!eh(t))return!1;if(e){const n=rd(t),r=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let t=n.bottom-1;;t--){if(pd(r,n,t),t==n.top)break;const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=Hc.get(n.table)}e(r)}return!0}function md(t){const e=t.content;return 1==e.childCount&&e.child(0).isTextblock&&0==e.child(0).childCount}function gd({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,s=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[s]==n[s+t])return!0;o++,s++}return!1}function yd(t,e){const n=t.selection;if(!(n instanceof dh)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=rd(t),{map:o}=r;if(gd(o,r))return!1;if(e){const n=t.tr,i={};let s,l,a=c.empty;for(let t=r.top;t<r.bottom;t++)for(let e=r.left;e<r.right;e++){const c=o.map[t*o.width+e],h=r.table.nodeAt(c);if(!i[c]&&h)if(i[c]=!0,null==s)s=c,l=h;else{md(h)||(a=a.append(h.content));const t=n.mapping.map(c+r.tableStart);n.delete(t,t+h.nodeSize)}}if(null==s||null==l)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...ch(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const t=s+1+l.content.size,e=md(l)?s+1:t;n.replaceWith(e+r.tableStart,t+r.tableStart,a)}n.setSelection(new dh(n.doc.resolve(s+r.tableStart))),e(n)}return!0}function wd(t,e){const n=Yc(t.schema);return vd((({node:t})=>n[t.type.spec.tableRole]))(t,e)}function vd(t){return(e,n)=>{var r;const o=e.selection;let i,s;if(o instanceof dh){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=th(o.$from),!i)return!1;s=null==(r=Qc(o.$from))?void 0:r.pos}if(null==i||null==s)return!1;if(1==i.attrs.colspan&&1==i.attrs.rowspan)return!1;if(n){let r=i.attrs;const l=[],a=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const c=rd(e),h=e.tr;for(let t=0;t<c.right-c.left;t++)l.push(a?{...r,colwidth:a&&a[t]?[a[t]]:null}:r);let d;for(let e=c.top;e<c.bottom;e++){let n=c.map.positionAt(e,c.left,c.table);e==c.top&&(n+=i.nodeSize);for(let r=c.left,o=0;r<c.right;r++,o++)r==c.left&&e==c.top||h.insert(d=h.mapping.map(n+c.tableStart,1),t({node:i,row:e,col:r}).createAndFill(l[o]))}h.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),l[0]),o instanceof dh&&h.setSelection(new dh(h.doc.resolve(o.$anchorCell.pos),d?h.doc.resolve(d):void 0)),n(h)}return!0}}function bd(t,e){return function(n,r){if(!eh(n))return!1;const o=nh(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof dh?n.selection.forEachCell(((n,r)=>{n.attrs[t]!==e&&i.setNodeMarkup(r,null,{...n.attrs,[t]:e})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function xd(t){return function(e,n){if(!eh(e))return!1;if(n){const r=Yc(e.schema),o=rd(e),i=e.tr,s=o.map.cellsInRect("column"==t?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==t?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map((t=>o.table.nodeAt(t)));for(let t=0;t<s.length;t++)l[t].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[t],r.cell,l[t].attrs);if(0==i.steps.length)for(let t=0;t<s.length;t++)i.setNodeMarkup(o.tableStart+s[t],r.header_cell,l[t].attrs);n(i)}return!0}}function kd(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:"row"==t?e.map.width:1,bottom:"column"==t?e.map.height:1});for(let o=0;o<r.length;o++){const t=e.table.nodeAt(r[o]);if(t&&t.type!==n.header_cell)return!1}return!0}function Sd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?xd(t):function(e,n){if(!eh(e))return!1;if(n){const r=Yc(e.schema),o=rd(e),i=e.tr,s=kd("row",o,r),l=kd("column",o,r),a="column"===t?s:"row"===t&&l,c=a?1:0,h="column"==t?{left:0,top:c,right:1,bottom:o.map.height}:"row"==t?{left:c,top:0,right:o.map.width,bottom:1}:o,d="column"==t?l?r.cell:r.header_cell:"row"==t?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(h).forEach((t=>{const e=t+o.tableStart,n=i.doc.nodeAt(e);n&&i.setNodeMarkup(e,d,n.attrs)})),n(i)}return!0}}var Cd=Sd("row",{useDeprecatedLogic:!0}),Md=Sd("column",{useDeprecatedLogic:!0}),Od=Sd("cell",{useDeprecatedLogic:!0});function Nd(t,e){if(e<0){const e=t.nodeBefore;if(e)return t.pos-e.nodeSize;for(let n=t.index(-1)-1,r=t.before();n>=0;n--){const e=t.node(-1).child(n),o=e.lastChild;if(o)return r-1-o.nodeSize;r-=e.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const e=t.node(-1);for(let n=t.indexAfter(-1),r=t.after();n<e.childCount;n++){const t=e.child(n);if(t.childCount)return r+1;r+=t.nodeSize}}return null}function Ed(t){return function(e,n){if(!eh(e))return!1;const r=Nd(nh(e),t);if(null==r)return!1;if(n){const t=e.doc.resolve(r);n(e.tr.setSelection(Pe.between(t,ih(t))).scrollIntoView())}return!0}}function Ad(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--){const o=n.node(r);if("table"==o.type.spec.tableRole)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0}return!1}function Dd({allowTableNodeSelection:t=!1}={}){return new en({key:Zc,state:{init(){return null},apply(t,e){const n=t.getMeta(Zc);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;const{deleted:r,pos:o}=t.mapping.mapResult(e);return r?null:o}},props:{decorations:ph,handleDOMEvents:{mousedown:$h},createSelectionBetween(t){return null!=Zc.getState(t.state)?t.state.selection:null},handleTripleClick:_h,handleKeyDown:Ah,handlePaste:Ih},appendTransaction(e,n,r){return gh(r,vh(r,n),t)}})}var Td=200,Rd=function(){};Rd.prototype.append=function(t){return t.length?(t=Rd.from(t),!this.length&&t||t.length<Td&&this.leafAppend(t)||this.length<Td&&t.leafPrepend(this)||this.appendInner(t)):this},Rd.prototype.prepend=function(t){return t.length?Rd.from(t).append(this):this},Rd.prototype.appendInner=function(t){return new _d(this,t)},Rd.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Rd.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Rd.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Rd.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Rd.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Rd.from=function(t){return t instanceof Rd?t:t&&t.length?new zd(t):Rd.empty};var zd=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Td)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Td)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Rd);Rd.empty=new zd([]);var _d=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Rd),Id=Rd,$d=Id;const Pd=500;class Bd{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){let t=this.items.get(o-1);if(t.selection){--o;break}}e&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,l=t.tr,a=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(o,e+1),r=n.maps.length),r--,void c.push(t);if(n){c.push(new Fd(t.map));let e,o=t.step.map(n.slice(r));o&&l.maybeStep(o).doc&&(e=l.mapping.maps[l.mapping.maps.length-1],a.push(new Fd(e,void 0,void 0,a.length+c.length))),r--,e&&n.appendMap(e,r)}else l.maybeStep(t.step);return t.selection?(i=n?t.selection.map(n.slice(r)):t.selection,s=new Bd(this.items.slice(0,o).append(c.reverse().concat(a)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:i}}addTransform(t,e,n,r){let o=[],i=this.eventCount,s=this.items,l=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<t.steps.length;c++){let n,a=t.steps[c].invert(t.docs[c]),h=new Fd(t.mapping.maps[c],a,e);(n=l&&l.merge(h))&&(h=n,c?o.pop():s=s.slice(0,s.length-1)),o.push(h),e&&(i++,e=void 0),r||(l=h)}let a=i-n.depth;return a>jd&&(s=Vd(s,a),i-=a),new Bd(s.append(o),i)}remapping(t,e){let n=new It;return this.items.forEach(((e,r)=>{let o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,o)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new Bd(this.items.append(t.map((t=>new Fd(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let l=e;this.items.forEach((e=>{let r=o.getMirror(--l);if(null==r)return;i=Math.min(i,r);let a=o.maps[r];if(e.step){let i=t.steps[r].invert(t.docs[r]),c=e.selection&&e.selection.map(o.slice(l+1,r));c&&s++,n.push(new Fd(a,i,c))}else n.push(new Fd(a))}),r);let a=[];for(let d=e;d<i;d++)a.push(new Fd(o.maps[d]));let c=this.items.slice(0,r).append(a).append(n),h=new Bd(c,s);return h.emptyItemCount()>Pd&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=t)r.push(i),i.selection&&o++;else if(i.step){let t=i.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let l=i.selection&&i.selection.map(e.slice(n));l&&o++;let a,c=new Fd(s.invert(),t,l),h=r.length-1;(a=r.length&&r[h].merge(c))?r[h]=a:r.push(c)}}else i.map&&n--}),this.items.length,0),new Bd($d.from(r.reverse()),o)}}function Vd(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}Bd.empty=new Bd($d.empty,0);class Fd{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Fd(e.getMap().invert(),e,this.selection)}}}class Ld{constructor(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r}}const jd=20;function Hd(t,e,n,r){let o,i=n.getMeta(Yd);if(i)return i.historyState;n.getMeta(Zd)&&(t=new Ld(t.done,t.undone,null,0));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Yd))return s.getMeta(Yd).redo?new Ld(t.done.addTransform(n,void 0,r,Xd(e)),t.undone,Wd(n.mapping.maps[n.steps.length-1]),t.prevTime):new Ld(t.done,t.undone.addTransform(n,void 0,r,Xd(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Ld(t.done.rebased(n,o),t.undone.rebased(n,o),qd(t.prevRanges,n.mapping),t.prevTime):new Ld(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),qd(t.prevRanges,n.mapping),t.prevTime);{let o=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Jd(n,t.prevRanges)),i=s?qd(t.prevRanges,n.mapping):Wd(n.mapping.maps[n.steps.length-1]);return new Ld(t.done.addTransform(n,o?e.selection.getBookmark():void 0,r,Xd(e)),Bd.empty,i,n.time)}}function Jd(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}function Wd(t){let e=[];return t.forEach(((t,n,r,o)=>e.push(r,o))),e}function qd(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Kd(t,e,n,r){let o=Xd(e),i=Yd.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let l=s.selection.resolve(s.transform.doc),a=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new Ld(r?a:s.remaining,r?s.remaining:a,null,0);n(s.transform.setSelection(l).setMeta(Yd,{redo:r,historyState:c}).scrollIntoView())}let Ud=!1,Gd=null;function Xd(t){let e=t.plugins;if(Gd!=e){Ud=!1,Gd=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ud=!0;break}}return Ud}const Yd=new on("history"),Zd=new on("closeHistory");function Qd(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new en({key:Yd,state:{init(){return new Ld(Bd.empty,Bd.empty,null,0)},apply(e,n,r){return Hd(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?tu:"historyRedo"==n?eu:null;return!!r&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}const tu=(t,e)=>{let n=Yd.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Kd(n,t,e,!1),!0)},eu=(t,e)=>{let n=Yd.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Kd(n,t,e,!0),!0)};function nu(t){let e=Yd.getState(t);return e?e.done.eventCount:0}function ru(t){let e=Yd.getState(t);return e?e.undone.eventCount:0}
  14. /*!
  15. * tiptap-extensions v1.35.1
  16. * (c) 2021 überdosis GbR (limited liability)
  17. * @license MIT
  18. */
  19. class ou extends ma{get name(){return"blockquote"}get schema(){return{content:"block*",group:"block",defining:!0,draggable:!1,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}}commands({type:t}){return()=>ia(t)}keys({type:t}){return{"Ctrl->":ia(t)}}inputRules({type:t}){return[Ml(/^\s*>\s$/,t)]}}class iu extends ma{get name(){return"bullet_list"}get schema(){return{content:"list_item+",group:"block",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]}}commands({type:t,schema:e}){return()=>oa(t,e.nodes.list_item)}keys({type:t,schema:e}){return{"Shift-Ctrl-8":oa(t,e.nodes.list_item)}}inputRules({type:t}){return[Ml(/^\s*([-+*])\s$/,t)]}}class su extends ma{get name(){return"code_block"}get schema(){return{content:"text*",marks:"",group:"block",code:!0,defining:!0,draggable:!1,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:()=>["pre",["code",0]]}}commands({type:t,schema:e}){return()=>na(t,e.nodes.paragraph)}keys({type:t}){return{"Shift-Ctrl-\\":cl(t)}}inputRules({type:t}){return[Ol(/^```$/,t)]}}class lu extends ma{get name(){return"hard_break"}get schema(){return{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]}}commands({type:t}){return()=>ul(Ys,((e,n)=>(n(e.tr.replaceSelectionWith(t.create()).scrollIntoView()),!0)))}keys({type:t}){const e=ul(Ys,((e,n)=>(n(e.tr.replaceSelectionWith(t.create()).scrollIntoView()),!0)));return{"Mod-Enter":e,"Shift-Enter":e}}}class au extends ma{get name(){return"heading"}get defaultOptions(){return{levels:[1,2,3,4,5,6]}}get schema(){return{attrs:{level:{default:1}},content:"inline*",group:"block",defining:!0,draggable:!1,parseDOM:this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}}))),toDOM:t=>[`h${t.attrs.level}`,0]}}commands({type:t,schema:e}){return n=>na(t,e.nodes.paragraph,n)}keys({type:t}){return this.options.levels.reduce(((e,n)=>({...e,[`Shift-Ctrl-${n}`]:cl(t,{level:n})})),{})}inputRules({type:t}){return this.options.levels.map((e=>Ol(new RegExp(`^(#{1,${e}})\\s$`),t,(()=>({level:e})))))}}class cu extends ma{get name(){return"list_item"}get schema(){return{content:"paragraph block*",defining:!0,draggable:!1,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]}}keys({type:t}){return{Enter:Jl(t),Tab:Ul(t),"Shift-Tab":Wl(t)}}}class hu extends ma{get name(){return"ordered_list"}get schema(){return{attrs:{order:{default:1}},content:"list_item+",group:"block",parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]}}commands({type:t,schema:e}){return()=>oa(t,e.nodes.list_item)}keys({type:t,schema:e}){return{"Shift-Ctrl-9":oa(t,e.nodes.list_item)}}inputRules({type:t}){return[Ml(/^(\d+)\.\s$/,t,(t=>({order:+t[1]})),((t,e)=>e.childCount+e.attrs.order===+t[1]))]}}var du=Xc({tableGroup:"block",cellContent:"block+",cellAttributes:{background:{default:null,getFromDOM(t){return t.style.backgroundColor||null},setDOMAttr(t,e){if(t){const n={style:`${e.style||""}background-color: ${t};`};Object.assign(e,n)}}}}});class uu extends ma{get name(){return"table"}get defaultOptions(){return{resizable:!1}}get schema(){return du.table}commands({schema:t}){return{createTable:({rowsCount:e,colsCount:n,withHeaderRow:r})=>(o,i)=>{const s=o.tr.selection.anchor+1,l=Al(t,e,n,r),a=o.tr.replaceSelectionWith(l).scrollIntoView(),c=a.doc.resolve(s);a.setSelection(Pe.near(c)),i(a)},addColumnBefore:()=>id,addColumnAfter:()=>sd,deleteColumn:()=>ad,addRowBefore:()=>dd,addRowAfter:()=>ud,deleteRow:()=>fd,deleteTable:()=>Ad,toggleCellMerge:()=>(t,e)=>{yd(t,e)||wd(t,e)},mergeCells:()=>yd,splitCell:()=>wd,toggleHeaderColumn:()=>Md,toggleHeaderRow:()=>Cd,toggleHeaderCell:()=>Od,setCellAttr:({name:t,value:e})=>bd(t,e),fixTables:()=>vh}}keys(){return{Tab:Ed(1),"Shift-Tab":Ed(-1)}}get plugins(){return[...this.options.resizable?[Hh()]:[],Dd()]}}class pu extends ma{get name(){return"table_header"}get schema(){return du.table_header}}class fu extends ma{get name(){return"table_cell"}get schema(){return du.table_cell}}class mu extends ma{get name(){return"table_row"}get schema(){return du.table_row}}class gu extends ma{get name(){return"todo_item"}get defaultOptions(){return{nested:!1}}get view(){return{props:["node","updateAttrs","view"],methods:{onChange(){this.updateAttrs({done:!this.node.attrs.done})}},template:'\n <li :data-type="node.type.name" :data-done="node.attrs.done.toString()" data-drag-handle>\n <span class="todo-checkbox" contenteditable="false" @click="onChange"></span>\n <div class="todo-content" ref="content" :contenteditable="view.editable.toString()"></div>\n </li>\n '}}get schema(){return{attrs:{done:{default:!1}},draggable:!0,content:this.options.nested?"(paragraph|todo_list)+":"paragraph+",toDOM:t=>{const{done:e}=t.attrs;return["li",{"data-type":this.name,"data-done":e.toString()},["span",{class:"todo-checkbox",contenteditable:"false"}],["div",{class:"todo-content"},0]]},parseDOM:[{priority:51,tag:`[data-type="${this.name}"]`,getAttrs:t=>({done:"true"===t.getAttribute("data-done")})}]}}keys({type:t}){return{Enter:ea(t),Tab:this.options.nested?Ul(t):()=>{},"Shift-Tab":Wl(t)}}}class yu extends ma{get name(){return"todo_list"}get schema(){return{group:"block",content:"todo_item+",toDOM:()=>["ul",{"data-type":this.name},0],parseDOM:[{priority:51,tag:`[data-type="${this.name}"]`}]}}commands({type:t,schema:e}){return()=>oa(t,e.nodes.todo_item)}inputRules({type:t}){return[Ml(/^\s*(\[ \])\s$/,t)]}}class wu extends pa{get name(){return"bold"}get schema(){return{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:()=>["strong",0]}}keys({type:t}){return{"Mod-b":dl(t)}}commands({type:t}){return()=>dl(t)}inputRules({type:t}){return[Xl(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,t)]}pasteRules({type:t}){return[Zl(/(?:\*\*|__)([^*_]+)(?:\*\*|__)/g,t)]}}class vu extends pa{get name(){return"code"}get schema(){return{excludes:"_",parseDOM:[{tag:"code"}],toDOM:()=>["code",0]}}keys({type:t}){return{"Mod-`":dl(t)}}commands({type:t}){return()=>dl(t)}inputRules({type:t}){return[Xl(/(?:`)([^`]+)(?:`)$/,t)]}pasteRules({type:t}){return[Zl(/(?:`)([^`]+)(?:`)/g,t)]}}class bu extends pa{get name(){return"italic"}get schema(){return{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]}}keys({type:t}){return{"Mod-i":dl(t)}}commands({type:t}){return()=>dl(t)}inputRules({type:t}){return[Xl(/(?:^|[^_])(_([^_]+)_)$/,t),Xl(/(?:^|[^*])(\*([^*]+)\*)$/,t)]}pasteRules({type:t}){return[Zl(/_([^_]+)_/g,t),Zl(/\*([^*]+)\*/g,t)]}}class xu extends pa{get name(){return"link"}get defaultOptions(){return{openOnClick:!0,target:null}}get schema(){return{attrs:{href:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>({href:t.getAttribute("href"),target:t.getAttribute("target")})}],toDOM:t=>["a",{...t.attrs,rel:"noopener noreferrer nofollow",target:t.attrs.target||this.options.target},0]}}commands({type:t}){return e=>e.href?sa(t,e):Ql(t)}pasteRules({type:t}){return[Yl(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=,()!]*)/gi,t,(t=>({href:t})))]}get plugins(){return this.options.openOnClick?[new en({props:{handleClick:(t,e,n)=>{const{schema:r}=t.state,o=Il(t.state,r.marks.link);o.href&&n.target instanceof HTMLAnchorElement&&(n.stopPropagation(),window.open(o.href,o.target))}}})]:[]}}class ku extends pa{get name(){return"strike"}get schema(){return{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",getAttrs:t=>"line-through"===t}],toDOM:()=>["s",0]}}keys({type:t}){return{"Mod-d":dl(t)}}commands({type:t}){return()=>dl(t)}inputRules({type:t}){return[Xl(/~([^~]+)~$/,t)]}pasteRules({type:t}){return[Zl(/~([^~]+)~/g,t)]}}class Su extends pa{get name(){return"underline"}get schema(){return{parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:t=>"underline"===t}],toDOM:()=>["u",0]}}keys({type:t}){return{"Mod-u":dl(t)}}commands({type:t}){return()=>dl(t)}}class Cu extends ha{get name(){return"history"}get defaultOptions(){return{depth:"",newGroupDelay:""}}keys(){const t={"Mod-z":tu,"Mod-y":eu,"Shift-Mod-z":eu,"Mod-я":tu,"Shift-Mod-я":eu};return t}get plugins(){return[Qd({depth:this.options.depth,newGroupDelay:this.options.newGroupDelay})]}commands(){return{undo:()=>tu,redo:()=>eu,undoDepth:()=>nu,redoDepth:()=>ru}}}function Mu(){return[new ou,new iu,new su,new lu,new au,new cu,new hu,new gu,new yu,new xu,new uu({resizable:!0}),new pu,new fu,new mu,new wu,new vu,new bu,new ku,new Su,new Cu]}var Ou={components:{EditorContent:xa,EditorMenuBar:Ca,Icon:jc},props:{value:String},data(){return{editor:new ba({content:this.$props.value,extensions:Mu(),onUpdate:({getHTML:t})=>{const e=t();this.$emit("input",e)}})}},beforeDestroy(){this.editor.destroy()}},Nu=Ou,Eu=Bc(Nu,n,o,!1,null,null,null),Au=Eu.exports;(window.__goplaidVueComponentRegisters=window.__goplaidVueComponentRegisters||[]).push((t=>{t.component("tiptap-editor",Au)}))}(),o=o["default"],o}()}));