@next-bricks/markdown 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +1 -1
- package/dist/chunks/281.6bd00a86.js +3 -0
- package/dist/chunks/{369.304c9da8.js.LICENSE.txt → 281.6bd00a86.js.LICENSE.txt} +6 -0
- package/dist/chunks/281.6bd00a86.js.map +1 -0
- package/dist/chunks/295.c3756265.js +2 -0
- package/dist/chunks/295.c3756265.js.map +1 -0
- package/dist/chunks/394.351a261e.js +2 -0
- package/dist/chunks/394.351a261e.js.map +1 -0
- package/dist/chunks/eo-markdown-editor.67a3ed17.js +2 -0
- package/dist/chunks/eo-markdown-editor.67a3ed17.js.map +1 -0
- package/dist/chunks/{main.344fb737.js → main.41291faa.js} +2 -2
- package/dist/chunks/main.41291faa.js.map +1 -0
- package/dist/{index.0758ecd9.js → index.7e406b89.js} +2 -2
- package/dist/index.7e406b89.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunks/295.35002895.js +0 -2
- package/dist/chunks/295.35002895.js.map +0 -1
- package/dist/chunks/369.304c9da8.js +0 -3
- package/dist/chunks/369.304c9da8.js.map +0 -1
- package/dist/chunks/709.d18a1e8d.js +0 -2
- package/dist/chunks/709.d18a1e8d.js.map +0 -1
- package/dist/chunks/eo-markdown-editor.556a4964.js +0 -2
- package/dist/chunks/eo-markdown-editor.556a4964.js.map +0 -1
- package/dist/chunks/main.344fb737.js.map +0 -1
- package/dist/index.0758ecd9.js.map +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 369.304c9da8.js.LICENSE.txt */
|
|
2
|
-
(self.webpackChunk_next_bricks_markdown=self.webpackChunk_next_bricks_markdown||[]).push([[369,628],{2609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(s[a]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);r&&s[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},9601:e=>{"use strict";e.exports=function(e){return e[1]}},9385:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},s=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var r,o=t.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!i)return!1;for(r in e);return void 0===r||t.call(e,r)},l=function(e,t){r&&"__proto__"===t.name?r(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},a=function(e,n){if("__proto__"===n){if(!t.call(e,n))return;if(o)return o(e,n).value}return e[n]};e.exports=function e(){var t,n,r,o,c,u,h=arguments[0],d=1,p=arguments.length,f=!1;for("boolean"==typeof h&&(f=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<p;++d)if(null!=(t=arguments[d]))for(n in t)r=a(h,n),h!==(o=a(t,n))&&(f&&o&&(s(o)||(c=i(o)))?(c?(c=!1,u=r&&i(r)?r:[]):u=r&&s(r)?r:{},l(h,{name:n,newValue:e(f,u,o)})):void 0!==o&&l(h,{name:n,newValue:o}));return h}},3335:e=>{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},594:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==h.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=i.test(e);return n||s.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,i,s,l,a,c=0,u=!1,h=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function k(t){var n=r,i=o;return r=o=void 0,c=t,s=e.apply(i,n)}function w(e){var n=e-a;return void 0===a||n>=t||n<0||h&&e-c>=i}function v(){var e=f();if(w(e))return b(e);l=setTimeout(v,function(e){var n=t-(e-a);return h?p(n,i-(e-c)):n}(e))}function b(e){return l=void 0,y&&r?k(e):(r=o=void 0,s)}function x(){var e=f(),n=w(e);if(r=arguments,o=this,a=e,n){if(void 0===l)return function(e){return c=e,l=setTimeout(v,t),u?k(e):s}(a);if(h)return l=setTimeout(v,t),k(a)}return void 0===l&&(l=setTimeout(v,t)),s}return t=g(t)||0,m(n)&&(u=!!n.leading,i=(h="maxWait"in n)?d(g(n.maxWait)||0,t):i,y="trailing"in n?!!n.trailing:y),x.cancel=function(){void 0!==l&&clearTimeout(l),c=0,r=a=o=l=void 0},x.flush=function(){return void 0===l?s:b(f())},x}},5303:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(6522);function o(e,t,n){return(o=function(){function e(e,t){return function(r){!function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished")}(t),n(r,"An initializer"),e.push(r)}}function t(t,n,r,o,i,s,l,a){var c;switch(i){case 1:c="accessor";break;case 2:c="method";break;case 3:c="getter";break;case 4:c="setter";break;default:c="field"}var u,h,d={kind:c,name:l?"#"+n:n,static:s,private:l},p={v:!1};0!==i&&(d.addInitializer=e(o,p)),0===i?l?(u=r.get,h=r.set):(u=function(){return this[n]},h=function(e){this[n]=e}):2===i?u=function(){return r.value}:(1!==i&&3!==i||(u=function(){return r.get.call(this)}),1!==i&&4!==i||(h=function(e){r.set.call(this,e)})),d.access=u&&h?{get:u,set:h}:u?{get:u}:{set:h};try{return t(a,d)}finally{p.v=!0}}function n(e,t){if("function"!=typeof e)throw new TypeError(t+" must be a function")}function o(e,t){var o=(0,r.Z)(t);if(1===e){if("object"!==o||null===t)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==t.get&&n(t.get,"accessor.get"),void 0!==t.set&&n(t.set,"accessor.set"),void 0!==t.init&&n(t.init,"accessor.init")}else if("function"!==o)throw new TypeError((0===e?"field":10===e?"class":"method")+" decorators must return a function or void 0")}function i(e,n,r,i,s,l,a,c){var u,h,d,p,f,m,g=r[0];if(a?u=0===s||1===s?{get:r[3],set:r[4]}:3===s?{get:r[3]}:4===s?{set:r[3]}:{value:r[3]}:0!==s&&(u=Object.getOwnPropertyDescriptor(n,i)),1===s?d={get:u.get,set:u.set}:2===s?d=u.value:3===s?d=u.get:4===s&&(d=u.set),"function"==typeof g)void 0!==(p=t(g,i,u,c,s,l,a,d))&&(o(s,p),0===s?h=p:1===s?(h=p.init,f=p.get||d.get,m=p.set||d.set,d={get:f,set:m}):d=p);else for(var y=g.length-1;y>=0;y--){var k;void 0!==(p=t(g[y],i,u,c,s,l,a,d))&&(o(s,p),0===s?k=p:1===s?(k=p.init,f=p.get||d.get,m=p.set||d.set,d={get:f,set:m}):d=p,void 0!==k&&(void 0===h?h=k:"function"==typeof h?h=[h,k]:h.push(k)))}if(0===s||1===s){if(void 0===h)h=function(e,t){return t};else if("function"!=typeof h){var w=h;h=function(e,t){for(var n=t,r=0;r<w.length;r++)n=w[r].call(e,n);return n}}else{var v=h;h=function(e,t){return v.call(e,t)}}e.push(h)}0!==s&&(1===s?(u.get=d.get,u.set=d.set):2===s?u.value=d:3===s?u.get=d:4===s&&(u.set=d),a?1===s?(e.push((function(e,t){return d.get.call(e,t)})),e.push((function(e,t){return d.set.call(e,t)}))):2===s?e.push(d):e.push((function(e,t){return d.call(e,t)})):Object.defineProperty(n,i,u))}function s(e,t){for(var n,r,o=[],s=new Map,a=new Map,c=0;c<t.length;c++){var u=t[c];if(Array.isArray(u)){var h,d,p=u[1],f=u[2],m=u.length>3,g=p>=5;if(g?(h=e,0!=(p-=5)&&(d=r=r||[])):(h=e.prototype,0!==p&&(d=n=n||[])),0!==p&&!m){var y=g?a:s,k=y.get(f)||0;if(!0===k||3===k&&4!==p||4===k&&3!==p)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+f);!k&&p>2?y.set(f,p):y.set(f,!0)}i(o,h,u,f,p,g,m,d)}}return l(o,n),l(o,r),o}function l(e,t){t&&e.push((function(e){for(var n=0;n<t.length;n++)t[n].call(e);return e}))}return function(t,n,r){return{e:s(t,n),get c(){return function(t,n){if(n.length>0){for(var r=[],i=t,s=t.name,l=n.length-1;l>=0;l--){var a={v:!1};try{var c=n[l](i,{kind:"class",name:s,addInitializer:e(r,a)})}finally{a.v=!0}void 0!==c&&(o(10,c),i=c)}return[i,function(){for(var e=0;e<r.length;e++)r[e].call(i)}]}}(t,r)}}}}())(e,t,n)}},4795:(e,t,n)=>{"use strict";function r(e,t,n,r,o,i,s){try{var l=e[i](s),a=l.value}catch(e){return void n(e)}l.done?t(a):Promise.resolve(a).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var s=e.apply(t,n);function l(e){r(s,o,i,l,a,"next",e)}function a(e){r(s,o,i,l,a,"throw",e)}l(void 0)}))}}n.d(t,{Z:()=>o})},5863:(e,t,n)=>{"use strict";function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}n.d(t,{Z:()=>r})},175:(e,t,n)=>{"use strict";function r(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}n.d(t,{Z:()=>r})},687:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(175);function o(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,(0,r.Z)(e,t,"get"))}},3395:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5863);function o(e,t,n){(0,r.Z)(e,t),t.set(e,n)}},381:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(175);function o(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,(0,r.Z)(e,t,"set"),n),n}},6234:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(6522);function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==(0,r.Z)(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==(0,r.Z)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===(0,r.Z)(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},7896:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{Z:()=>r})},3028:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(6234);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},6522:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Z:()=>r})},8858:(e,t,n)=>{"use strict";n.d(t,{ML:()=>oo,$B:()=>Nr,Iq:()=>Yn,R3:()=>or,vc:()=>mr,Xo:()=>Lr,uW:()=>Pr,Dn:()=>wr,U7:()=>Or,i8:()=>Ar,tQ:()=>Gn,ZP:()=>ar,pB:()=>lr,_z:()=>dr,ZV:()=>Zn,CG:()=>Xn,KP:()=>Er,le:()=>sr,Ck:()=>yr});var r={};n.r(r),n.d(r,{attentionMarkers:()=>be,contentInitial:()=>me,disable:()=>xe,document:()=>fe,flow:()=>ye,flowInitial:()=>ge,insideSpan:()=>ve,string:()=>ke,text:()=>we});var o=n(11),i=n(2665);const s={};function l(e,t){const n=t||s;return a(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function a(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return c(e.children,t,n)}return Array.isArray(e)?c(e,t,n):""}function c(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=a(e[o],t,n);return r.join("")}var u=n(7842),h=n(2473),d=n(5185);const p={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,(function(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,h.f)(e,t,"linePrefix");e.consume(n)}),(function(t){return e.enter("paragraph"),r(t)}));let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):(0,d.Ch)(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),o)}}};var f=n(8391);const m={tokenize:function(e){const t=this,n=[];let r,o,i,s=0;return l;function l(r){if(s<n.length){const o=n[s];return t.containerState=o[1],e.attempt(o[0].continuation,a,c)(r)}return c(r)}function a(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const n=t.events.length;let o,i=n;for(;i--;)if("exit"===t.events[i][0]&&"chunkFlow"===t.events[i][1].type){o=t.events[i][1].end;break}v(s);let l=n;for(;l<t.events.length;)t.events[l][1].end=Object.assign({},o),l++;return(0,f.d)(t.events,i+1,0,t.events.slice(n)),t.events.length=l,c(e)}return l(e)}function c(o){if(s===n.length){if(!r)return p(o);if(r.currentConstruct&&r.currentConstruct.concrete)return y(o);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(g,u,h)(o)}function u(e){return r&&b(),v(s),p(e)}function h(e){return t.parser.lazy[t.now().line]=s!==n.length,i=t.now().offset,y(e)}function p(n){return t.containerState={},e.attempt(g,m,y)(n)}function m(e){return s++,n.push([t.currentConstruct,t.containerState]),p(e)}function y(n){return null===n?(r&&b(),v(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:r}),k(n))}function k(n){return null===n?(w(e.exit("chunkFlow"),!0),v(0),void e.consume(n)):(0,d.Ch)(n)?(e.consume(n),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,l):(e.consume(n),k)}function w(e,n){const l=t.sliceStream(e);if(n&&l.push(null),e.previous=o,o&&(o.next=e),o=e,r.defineSkip(e.start),r.write(l),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<i&&(!r.events[e][1].end||r.events[e][1].end.offset>i))return;const n=t.events.length;let o,l,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){if(o){l=t.events[a][1].end;break}o=!0}for(v(s),e=n;e<t.events.length;)t.events[e][1].end=Object.assign({},l),e++;(0,f.d)(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function v(r){let o=n.length;for(;o-- >r;){const r=n[o];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function b(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}},g={tokenize:function(e,t,n){return(0,h.f)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var y=n(8466);function k(e){const t={};let n,r,o,i,s,l,a,c=-1;for(;++c<e.length;){for(;c in t;)c=t[c];if(n=e[c],c&&"chunkFlow"===n[1].type&&"listItemPrefix"===e[c-1][1].type&&(l=n[1]._tokenizer.events,o=0,o<l.length&&"lineEndingBlank"===l[o][1].type&&(o+=2),o<l.length&&"content"===l[o][1].type))for(;++o<l.length&&"content"!==l[o][1].type;)"chunkText"===l[o][1].type&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,w(e,c)),c=t[c],a=!0);else if(n[1]._container){for(o=c,r=void 0;o--&&(i=e[o],"lineEnding"===i[1].type||"lineEndingBlank"===i[1].type);)"enter"===i[0]&&(r&&(e[r][1].type="lineEndingBlank"),i[1].type="lineEnding",r=o);r&&(n[1].end=Object.assign({},e[r][1].start),s=e.slice(r,c),s.unshift(n),(0,f.d)(e,r,c-r+1,s))}}return!a}function w(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),l=s.events,a=[],c={};let u,h,d=-1,p=n,m=0,g=0;const y=[g];for(;p;){for(;e[++o][1]!==p;);i.push(o),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++d<l.length;)"exit"===l[d][0]&&"enter"===l[d-1][0]&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(g=d+1,y.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),d=y.length;d--;){const t=l.slice(y[d],y[d+1]),n=i.pop();a.unshift([n,n+t.length-1]),(0,f.d)(e,n,2,t)}for(d=-1;++d<a.length;)c[m+a[d][0]]=m+a[d][1],m+=a[d][1]-a[d][0]-1;return c}const v={tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?o(t):(0,d.Ch)(t)?e.check(b,i,o)(t):(e.consume(t),r)}function o(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function i(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}},resolve:function(e){return k(e),e}},b={tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,h.f)(e,o,"linePrefix")};function o(o){if(null===o||(0,d.Ch)(o))return n(o);const i=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}},partial:!0},x={tokenize:function(e){const t=this,n=e.attempt(y.w,(function(r){if(null!==r)return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(r)}),e.attempt(this.parser.constructs.flowInitial,r,(0,h.f)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(v,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}},C={resolveAll:O()},S=N("string"),M=N("text");function N(e){return{tokenize:function(t){const n=this,r=this.parser.constructs[e],o=t.attempt(r,i,s);return i;function i(e){return a(e)?o(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),l;t.consume(e)}function l(e){return a(e)?(t.exit("data"),o(e)):(t.consume(e),l)}function a(e){if(null===e)return!0;const t=r[e];let o=-1;if(t)for(;++o<t.length;){const e=t[o];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}},resolveAll:O("text"===e?T:void 0)}}function O(e){return function(t,n){let r,o=-1;for(;++o<=t.length;)void 0===r?t[o]&&"data"===t[o][1].type&&(r=o,o++):t[o]&&"data"===t[o][1].type||(o!==r+2&&(t[r][1].end=t[o-1][1].end,t.splice(r+2,o-r-2),o=r+2),r=void 0);return e?e(t,n):t}}function T(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],o=t.sliceStream(r);let i,s=o.length,l=-1,a=0;for(;s--;){const e=o[s];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)a++,l--;if(l)break;l=-1}else if(-2===e)i=!0,a++;else if(-1!==e){s++;break}}if(a){const o={type:n===e.length||i||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+s,_bufferIndex:s?l:r.start._bufferIndex+l},end:Object.assign({},r.end)};r.end=Object.assign({},o.start),r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}var A=n(7828);function E(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let s=[],l=[],a=!0;const c={consume:function(e){(0,d.Ch)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,b()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e,a=!0},enter:function(e,t){const n=t||{};return n.type=e,n.start=g(),u.events.push(["enter",n,u]),l.push(n),n},exit:function(e){const t=l.pop();return t.end=g(),u.events.push(["exit",t,u]),t},attempt:w((function(e,t){v(e,t.from)})),check:w(k),interrupt:w(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if("string"==typeof i)s=i;else switch(i){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&o)continue;s=" ";break;default:s=String.fromCharCode(i)}o=-2===i,r.push(s)}return r.join("")}(m(e),t)},now:g,defineSkip:function(e){o[e.line]=e.column,b()},write:function(e){return s=(0,f.V)(s,e),function(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)y(t.charCodeAt(r._bufferIndex));else y(t)}}(),null!==s[s.length-1]?[]:(v(t,0),u.events=(0,A.C)(i,u.events,u),u.events)}};let h,p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function m(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;return n===o?s=[e[n].slice(r,i)]:(s=e.slice(n,o),r>-1&&(s[0]=s[0].slice(r)),i>0&&s.push(e[o].slice(0,i))),s}(s,e)}function g(){return Object.assign({},r)}function y(e){a=void 0,h=e,p=p(e)}function k(e,t){t.restore()}function w(e,t){return function(n,o,i){let s,h,d,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return function(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return s=e,h=0,0===e.length?i:m(e[h])}function m(e){return function(n){return p=function(){const e=g(),t=u.previous,n=u.currentConstruct,o=u.events.length,i=Array.from(l);return{restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=o,l=i,b()},from:o}}(),d=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name)?k():e.tokenize.call(t?Object.assign(Object.create(u),t):u,c,y,k)(n)}}function y(t){return a=!0,e(d,p),o}function k(e){return a=!0,p.restore(),++h<s.length?m(s[h]):i}}}function v(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&(0,f.d)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function b(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}const D={name:"thematicBreak",tokenize:function(e,t,n){let r,o=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,i(e)}(t)};function i(i){return i===r?(e.enter("thematicBreakSequence"),s(i)):o>=3&&(null===i||(0,d.Ch)(i))?(e.exit("thematicBreak"),t(i)):n(i)}function s(t){return t===r?(e.consume(t),o++,s):(e.exit("thematicBreakSequence"),(0,d.xz)(t)?(0,h.f)(e,i,"whitespace")(t):i(t))}}},I={name:"list",tokenize:function(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,s=0;return function(t){const o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:(0,d.pY)(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(D,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(t)}return n(t)};function l(t){return(0,d.pY)(t)&&++s<10?(e.consume(t),l):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),a(t)):n(t)}function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(y.w,r.interrupt?n:c,e.attempt(F,h,u))}function c(e){return r.containerState.initialBlankLine=!0,i++,h(e)}function u(t){return(0,d.xz)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),h):n(t)}function h(n){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(y.w,(function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,h.f)(e,t,"listItemIndent",r.containerState.size+1)(n)}),(function(n){return r.containerState.furtherBlankLines||!(0,d.xz)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(R,t,o)(n))}));function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,h.f)(e,e.attempt(I,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},F={tokenize:function(e,t,n){const r=this;return(0,h.f)(e,(function(e){const o=r.events[r.events.length-1];return!(0,d.xz)(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)}),"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},R={tokenize:function(e,t,n){const r=this;return(0,h.f)(e,(function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)}),"listItemIndent",r.containerState.size+1)},partial:!0},z={name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return(0,d.xz)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){const r=this;return function(t){return(0,d.xz)(t)?(0,h.f)(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(r){return e.attempt(z,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function B(e,t,n,r,o,i,s,l,a){const c=a||Number.POSITIVE_INFINITY;let u=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(i),e.consume(t),e.exit(i),h):null===t||41===t||(0,d.Av)(t)?n(t):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(t))};function h(n){return 62===n?(e.enter(i),e.consume(n),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(l),h(t)):null===t||60===t||(0,d.Ch)(t)?n(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(o){return 40===o?++u>c?n(o):(e.consume(o),m):41===o?u--?(e.consume(o),m):(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(o)):null===o||(0,d.z3)(o)?u?n(o):(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(o)):(0,d.Av)(o)?n(o):(e.consume(o),92===o?g:m)}function g(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function P(e,t,n,r,o,i){const s=this;let l,a=0;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),e.enter(i),c};function c(h){return null===h||91===h||93===h&&!l||94===h&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs||a>999?n(h):93===h?(e.exit(i),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(0,d.Ch)(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(t){return null===t||91===t||93===t||(0,d.Ch)(t)||a++>999?(e.exit("chunkString"),c(t)):(e.consume(t),l=l||!(0,d.xz)(t),92===t?h:u)}function h(t){return 91===t||92===t||93===t?(e.consume(t),a++,u):u(t)}}function L(e,t,n,r,o,i){let s;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),s=40===t?41:t,l};function l(n){return n===s?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(i),a(n))}function a(t){return t===s?(e.exit(i),l(s)):null===t?n(t):(0,d.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,h.f)(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||(0,d.Ch)(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?u:c)}function u(t){return t===s||92===t?(e.consume(t),c):c(t)}}function $(e,t){let n;return function r(o){return(0,d.Ch)(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):(0,d.xz)(o)?(0,h.f)(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var j=n(6910);const H={name:"definition",tokenize:function(e,t,n){const r=this;let o;return function(t){return e.enter("definition"),function(t){return P.call(r,e,i,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function i(t){return o=(0,j.d)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return(0,d.z3)(t)?$(e,l)(t):l(t)}function l(t){return B(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(V,c,c)(t)}function c(t){return(0,d.xz)(t)?(0,h.f)(e,u,"whitespace")(t):u(t)}function u(i){return null===i||(0,d.Ch)(i)?(e.exit("definition"),r.parser.defined.push(o),t(i)):n(i)}}},V={tokenize:function(e,t,n){return function(t){return(0,d.z3)(t)?$(e,r)(t):n(t)};function r(t){return L(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return(0,d.xz)(t)?(0,h.f)(e,i,"whitespace")(t):i(t)}function i(e){return null===e||(0,d.Ch)(e)?t(e):n(e)}},partial:!0},_={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),(0,h.f)(e,o,"linePrefix",5)(t)};function o(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?i(e):n(e)}function i(t){return null===t?l(t):(0,d.Ch)(t)?e.attempt(W,i,l)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||(0,d.Ch)(t)?(e.exit("codeFlowValue"),i(t)):(e.consume(t),s)}function l(n){return e.exit("codeIndented"),t(n)}}},W={tokenize:function(e,t,n){const r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):(0,d.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(0,h.f)(e,i,"linePrefix",5)(t)}function i(e){const i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):(0,d.Ch)(e)?o(e):n(e)}},partial:!0},q={name:"headingAtx",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&r++<6?(e.consume(t),o):null===t||(0,d.z3)(t)?(e.exit("atxHeadingSequence"),i(t)):n(t)}function i(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||(0,d.Ch)(n)?(e.exit("atxHeading"),t(n)):(0,d.xz)(n)?(0,h.f)(e,i,"whitespace")(n):(e.enter("atxHeadingText"),l(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),i(t))}function l(t){return null===t||35===t||(0,d.z3)(t)?(e.exit("atxHeadingText"),i(t)):(e.consume(t),l)}},resolve:function(e,t){let n,r,o=e.length-2,i=3;return"whitespace"===e[i][1].type&&(i+=2),o-2>i&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(i===o-1||o-4>i&&"whitespace"===e[o-2][1].type)&&(o-=i+1===o?2:4),o>i&&(n={type:"atxHeadingText",start:e[i][1].start,end:e[o][1].end},r={type:"chunkText",start:e[i][1].start,end:e[o][1].end,contentType:"text"},(0,f.d)(e,i,o-i+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},K={name:"setextUnderline",tokenize:function(e,t,n){const r=this;let o;return function(t){let s,l=r.events.length;for(;l--;)if("lineEnding"!==r.events[l][1].type&&"linePrefix"!==r.events[l][1].type&&"content"!==r.events[l][1].type){s="paragraph"===r.events[l][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!s?n(t):(e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),i(t)}(t))};function i(t){return t===o?(e.consume(t),i):(e.exit("setextHeadingLineSequence"),(0,d.xz)(t)?(0,h.f)(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||(0,d.Ch)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,o,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){n=i;break}"paragraph"===e[i][1].type&&(r=i)}else"content"===e[i][1].type&&e.splice(i,1),o||"definition"!==e[i][1].type||(o=i);const s={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",s,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[o][1].end)):e[n][1]=s,e.push(["exit",s,t]),e}},Y=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],U=["pre","script","style","textarea"],J={name:"htmlFlow",tokenize:function(e,t,n){const r=this;let o,i,s,l,a;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(l){return 33===l?(e.consume(l),u):47===l?(e.consume(l),i=!0,f):63===l?(e.consume(l),o=3,r.interrupt?t:z):(0,d.jv)(l)?(e.consume(l),s=String.fromCharCode(l),m):n(l)}function u(i){return 45===i?(e.consume(i),o=2,h):91===i?(e.consume(i),o=5,l=0,p):(0,d.jv)(i)?(e.consume(i),o=4,r.interrupt?t:z):n(i)}function h(o){return 45===o?(e.consume(o),r.interrupt?t:z):n(o)}function p(o){return o==="CDATA[".charCodeAt(l++)?(e.consume(o),6===l?r.interrupt?t:O:p):n(o)}function f(t){return(0,d.jv)(t)?(e.consume(t),s=String.fromCharCode(t),m):n(t)}function m(l){if(null===l||47===l||62===l||(0,d.z3)(l)){const a=47===l,c=s.toLowerCase();return a||i||!U.includes(c)?Y.includes(s.toLowerCase())?(o=6,a?(e.consume(l),g):r.interrupt?t(l):O(l)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(l):i?y(l):k(l)):(o=1,r.interrupt?t(l):O(l))}return 45===l||(0,d.H$)(l)?(e.consume(l),s+=String.fromCharCode(l),m):n(l)}function g(o){return 62===o?(e.consume(o),r.interrupt?t:O):n(o)}function y(t){return(0,d.xz)(t)?(e.consume(t),y):M(t)}function k(t){return 47===t?(e.consume(t),M):58===t||95===t||(0,d.jv)(t)?(e.consume(t),w):(0,d.xz)(t)?(e.consume(t),k):M(t)}function w(t){return 45===t||46===t||58===t||95===t||(0,d.H$)(t)?(e.consume(t),w):v(t)}function v(t){return 61===t?(e.consume(t),b):(0,d.xz)(t)?(e.consume(t),v):k(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,x):(0,d.xz)(t)?(e.consume(t),b):C(t)}function x(t){return t===a?(e.consume(t),a=null,S):null===t||(0,d.Ch)(t)?n(t):(e.consume(t),x)}function C(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||(0,d.z3)(t)?v(t):(e.consume(t),C)}function S(e){return 47===e||62===e||(0,d.xz)(e)?k(e):n(e)}function M(t){return 62===t?(e.consume(t),N):n(t)}function N(t){return null===t||(0,d.Ch)(t)?O(t):(0,d.xz)(t)?(e.consume(t),N):n(t)}function O(t){return 45===t&&2===o?(e.consume(t),D):60===t&&1===o?(e.consume(t),I):62===t&&4===o?(e.consume(t),B):63===t&&3===o?(e.consume(t),z):93===t&&5===o?(e.consume(t),R):!(0,d.Ch)(t)||6!==o&&7!==o?null===t||(0,d.Ch)(t)?(e.exit("htmlFlowData"),T(t)):(e.consume(t),O):(e.exit("htmlFlowData"),e.check(G,P,T)(t))}function T(t){return e.check(Z,A,P)(t)}function A(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),E}function E(t){return null===t||(0,d.Ch)(t)?T(t):(e.enter("htmlFlowData"),O(t))}function D(t){return 45===t?(e.consume(t),z):O(t)}function I(t){return 47===t?(e.consume(t),s="",F):O(t)}function F(t){if(62===t){const n=s.toLowerCase();return U.includes(n)?(e.consume(t),B):O(t)}return(0,d.jv)(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),F):O(t)}function R(t){return 93===t?(e.consume(t),z):O(t)}function z(t){return 62===t?(e.consume(t),B):45===t&&2===o?(e.consume(t),z):O(t)}function B(t){return null===t||(0,d.Ch)(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),B)}function P(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},G={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(y.w,t,n)}},partial:!0},Z={tokenize:function(e,t,n){const r=this;return function(t){return(0,d.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},X={tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},Q={name:"codeFenced",tokenize:function(e,t,n){const r=this,o={tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),(0,d.xz)(t)?(0,h.f)(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)}function a(t){return t===i?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===i?(o++,e.consume(t),c):o>=l?(e.exit("codeFencedFenceSequence"),(0,d.xz)(t)?(0,h.f)(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||(0,d.Ch)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0};let i,s=0,l=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,i=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),a(t)}(t)};function a(t){return t===i?(l++,e.consume(t),a):l<3?n(t):(e.exit("codeFencedFenceSequence"),(0,d.xz)(t)?(0,h.f)(e,c,"whitespace")(t):c(t))}function c(n){return null===n||(0,d.Ch)(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(X,m,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||(0,d.Ch)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):(0,d.xz)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,h.f)(e,p,"whitespace")(t)):96===t&&t===i?n(t):(e.consume(t),u)}function p(t){return null===t||(0,d.Ch)(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||(0,d.Ch)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===i?n(t):(e.consume(t),f)}function m(t){return e.attempt(o,v,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),y}function y(t){return s>0&&(0,d.xz)(t)?(0,h.f)(e,k,"linePrefix",s+1)(t):k(t)}function k(t){return null===t||(0,d.Ch)(t)?e.check(X,m,v)(t):(e.enter("codeFlowValue"),w(t))}function w(t){return null===t||(0,d.Ch)(t)?(e.exit("codeFlowValue"),k(t)):(e.consume(t),w)}function v(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var ee=n(8731);const te={name:"characterReference",tokenize:function(e,t,n){const r=this;let o,i,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),o=31,i=d.H$,c(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=d.AF,c):(e.enter("characterReferenceValue"),o=7,i=d.pY,c(t))}function c(l){if(59===l&&s){const o=e.exit("characterReferenceValue");return i!==d.H$||(0,ee.T)(r.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return i(l)&&s++<o?(e.consume(l),c):n(l)}}},ne={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return(0,d.sR)(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},re={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,h.f)(e,t,"linePrefix")}}},oe={name:"labelEnd",tokenize:function(e,t,n){const r=this;let o,i,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){o=r.events[s][1];break}return function(t){return o?o._inactive?u(t):(i=r.parser.defined.includes((0,j.d)(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),l):n(t)};function l(t){return 40===t?e.attempt(ie,c,i?c:u)(t):91===t?e.attempt(se,c,i?a:u)(t):i?c(t):u(t)}function a(t){return e.attempt(le,c,u)(t)}function c(e){return t(e)}function u(e){return o._balanced=!0,n(e)}},resolveTo:function(e,t){let n,r,o,i,s=e.length,l=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(o){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(o=s);const a={type:"labelLink"===e[r][1].type?"link":"image",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[r][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[r+l+2][1].end),end:Object.assign({},e[o-2][1].start)};return i=[["enter",a,t],["enter",c,t]],i=(0,f.V)(i,e.slice(r+1,r+l+3)),i=(0,f.V)(i,[["enter",u,t]]),i=(0,f.V)(i,(0,A.C)(t.parser.constructs.insideSpan.null,e.slice(r+l+4,o-3),t)),i=(0,f.V)(i,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),i=(0,f.V)(i,e.slice(o+1)),i=(0,f.V)(i,[["exit",a,t]]),(0,f.d)(e,r,e.length,i),e},resolveAll:function(e){let t=-1;for(;++t<e.length;){const n=e[t][1];"labelImage"!==n.type&&"labelLink"!==n.type&&"labelEnd"!==n.type||(e.splice(t+1,"labelImage"===n.type?4:2),n.type="data",t++)}return e}},ie={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return(0,d.z3)(t)?$(e,o)(t):o(t)}function o(t){return 41===t?c(t):B(e,i,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return(0,d.z3)(t)?$(e,l)(t):c(t)}function s(e){return n(e)}function l(t){return 34===t||39===t||40===t?L(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function a(t){return(0,d.z3)(t)?$(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},se={tokenize:function(e,t,n){const r=this;return function(t){return P.call(r,e,o,i,"reference","referenceMarker","referenceString")(t)};function o(e){return r.parser.defined.includes((0,j.d)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function i(e){return n(e)}}},le={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},ae={name:"labelStartImage",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),o};function o(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):n(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll};var ce=n(898);const ue={name:"attention",tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=(0,ce.r)(r);let i;return function(t){return i=t,e.enter("attentionSequence"),s(t)};function s(l){if(l===i)return e.consume(l),s;const a=e.exit("attentionSequence"),c=(0,ce.r)(l),u=!c||2===c&&o||n.includes(l),h=!o||2===o&&c||n.includes(r);return a._open=Boolean(42===i?u:u&&(o||!h)),a._close=Boolean(42===i?h:h&&(c||!u)),t(l)}},resolveAll:function(e,t){let n,r,o,i,s,l,a,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const h=Object.assign({},e[n][1].end),d=Object.assign({},e[u][1].start);he(h,-l),he(d,l),i={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[n][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[u][1].start),end:d},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[u][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},s.end)},e[n][1].end=Object.assign({},i.start),e[u][1].start=Object.assign({},s.end),a=[],e[n][1].end.offset-e[n][1].start.offset&&(a=(0,f.V)(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=(0,f.V)(a,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",o,t]]),a=(0,f.V)(a,(0,A.C)(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),a=(0,f.V)(a,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,a=(0,f.V)(a,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,f.d)(e,n-1,u-n+3,a),u=n+a.length-c-2;break}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e}};function he(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const de={name:"htmlText",tokenize:function(e,t,n){const r=this;let o,i,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),x):63===t?(e.consume(t),v):(0,d.jv)(t)?(e.consume(t),M):n(t)}function a(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,m):(0,d.jv)(t)?(e.consume(t),w):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),p):(0,d.Ch)(t)?(s=u,R(t)):(e.consume(t),u)}function p(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?F(e):45===e?p(e):u(e)}function m(t){return t==="CDATA[".charCodeAt(i++)?(e.consume(t),6===i?g:m):n(t)}function g(t){return null===t?n(t):93===t?(e.consume(t),y):(0,d.Ch)(t)?(s=g,R(t)):(e.consume(t),g)}function y(t){return 93===t?(e.consume(t),k):g(t)}function k(t){return 62===t?F(t):93===t?(e.consume(t),k):g(t)}function w(t){return null===t||62===t?F(t):(0,d.Ch)(t)?(s=w,R(t)):(e.consume(t),w)}function v(t){return null===t?n(t):63===t?(e.consume(t),b):(0,d.Ch)(t)?(s=v,R(t)):(e.consume(t),v)}function b(e){return 62===e?F(e):v(e)}function x(t){return(0,d.jv)(t)?(e.consume(t),C):n(t)}function C(t){return 45===t||(0,d.H$)(t)?(e.consume(t),C):S(t)}function S(t){return(0,d.Ch)(t)?(s=S,R(t)):(0,d.xz)(t)?(e.consume(t),S):F(t)}function M(t){return 45===t||(0,d.H$)(t)?(e.consume(t),M):47===t||62===t||(0,d.z3)(t)?N(t):n(t)}function N(t){return 47===t?(e.consume(t),F):58===t||95===t||(0,d.jv)(t)?(e.consume(t),O):(0,d.Ch)(t)?(s=N,R(t)):(0,d.xz)(t)?(e.consume(t),N):F(t)}function O(t){return 45===t||46===t||58===t||95===t||(0,d.H$)(t)?(e.consume(t),O):T(t)}function T(t){return 61===t?(e.consume(t),A):(0,d.Ch)(t)?(s=T,R(t)):(0,d.xz)(t)?(e.consume(t),T):N(t)}function A(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,E):(0,d.Ch)(t)?(s=A,R(t)):(0,d.xz)(t)?(e.consume(t),A):(e.consume(t),D)}function E(t){return t===o?(e.consume(t),o=void 0,I):null===t?n(t):(0,d.Ch)(t)?(s=E,R(t)):(e.consume(t),E)}function D(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,d.z3)(t)?N(t):(e.consume(t),D)}function I(e){return 47===e||62===e||(0,d.z3)(e)?N(e):n(e)}function F(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function R(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),z}function z(t){return(0,d.xz)(t)?(0,h.f)(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):B(t)}function B(t){return e.enter("htmlTextData"),s(t)}}},pe={name:"codeText",tokenize:function(e,t,n){let r,o,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),i++,s):(e.exit("codeTextSequence"),l(t))}function l(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):96===t?(o=e.enter("codeTextSequence"),r=0,c(t)):(0,d.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("codeTextData"),a(t))}function a(t){return null===t||32===t||96===t||(0,d.Ch)(t)?(e.exit("codeTextData"),l(t)):(e.consume(t),a)}function c(n){return 96===n?(e.consume(n),r++,c):r===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(o.type="codeTextData",a(n))}},resolve:function(e){let t,n,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=o;++t<r;)if("codeTextData"===e[t][1].type){e[o][1].type="codeTextPadding",e[r][1].type="codeTextPadding",o+=2,r-=2;break}for(t=o-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type}},fe={42:I,43:I,45:I,48:I,49:I,50:I,51:I,52:I,53:I,54:I,55:I,56:I,57:I,62:z},me={91:H},ge={[-2]:_,[-1]:_,32:_},ye={35:q,42:D,45:[K,D],60:J,61:K,95:D,96:Q,126:Q},ke={38:te,92:ne},we={[-5]:re,[-4]:re,[-3]:re,33:ae,38:te,42:ue,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return(0,d.jv)(t)?(e.consume(t),i):a(t)}function i(e){return 43===e||45===e||46===e||(0,d.H$)(e)?(r=1,s(e)):a(e)}function s(t){return 58===t?(e.consume(t),r=0,l):(43===t||45===t||46===t||(0,d.H$)(t))&&r++<32?(e.consume(t),s):(r=0,a(t))}function l(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,d.Av)(r)?n(r):(e.consume(r),l)}function a(t){return 64===t?(e.consume(t),c):(0,d.n9)(t)?(e.consume(t),a):n(t)}function c(e){return(0,d.H$)(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):h(n)}function h(t){if((45===t||(0,d.H$)(t))&&r++<63){const n=45===t?h:u;return e.consume(t),n}return n(t)}}},de],91:{name:"labelStartLink",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),o};function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:oe.resolveAll},92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,d.Ch)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},ne],93:oe,95:ue,96:pe},ve={null:[ue,C]},be={null:[42,95]},xe={null:[]},Ce=/[\0\t\n\r]/g;var Se=n(8578),Me=n(2857);function Ne(e){return e&&"object"==typeof e?"position"in e||"type"in e?Te(e.position):"start"in e||"end"in e?Te(e):"line"in e||"column"in e?Oe(e):"":""}function Oe(e){return Ae(e&&e.line)+":"+Ae(e&&e.column)}function Te(e){return Oe(e&&e.start)+"-"+Oe(e&&e.end)}function Ae(e){return e&&"number"==typeof e?e:1}const Ee={}.hasOwnProperty,De=function(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(b),autolinkProtocol:p,autolinkEmail:p,atxHeading:s(k),blockQuote:s((function(){return{type:"blockquote",children:[]}})),characterEscape:p,characterReference:p,codeFenced:s(y),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(y,a),codeText:s((function(){return{type:"inlineCode",value:""}}),a),codeTextData:p,data:p,codeFlowValue:p,definition:s((function(){return{type:"definition",identifier:"",label:null,title:null,url:""}})),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s((function(){return{type:"emphasis",children:[]}})),hardBreakEscape:s(w),hardBreakTrailing:s(w),htmlFlow:s(v,a),htmlFlowData:p,htmlText:s(v,a),htmlTextData:p,image:s((function(){return{type:"image",title:null,url:"",alt:null}})),label:a,link:s(b),listItem:s((function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}})),listItemValue:function(e){i("expectingFirstListItemValue")&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),o("expectingFirstListItemValue"))},listOrdered:s(x,(function(){o("expectingFirstListItemValue",!0)})),listUnordered:s(x),paragraph:s((function(){return{type:"paragraph",children:[]}})),reference:function(){o("referenceType","collapsed")},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(k),strong:s((function(){return{type:"strong",children:[]}})),thematicBreak:s((function(){return{type:"thematicBreak"}}))},exit:{atxHeading:u(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}},autolink:u(),autolinkEmail:function(e){f.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){f.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:u(),characterEscapeValue:f,characterReferenceMarkerHexadecimal:g,characterReferenceMarkerNumeric:g,characterReferenceValue:function(e){const t=this.sliceSerialize(e),n=i("characterReferenceType");let r;n?(r=(0,Se.o)(t,"characterReferenceMarkerNumeric"===n?10:16),o("characterReferenceType")):r=(0,ee.T)(t);const s=this.stack.pop();s.value+=r,s.position.end=Ie(e.end)},codeFenced:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),o("flowCodeInside")})),codeFencedFence:function(){i("flowCodeInside")||(this.buffer(),o("flowCodeInside",!0))},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:f,codeIndented:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")})),codeText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),codeTextData:f,data:f,definition:u(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.d)(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:u(),hardBreakEscape:u(m),hardBreakTrailing:u(m),htmlFlow:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlFlowData:f,htmlText:u((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlTextData:f,image:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(o("inReference",!0),"link"===n.type){const t=e.children;n.children=t}else n.alt=t},labelText:function(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=(0,Me.v)(t),n.identifier=(0,j.d)(t).toLowerCase()},lineEnding:function(e){const n=this.stack[this.stack.length-1];if(i("atHardBreak"))return n.children[n.children.length-1].position.end=Ie(e.end),void o("atHardBreak");!i("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(n.type)&&(p.call(this,e),f.call(this,e))},link:u((function(){const e=this.stack[this.stack.length-1];if(i("inReference")){const t=i("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;o("referenceType")})),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,j.d)(this.sliceSerialize(e)).toLowerCase(),o("referenceType","full")},resourceDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){o("inReference")},setextHeading:u((function(){o("setextHeadingSlurpLineEnding")})),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).charCodeAt(0)?1:2},setextHeadingText:function(){o("setextHeadingSlurpLineEnding",!0)},strong:u(),thematicBreak:u()}};Fe(t,(e||{}).mdastExtensions||[]);const n={};return function(e){let n={type:"root",children:[]};const s={stack:[n],tokenStack:[],config:t,enter:c,exit:h,buffer:a,resume:d,setData:o,getData:i},l=[];let u=-1;for(;++u<e.length;)"listOrdered"!==e[u][1].type&&"listUnordered"!==e[u][1].type||("enter"===e[u][0]?l.push(u):u=r(e,l.pop(),u));for(u=-1;++u<e.length;){const n=t[e[u][0]];Ee.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},s),e[u][1])}if(s.tokenStack.length>0){const e=s.tokenStack[s.tokenStack.length-1];(e[1]||ze).call(s,void 0,e[0])}for(n.position={start:Ie(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ie(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)n=t.transforms[u](n)||n;return n};function r(e,t,n){let r,o,i,s,l=t-1,a=-1,c=!1;for(;++l<=n;){const t=e[l];if("listUnordered"===t[1].type||"listOrdered"===t[1].type||"blockQuote"===t[1].type?("enter"===t[0]?a++:a--,s=void 0):"lineEndingBlank"===t[1].type?"enter"===t[0]&&(!r||s||a||i||(i=l),s=void 0):"linePrefix"===t[1].type||"listItemValue"===t[1].type||"listItemMarker"===t[1].type||"listItemPrefix"===t[1].type||"listItemPrefixWhitespace"===t[1].type||(s=void 0),!a&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===a&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=l;for(o=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;o&&(e[o][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",o=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}i&&(!o||i<o)&&(r._spread=!0),r.end=Object.assign({},o?e[o][1].start:t[1].end),e.splice(o||l,0,["exit",r,t[2]]),l++,n++}"listItemPrefix"===t[1].type&&(r={type:"listItem",_spread:!1,start:Object.assign({},t[1].start)},e.splice(l,0,["enter",r,t[2]]),l++,n++,i=void 0,s=!0)}}return e[t][1]._spread=c,n}function o(e,t){n[e]=t}function i(e){return n[e]}function s(e,t){return function(n){c.call(this,e(n),n),t&&t.call(this,n)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(e,t,n){return this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n]),e.position={start:Ie(t.start)},e}function u(e){return function(t){e&&e.call(this,t),h.call(this,t)}}function h(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Ne({start:e.start,end:e.end})+"): it’s not open");return r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ze).call(this,e,r[0])),n.position.end=Ie(e.end),n}function d(){return l(this.stack.pop())}function p(e){const t=this.stack[this.stack.length-1];let n=t.children[t.children.length-1];n&&"text"===n.type||(n={type:"text",value:""},n.position={start:Ie(e.start)},t.children.push(n)),this.stack.push(n)}function f(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Ie(e.end)}function m(){o("atHardBreak",!0)}function g(e){o("characterReferenceType",e.type)}function y(){return{type:"code",lang:null,meta:null,value:""}}function k(){return{type:"heading",depth:void 0,children:[]}}function w(){return{type:"break"}}function v(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function x(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}}(n)(function(e){for(;!k(e););return e}(function(e={}){const t={defined:[],lazy:{},constructs:(0,u.W)([r].concat(e.extensions||[])),content:n(p),document:n(m),flow:n(x),string:n(S),text:n(M)};return t;function n(e){return function(n){return E(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(o,i,s){const l=[];let a,c,u,h,d;for(o=n+o.toString(i),u=0,n="",r&&(65279===o.charCodeAt(0)&&u++,r=void 0);u<o.length;){if(Ce.lastIndex=u,a=Ce.exec(o),h=a&&void 0!==a.index?a.index:o.length,d=o.charCodeAt(h),!a){n=o.slice(u);break}if(10===d&&u===h&&e)l.push(-3),e=void 0;else switch(e&&(l.push(-5),e=void 0),u<h&&(l.push(o.slice(u,h)),t+=h-u),d){case 0:l.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),l.push(-2);t++<c;)l.push(-1);break;case 10:l.push(-4),t=1;break;default:e=!0,t=1}u=h+1}return s&&(e&&l.push(-5),n&&l.push(n),l.push(null)),l}}()(e,t,!0))))};function Ie(e){return{line:e.line,column:e.column,offset:e.offset}}function Fe(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Fe(e,r):Re(e,r)}}function Re(e,t){let n;for(n in t)if(Ee.call(t,n))if("canContainEols"===n){const r=t[n];r&&e[n].push(...r)}else if("transforms"===n){const r=t[n];r&&e[n].push(...r)}else if("enter"===n||"exit"===n){const r=t[n];r&&Object.assign(e[n],r)}}function ze(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ne({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ne({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ne({start:t.start,end:t.end})+") is still open")}function Be(e){Object.assign(this,{Parser:t=>{const n=this.data("settings");return De(t,Object.assign({},n,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}const Pe={}.hasOwnProperty;function Le(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)Le(e,t.extensions[r]);for(n in t)"extensions"===n||("unsafe"===n||"join"===n?e[n]=[...e[n]||[],...t[n]||[]]:"handlers"===n?e[n]=Object.assign(e[n],t[n]||{}):e.options[n]=t[n]);return e}function $e(e,t,n){return">"+(n?"":" ")+e}var je=n(2590);function He(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if("\n"===n.unsafe[o].character&&(0,je.P)(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function Ve(e,t){return Boolean(!t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function _e(e,t,n){return(n?"":" ")+e}function We(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function qe(e,t,n,r){const o=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),i=n.enter("emphasis"),s=n.createTracker(r);let l=s.move(o);return l+=s.move(n.containerPhrasing(e,{before:l,after:o,...s.current()})),l+=s.move(o),i(),l}qe.peek=function(e,t,n){return n.options.emphasis||"*"};var Ke=n(6355),Ye=n(1104);function Ue(e,t){let n=!1;return(0,Ke.Vn)(e,(e=>{if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Ye.BK})),Boolean((!e.depth||e.depth<3)&&l(e)&&(t.options.setext||n))}function Je(e){return e.value||""}function Ge(e,t,n,r){const o=We(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("image");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("![");return c+=a.move(n.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=a.move(" "+o),c+=a.move(n.safe(e.title,{before:c,after:o,...a.current()})),c+=a.move(o),l()),c+=a.move(")"),s(),c}function Ze(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const l=n.createTracker(r);let a=l.move("![");const c=n.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===h?"shortcut"===o?a=a.slice(0,-1):a+=l.move("]"):a+=l.move(h+"]"),a}Je.peek=function(){return"<"},Ge.peek=function(){return"!"},Ze.peek=function(){return"!"};var Xe=n(7875);function Qe(e,t){const n=l(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function et(e,t,n,r){const o=We(n),i='"'===o?"Quote":"Apostrophe",s=n.createTracker(r);let l,a;if(Qe(e,n)){const t=n.stack;n.stack=[],l=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),l(),n.stack=t,r}l=n.enter("link"),a=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(a=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),a()),c+=s.move(")"),l(),c}function tt(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const l=n.createTracker(r);let a=l.move("[");const c=n.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return s(),n.stack=u,i(),"full"!==o&&c&&c===h?"shortcut"===o?a=a.slice(0,-1):a+=l.move("]"):a+=l.move(h+"]"),a}et.peek=function(e,t,n){return Qe(e,n)?"<":"["},tt.peek=function(){return"["};var nt=n(2527);function rt(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ot(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}var it=n(207);const st=(0,n(7689).O)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","link","linkReference","strong","text"]);function lt(e,t,n,r){const o=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),i=n.enter("strong"),s=n.createTracker(r);let l=s.move(o+o);return l+=s.move(n.containerPhrasing(e,{before:l,after:o,...s.current()})),l+=s.move(o+o),i(),l}lt.peek=function(e,t,n){return n.options.strong||"*"};const at={blockquote:function(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),$e);return o(),s},break:He,code:function(e,t,n,r){const o=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),i=e.value||"",s="`"===o?"GraveAccent":"Tilde";if(Ve(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(i,_e);return e(),t}const l=n.createTracker(r),a=o.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),o=r,i=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===o?++i>s&&(s=i):i=1,o=r+t.length,r=n.indexOf(t,o);return s}(i,o)+1,3)),c=n.enter("codeFenced");let u=l.move(a);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=l.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=l.move(" "),u+=l.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...l.current()})),t()}return u+=l.move("\n"),i&&(u+=l.move(i+"\n")),u+=l.move(a),c(),u},definition:function(e,t,n,r){const o=We(n),i='"'===o?"Quote":"Apostrophe",s=n.enter("definition");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("[");return c+=a.move(n.safe(n.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=a.move(" "+o),c+=a.move(n.safe(e.title,{before:c,after:o,...a.current()})),c+=a.move(o),l()),s(),c},emphasis:qe,hardBreak:He,heading:function(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(Ue(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...i.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===o?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(o),l=n.enter("headingAtx"),a=n.enter("phrasing");i.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...i.current()});return/^[\t ]/.test(c)&&(c="&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),a(),l(),c},html:Je,image:Ge,imageReference:Ze,inlineCode:Xe.Y,link:et,linkReference:tt,list:function(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?rt(n):(0,nt.g)(n);const l=e.ordered?function(e){const t=rt(e),n=e.options.bulletOrderedOther;if(!n)return"."===t?")":".";if("."!==n&&")"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrderedOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bulletOrdered` (`"+t+"`) and `bulletOrderedOther` (`"+n+"`) to be different");return n}(n):function(e){const t=(0,nt.g)(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n),a=n.bulletLastUsed;let c=!1;if(t&&(e.ordered?n.options.bulletOrderedOther:n.options.bulletOther)&&a&&s===a&&(c=!0),!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(c=!0),ot(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){c=!0;break}}}}c&&(s=l),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),u},listItem:it.q,paragraph:function(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),o(),s},root:function(e,t,n,r){const o=e.children.some((e=>st(e)));return(o?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:lt,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(ot(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},ct=[function(e,t,n,r){if("code"===t.type&&Ve(t,r)&&("list"===e.type||e.type===t.type&&Ve(e,r)))return!1;if("list"===e.type&&e.type===t.type&&Boolean(e.ordered)===Boolean(t.ordered)&&!(e.ordered?r.options.bulletOrderedOther:r.options.bulletOther))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&Ue(t,r)))return;return n.spread?1:0}}],ut=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],ht=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ut},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ut},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:ut},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ut},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ut},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ut},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ut},{atBreak:!0,character:"~"}];var dt=n(2042),pt=n(5917),ft=n(736),mt=n(2312),gt=n(9836),yt=n(1969);function kt(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function wt(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function vt(e,t){if("definition"===e.type&&e.type===t.type)return 0}function bt(e,t){return(0,pt.p)(e,this,t)}function xt(e,t){return(0,ft.K)(e,this,t)}function Ct(e,t){return(0,gt.T)(this,e,t)}function St(e){Object.assign(this,{Compiler:t=>{const n=this.data("settings");return function(e,t={}){const n={enter:function(e){return n.stack.push(e),function(){n.stack.pop()}},indentLines:mt.Q,associationId:dt.L,containerPhrasing:bt,containerFlow:xt,createTracker:yt.j,safe:Ct,stack:[],unsafe:[],join:[],handlers:{},options:{},indexStack:[],handle:void 0};Le(n,{unsafe:ht,join:ct,handlers:at}),Le(n,t),n.options.tightDefinitions&&Le(n,{join:[vt]}),n.handle=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const i=r.handlers;if(t&&Pe.call(t,e)){const n=String(t[e]);o=Pe.call(i,n)?i[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:kt,unknown:wt,handlers:n.handlers});let r=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return r&&10!==r.charCodeAt(r.length-1)&&13!==r.charCodeAt(r.length-1)&&(r+="\n"),r}(t,Object.assign({},n,e,{extensions:this.data("toMarkdownExtensions")||[]}))}})}function Mt(e){if(e)throw e}var Nt=n(3335),Ot=n(9385);function Tt(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}class At extends Error{constructor(e,t,n){const r=[null,null];let o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof t&&(n=t,t=void 0),"string"==typeof n){const e=n.indexOf(":");-1===e?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}t&&("type"in t||"position"in t?t.position&&(o=t.position):"start"in t||"end"in t?o=t:("line"in t||"column"in t)&&(o.start=t)),this.name=Ne(t)||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}At.prototype.file="",At.prototype.name="",At.prototype.reason="",At.prototype.message="",At.prototype.stack="",At.prototype.fatal=null,At.prototype.column=null,At.prototype.line=null,At.prototype.source=null,At.prototype.ruleId=null,At.prototype.position=null;const Et=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');zt(e);let n,r=0,o=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else o<0&&(n=!0,o=i+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let s=-1,l=t.length-1;for(;i--;)if(47===e.charCodeAt(i)){if(n){r=i+1;break}}else s<0&&(n=!0,s=i+1),l>-1&&(e.charCodeAt(i)===t.charCodeAt(l--)?l<0&&(o=i):(l=-1,o=s));return r===o?o=s:o<0&&(o=e.length),e.slice(r,o)},Dt=function(e){if(zt(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.charCodeAt(0)?"/":".":1===n&&47===e.charCodeAt(0)?"//":e.slice(0,n)},It=function(e){zt(e);let t,n=e.length,r=-1,o=0,i=-1,s=0;for(;n--;){const l=e.charCodeAt(n);if(47!==l)r<0&&(t=!0,r=n+1),46===l?i<0?i=n:1!==s&&(s=1):i>-1&&(s=-1);else if(t){o=n+1;break}}return i<0||r<0||0===s||1===s&&i===r-1&&i===o+1?"":e.slice(i,r)},Ft=function(...e){let t,n=-1;for(;++n<e.length;)zt(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){zt(e);const t=47===e.charCodeAt(0);let n=function(e,t){let n,r,o="",i=0,s=-1,l=0,a=-1;for(;++a<=e.length;){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(s===a-1||1===l);else if(s!==a-1&&2===l){if(o.length<2||2!==i||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",i=0):(o=o.slice(0,r),i=o.length-1-o.lastIndexOf("/")),s=a,l=0;continue}}else if(o.length>0){o="",i=0,s=a,l=0;continue}t&&(o=o.length>0?o+"/..":"..",i=2)}else o.length>0?o+="/"+e.slice(s+1,a):o=e.slice(s+1,a),i=a-s-1;s=a,l=0}else 46===n&&l>-1?l++:l=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},Rt="/";function zt(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Bt=function(){return"/"};function Pt(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}const Lt=["history","path","basename","stem","extname","dirname"];class $t{constructor(e){let t;t=e?"string"==typeof e||function(e){return Nt(e)}(e)?{value:e}:Pt(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=Bt(),this.value,this.stored,this.result,this.map;let n,r=-1;for(;++r<Lt.length;){const e=Lt[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)Lt.includes(n)||(this[n]=t[n])}get path(){return this.history[this.history.length-1]}set path(e){Pt(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!Pt(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.charCodeAt(n)&&50===t.charCodeAt(n+1)){const e=t.charCodeAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),Ht(e,"path"),this.path!==e&&this.history.push(e)}get dirname(){return"string"==typeof this.path?Dt(this.path):void 0}set dirname(e){Vt(this.basename,"dirname"),this.path=Ft(e||"",this.basename)}get basename(){return"string"==typeof this.path?Et(this.path):void 0}set basename(e){Ht(e,"basename"),jt(e,"basename"),this.path=Ft(this.dirname||"",e)}get extname(){return"string"==typeof this.path?It(this.path):void 0}set extname(e){if(jt(e,"extname"),Vt(this.dirname,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ft(this.dirname,this.stem+(e||""))}get stem(){return"string"==typeof this.path?Et(this.path,this.extname):void 0}set stem(e){Ht(e,"stem"),jt(e,"stem"),this.path=Ft(this.dirname||"",e+(this.extname||""))}toString(e){return(this.value||"").toString(e||void 0)}message(e,t,n){const r=new At(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=null,r}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}}function jt(e,t){if(e&&e.includes(Rt))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rt+"`")}function Ht(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Vt(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const _t=function e(){const t=function(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function o(i,...s){const l=e[++n];let a=-1;if(i)r(i);else{for(;++a<t.length;)null!==s[a]&&void 0!==s[a]||(s[a]=t[a]);t=s,l?function(e,t){let n;return function(...t){const i=e.length>t.length;let s;i&&t.push(r);try{s=e.apply(this,t)}catch(e){if(i&&n)throw e;return r(e)}i||(s instanceof Promise?s.then(o,r):s instanceof Error?r(s):o(s))};function r(e,...r){n||(n=!0,t(e,...r))}function o(e){r(null,e)}}(l,o)(...s):r(null,...s)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}(),n=[];let r,o={},i=-1;return s.data=function(e,t){return"string"==typeof e?2===arguments.length?(Ut("data",r),o[e]=t,s):Wt.call(o,e)&&o[e]||null:e?(Ut("data",r),o=e,s):o},s.Parser=void 0,s.Compiler=void 0,s.freeze=function(){if(r)return s;for(;++i<n.length;){const[e,...r]=n[i];if(!1===r[0])continue;!0===r[0]&&(r[0]=void 0);const o=e.call(s,...r);"function"==typeof o&&t.use(o)}return r=!0,i=Number.POSITIVE_INFINITY,s},s.attachers=n,s.use=function(e,...t){let i;if(Ut("use",r),null==e);else if("function"==typeof e)u(e,...t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?c(e):a(e)}return i&&(o.settings=Object.assign(o.settings||{},i)),s;function l(e){if("function"==typeof e)u(e);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;u(t,...n)}else a(e)}}function a(e){c(e.plugins),e.settings&&(i=Object.assign(i||{},e.settings))}function c(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;)l(e[t])}}function u(e,t){let r,o=-1;for(;++o<n.length;)if(n[o][0]===e){r=n[o];break}r?(Tt(r[1])&&Tt(t)&&(t=Ot(!0,r[1],t)),r[1]=t):n.push([...arguments])}},s.parse=function(e){s.freeze();const t=Zt(e),n=s.Parser;return Kt("parse",n),qt(n,"parse")?new n(String(t),t).parse():n(String(t),t)},s.stringify=function(e,t){s.freeze();const n=Zt(t),r=s.Compiler;return Yt("stringify",r),Jt(e),qt(r,"compile")?new r(e,n).compile():r(e,n)},s.run=function(e,n,r){if(Jt(e),s.freeze(),r||"function"!=typeof n||(r=n,n=void 0),!r)return new Promise(o);function o(o,i){t.run(e,Zt(n),(function(t,n,s){n=n||e,t?i(t):o?o(n):r(null,n,s)}))}o(null,r)},s.runSync=function(e,t){let n,r;return s.run(e,t,(function(e,t){Mt(e),n=t,r=!0})),Gt("runSync","run",r),n},s.process=function(e,t){if(s.freeze(),Kt("process",s.Parser),Yt("process",s.Compiler),!t)return new Promise(n);function n(n,r){const o=Zt(e);function i(e,o){e||!o?r(e):n?n(o):t(null,o)}s.run(s.parse(o),o,((e,t,n)=>{if(!e&&t&&n){const o=s.stringify(t,n);null==o||("string"==typeof(r=o)||Nt(r)?n.value=o:n.result=o),i(e,n)}else i(e);var r}))}n(null,t)},s.processSync=function(e){let t;s.freeze(),Kt("processSync",s.Parser),Yt("processSync",s.Compiler);const n=Zt(e);return s.process(n,(function(e){t=!0,Mt(e)})),Gt("processSync","process",t),n},s;function s(){const t=e();let r=-1;for(;++r<n.length;)t.use(...n[r]);return t.data(Ot(!0,{},o)),t}}().freeze(),Wt={}.hasOwnProperty;function qt(e,t){return"function"==typeof e&&e.prototype&&(function(e){let t;for(t in e)if(Wt.call(e,t))return!0;return!1}(e.prototype)||t in e.prototype)}function Kt(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Parser`")}function Yt(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `Compiler`")}function Ut(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Jt(e){if(!Tt(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Gt(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Zt(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new $t(e)}var Xt,Qt,en,tn,nn,rn,on,sn=n(870),ln=Object.defineProperty,an=(e,t,n)=>(((e,t,n)=>{t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),cn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},un=(e,t,n)=>(cn(e,t,"read from private field"),n?n.call(e):t.get(e)),hn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},dn=(e,t,n,r)=>(cn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class pn{}class fn{constructor(){an(this,"elements",[]),an(this,"size",(()=>this.elements.length)),an(this,"top",(()=>this.elements.at(-1))),an(this,"push",(e=>{var t;null==(t=this.top())||t.push(e)})),an(this,"open",(e=>{this.elements.push(e)})),an(this,"close",(()=>{const e=this.elements.pop();if(!e)throw(0,sn.qw)();return e}))}}class mn extends pn{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new mn(e,t,n)}}const gn=class extends fn{constructor(e){super(),an(this,"schema"),hn(this,Xt,i.vc.none),hn(this,Qt,(e=>e.isText)),hn(this,en,((e,t)=>{if(un(this,Qt).call(this,e)&&un(this,Qt).call(this,t)&&i.vc.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)})),hn(this,tn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.parseMarkdown.match(e)));if(!t)throw(0,sn.y$)(e);return t})),hn(this,nn,(e=>{const t=un(this,tn).call(this,e);t.spec.parseMarkdown.runner(this,e,t)})),an(this,"injectRoot",((e,t,n)=>(this.openNode(t,n),this.next(e.children),this))),an(this,"openNode",((e,t)=>(this.open(mn.create(e,[],t)),this))),hn(this,rn,(()=>{dn(this,Xt,i.vc.none);const e=this.close();return un(this,on).call(this,e.type,e.attrs,e.content)})),an(this,"closeNode",(()=>(un(this,rn).call(this),this))),hn(this,on,((e,t,n)=>{const r=e.createAndFill(t,n,un(this,Xt));if(!r)throw(0,sn.Vh)(e,t,n);return this.push(r),r})),an(this,"addNode",((e,t,n)=>(un(this,on).call(this,e,t,n),this))),an(this,"openMark",((e,t)=>{const n=e.create(t);return dn(this,Xt,n.addToSet(un(this,Xt))),this})),an(this,"closeMark",(e=>(dn(this,Xt,e.removeFromSet(un(this,Xt))),this))),an(this,"addText",(e=>{const t=this.top();if(!t)throw(0,sn.qw)();const n=t.pop(),r=this.schema.text(e,un(this,Xt));if(!n)return t.push(r),this;const o=un(this,en).call(this,n,r);return o?(t.push(o),this):(t.push(n,r),this)})),an(this,"build",(()=>{let e;do{e=un(this,rn).call(this)}while(this.size());return e})),an(this,"next",((e=[])=>([e].flat().forEach((e=>un(this,nn).call(this,e))),this))),an(this,"toDoc",(()=>this.build())),an(this,"run",((e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this})),this.schema=e}};let yn=gn;Xt=new WeakMap,Qt=new WeakMap,en=new WeakMap,tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,an(yn,"create",((e,t)=>{const n=new gn(e);return e=>(n.run(t,e),n.toDoc())}));const kn=class extends pn{constructor(e,t,n,r={}){super(),an(this,"push",((e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)})),an(this,"pop",(()=>{var e;return null==(e=this.children)?void 0:e.pop()})),this.type=e,this.children=t,this.value=n,this.props=r}};let wn=kn;var vn,bn,xn,Cn,Sn,Mn,Nn,On,Tn,An,En,Dn;an(wn,"create",((e,t,n,r={})=>new kn(e,t,n,r)));const In=class extends fn{constructor(e){super(),hn(this,vn,i.vc.none),an(this,"schema"),hn(this,bn,(e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find((t=>t.spec.toMarkdown.match(e)));if(!t)throw(0,sn.OO)(e.type);return t})),hn(this,xn,(e=>un(this,bn).call(this,e).spec.toMarkdown.runner(this,e))),hn(this,Cn,((e,t)=>un(this,bn).call(this,e).spec.toMarkdown.runner(this,e,t))),hn(this,Sn,(e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort(((e,t)=>n(e)-n(t))).every((t=>!un(this,Cn).call(this,t,e)))&&un(this,xn).call(this,e),t.forEach((e=>un(this,Dn).call(this,e)))})),hn(this,Mn,((e,t)=>{var n;if(e.type===t||1!==(null==(n=e.children)?void 0:n.length))return e;const r=e=>{var n;if(e.type===t)return e;if(1!==(null==(n=e.children)?void 0:n.length))return null;const[o]=e.children;return o?r(o):null},o=r(e);if(!o)return e;const i=o.children?[...o.children]:void 0,s={...e,children:i};return s.children=i,o.children=[s],o})),hn(this,Nn,(e=>{const{children:t}=e;return t&&(e.children=t.reduce(((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){t=un(this,Mn).call(this,t,r.type);const{children:n,...o}=t,{children:i,...s}=r;if(t.type===r.type&&n&&i&&JSON.stringify(o)===JSON.stringify(s)){const t={...s,children:[...i,...n]};return e.slice(0,-1).concat(un(this,Nn).call(this,t))}}return e.concat(t)}),[])),e})),hn(this,On,(e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t})),an(this,"openNode",((e,t,n)=>(this.open(wn.create(e,void 0,t,n)),this))),hn(this,Tn,(()=>{const e=this.close();return un(this,An).call(this,e.type,e.children,e.value,e.props)})),an(this,"closeNode",(()=>(un(this,Tn).call(this),this))),hn(this,An,((e,t,n,r)=>{const o=wn.create(e,t,n,r),i=un(this,Nn).call(this,un(this,On).call(this,o));return this.push(i),i})),an(this,"addNode",((e,t,n,r)=>(un(this,An).call(this,e,t,n,r),this))),hn(this,En,((e,t,n,r)=>e.isInSet(un(this,vn))?this:(dn(this,vn,e.addToSet(un(this,vn))),this.openNode(t,n,{...r,isMark:!0})))),hn(this,Dn,(e=>{!e.isInSet(un(this,vn))||(dn(this,vn,e.type.removeFromSet(un(this,vn))),un(this,Tn).call(this))})),an(this,"withMark",((e,t,n,r)=>(un(this,En).call(this,e,t,n,r),this))),an(this,"closeMark",(e=>(un(this,Dn).call(this,e),this))),an(this,"build",(()=>{let e=null;do{e=un(this,Tn).call(this)}while(this.size());return e})),an(this,"next",(e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach((e=>{un(this,Sn).call(this,e)})),this):(un(this,Sn).call(this,e),this);var t})),an(this,"toString",(e=>e.stringify(this.build()))),an(this,"run",(e=>(this.next(e),this))),this.schema=e}};let Fn=In;vn=new WeakMap,bn=new WeakMap,xn=new WeakMap,Cn=new WeakMap,Sn=new WeakMap,Mn=new WeakMap,Nn=new WeakMap,On=new WeakMap,Tn=new WeakMap,An=new WeakMap,En=new WeakMap,Dn=new WeakMap,an(Fn,"create",((e,t)=>{const n=new In(e);return e=>(n.run(e),n.toString(t))}));var Rn=n(7191),zn=n(2780),Bn=n(4285),Pn=n(737),Ln=n(840),$n=Object.defineProperty,jn=(e,t,n)=>(((e,t,n)=>{t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Hn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Vn=(e,t,n)=>(Hn(e,t,"read from private field"),n?n.call(e):t.get(e)),_n=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Wn=(e,t,n,r)=>(Hn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const qn=(e,t)=>(e.meta={package:"@milkdown/core",group:"System",...t},e),Kn=(0,o.eF)("ConfigReady"),Yn=(0,o.eF)("InitReady"),Un=(0,o.oM)([],"initTimer"),Jn=(0,o.oM)({},"editor"),Gn=(0,o.oM)([],"inputRules"),Zn=(0,o.oM)([],"prosePlugins"),Xn=(0,o.oM)([],"remarkPlugins"),Qn=(0,o.oM)([],"nodeView"),er=(0,o.oM)([],"markView"),tr=(0,o.oM)(_t().use(Be).use(St),"remark"),nr=(0,o.oM)({},"remarkStringifyOptions"),rr=e=>{const t=t=>(t.inject(Jn,e).inject(Zn).inject(Xn).inject(Gn).inject(Qn).inject(er).inject(nr).inject(tr,_t().use(Be).use(St)).inject(Un,[Kn]).record(Yn),async()=>{await t.waitTimers(Un);const e=t.get(nr);return t.set(tr,_t().use(Be).use(St,e)),t.done(Yn),()=>{t.remove(Jn).remove(Zn).remove(Xn).remove(Gn).remove(Qn).remove(er).remove(nr).remove(tr).remove(Un).clearTimer(Yn)}});return qn(t,{displayName:"Init"}),t},or=(0,o.eF)("SchemaReady"),ir=(0,o.oM)([],"schemaTimer"),sr=(0,o.oM)({},"schema"),lr=(0,o.oM)([],"nodes"),ar=(0,o.oM)([],"marks"),cr=e=>{var t;return{...e,parseDOM:null==(t=e.parseDOM)?void 0:t.map((t=>({priority:e.priority,...t})))}},ur=e=>(e.inject(sr).inject(lr).inject(ar).inject(ir,[Yn]).record(or),async()=>{await e.waitTimers(ir);const t=e.get(tr),n=e.get(Xn).reduce(((e,t)=>e.use(t)),t);e.set(tr,n);const r=Object.fromEntries(e.get(lr).map((([e,t])=>[e,cr(t)]))),o=Object.fromEntries(e.get(ar).map((([e,t])=>[e,cr(t)])));return e.set(sr,new i.V_({nodes:r,marks:o})),e.done(or),()=>{e.remove(sr).remove(lr).remove(ar).remove(ir).clearTimer(or)}});qn(ur,{displayName:"Schema"});const hr=(0,o.eF)("ParserReady"),dr=(0,o.oM)((()=>{throw(0,sn.S1)()}),"parser"),pr=(0,o.oM)([],"parserTimer"),fr=e=>(e.inject(dr).inject(pr,[or]).record(hr),async()=>{await e.waitTimers(pr);const t=e.get(tr),n=e.get(sr);return e.set(dr,yn.create(n,t)),e.done(hr),()=>{e.remove(dr).remove(pr).clearTimer(hr)}});qn(fr,{displayName:"Parser"});const mr=(0,o.eF)("SerializerReady"),gr=(0,o.oM)([],"serializerTimer"),yr=(0,o.oM)((()=>""),"serializer"),kr=e=>(e.inject(yr).inject(gr,[or]).record(mr),async()=>{await e.waitTimers(gr);const t=e.get(tr),n=e.get(sr);return e.set(yr,Fn.create(n,t)),e.done(mr),()=>{e.remove(yr).remove(gr).clearTimer(mr)}});qn(kr,{displayName:"Serializer"});const wr=(0,o.oM)("","defaultValue"),vr=(0,o.oM)({},"editorState"),br=(0,o.oM)((e=>e),"stateOptions"),xr=(0,o.oM)([],"editorStateTimer"),Cr=(0,o.eF)("EditorStateReady"),Sr=new Rn.H$("MILKDOWN_STATE_TRACKER"),Mr=e=>(e.inject(wr).inject(vr).inject(br).inject(xr,[hr,mr,jr]).record(Cr),async()=>{await e.waitTimers(xr);const t=e.get(sr),n=e.get(dr),r=e.get(Gn),o=e.get(br),s=e.get(Zn),l=((e,t,n)=>{if("string"==typeof e)return t(e);if("html"===e.type)return i.aw.fromSchema(n).parse(e.dom);if("json"===e.type)return i.NB.fromJSON(n,e.value);throw(0,sn.rf)(e)})(e.get(wr),n,t),a=[...s,new Rn.Sy({key:Sr,state:{init:()=>{},apply:(t,n,r,o)=>{e.set(vr,o)}}}),(0,Bn.NJ)({rules:r}),(0,Ln.h)(Pn.YR)];e.set(Zn,a);const c=o({schema:t,doc:l,plugins:a}),u=Rn.yy.create(c);return e.set(vr,u),e.done(Cr),()=>{e.remove(wr).remove(vr).remove(br).remove(xr).clearTimer(Cr)}});qn(Mr,{displayName:"EditorState"});const Nr=(0,o.eF)("EditorViewReady"),Or=(0,o.oM)({},"editorView"),Tr=(0,o.oM)([],"editorViewTimer"),Ar=(0,o.oM)({},"editorViewOptions"),Er=(0,o.oM)(null,"root"),Dr=(0,o.oM)(null,"rootDOM"),Ir=(0,o.oM)({},"rootAttrs"),Fr=new Rn.H$("MILKDOWN_VIEW_CLEAR"),Rr=e=>(e.inject(Er,document.body).inject(Or).inject(Ar).inject(Dr).inject(Ir).inject(Tr,[Cr]).record(Nr),async()=>{await e.wait(Yn);const t=e.get(Er)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(Zn,(t=>[new Rn.Sy({key:Fr,view:t=>{const r=n?((e,t)=>{const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(Dr,n);const r=t.get(Ir);return Object.entries(r).forEach((([e,t])=>n.setAttribute(e,t))),n})(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{null!=r&&r.parentNode&&(null==r||r.parentNode.replaceChild(t.dom,r)),null==r||r.remove()}}}}),...t])),await e.waitTimers(Tr);const r=e.get(vr),o=e.get(Ar),i=Object.fromEntries(e.get(Qn)),s=Object.fromEntries(e.get(er)),l=new zn.tk(n,{state:r,nodeViews:i,markViews:s,...o});return(e=>{e.classList.add("editor"),e.setAttribute("role","textbox")})(l.dom),e.set(Or,l),e.done(Nr),()=>{null==l||l.destroy(),e.remove(Er).remove(Or).remove(Ar).remove(Dr).remove(Ir).remove(Tr).clearTimer(Nr)}});var zr,Br;qn(Rr,{displayName:"EditorView"}),zr=new WeakMap,Br=new WeakMap;const Pr=(e="cmdKey")=>(0,o.oM)((()=>()=>!1),e),Lr=(0,o.oM)(new class{constructor(){_n(this,zr,new o.W2),_n(this,Br,null),jn(this,"setCtx",(e=>{Wn(this,Br,e)}))}create(e,t){const n=e.create(Vn(this,zr).sliceMap);return n.set(t),n}get(e){return Vn(this,zr).get(e).get()}remove(e){return Vn(this,zr).remove(e)}call(e,t){if(null==Vn(this,Br))throw(0,sn.gq)();const n=this.get(e)(t),r=Vn(this,Br).get(Or);return n(r.state,r.dispatch,r)}},"commands"),$r=(0,o.oM)([or],"commandsTimer"),jr=(0,o.eF)("CommandsReady"),Hr=e=>(e.inject(Lr).inject($r).record(jr),e.get(Lr).setCtx(e),async()=>(await e.waitTimers($r),e.done(jr),()=>{e.remove(Lr).remove($r).clearTimer(jr)}));var Vr,_r,Wr,qr,Kr,Yr,Ur,Jr,Gr,Zr,Xr,Qr,eo,to,no;qn(Hr,{displayName:"Commands"});const ro=class{constructor(){_n(this,Vr,!1),_n(this,_r,"Idle"),_n(this,Wr,[]),_n(this,qr,(()=>{})),_n(this,Kr,new o.W2),_n(this,Yr,new o.SU),_n(this,Ur,new Map),_n(this,Jr,new Map),_n(this,Gr,new o.A7(Vn(this,Kr),Vn(this,Yr))),_n(this,Zr,(()=>{const e=(e=>{const t=t=>(t.record(Kn),async()=>(await e(t),t.done(Kn),()=>{t.clearTimer(Kn)}));return qn(t,{displayName:"Config"}),t})((async e=>{await Promise.all(Vn(this,Wr).map((t=>t(e))))})),t=[ur,fr,kr,Hr,Mr,Rr,rr(this),e];Vn(this,Xr).call(this,t,Vn(this,Jr))})),_n(this,Xr,((e,t)=>{e.forEach((e=>{const n=Vn(this,Gr).produce(Vn(this,Vr)?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})}))})),_n(this,Qr,((e,t=!1)=>Promise.all([e].flat().map((e=>{const n=Vn(this,Ur).get(e),r=null==n?void 0:n.cleanup;return t?Vn(this,Ur).delete(e):Vn(this,Ur).set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r?r():r}))))),_n(this,eo,(async()=>{await Promise.all([...Vn(this,Jr).entries()].map((([e,{cleanup:t}])=>"function"==typeof t?t():t))),Vn(this,Jr).clear()})),_n(this,to,(e=>{Wn(this,_r,e),Vn(this,qr).call(this,e)})),_n(this,no,(e=>[...e.entries()].map((async([t,n])=>{const{ctx:r,handler:o}=n;if(!o)return;const i=await o();e.set(t,{ctx:r,handler:o,cleanup:i})})))),jn(this,"enableInspector",((e=!0)=>(Wn(this,Vr,e),this))),jn(this,"onStatusChange",(e=>(Wn(this,qr,e),this))),jn(this,"config",(e=>(Vn(this,Wr).push(e),this))),jn(this,"removeConfig",(e=>(Wn(this,Wr,Vn(this,Wr).filter((t=>t!==e))),this))),jn(this,"use",(e=>{const t=[e].flat();return t.flat().forEach((e=>{Vn(this,Ur).set(e,{ctx:void 0,handler:void 0,cleanup:void 0})})),"Created"===Vn(this,_r)&&Vn(this,Xr).call(this,t,Vn(this,Ur)),this})),jn(this,"remove",(async e=>"OnCreate"===Vn(this,_r)?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise((t=>{setTimeout((()=>{t(this.remove(e))}),50)}))):(await Vn(this,Qr).call(this,[e].flat(),!0),this))),jn(this,"create",(async()=>("OnCreate"===Vn(this,_r)||("Created"===Vn(this,_r)&&await this.destroy(),Vn(this,to).call(this,"OnCreate"),Vn(this,Zr).call(this),Vn(this,Xr).call(this,[...Vn(this,Ur).keys()],Vn(this,Ur)),await Promise.all([Vn(this,no).call(this,Vn(this,Jr)),Vn(this,no).call(this,Vn(this,Ur))].flat()),Vn(this,to).call(this,"Created")),this))),jn(this,"destroy",(async(e=!1)=>"Destroyed"===Vn(this,_r)||"OnDestroy"===Vn(this,_r)?this:"OnCreate"===Vn(this,_r)?new Promise((t=>{setTimeout((()=>{t(this.destroy(e))}),50)})):(e&&Wn(this,Wr,[]),Vn(this,to).call(this,"OnDestroy"),await Vn(this,Qr).call(this,[...Vn(this,Ur).keys()],e),await Vn(this,eo).call(this),Vn(this,to).call(this,"Destroyed"),this))),jn(this,"action",(e=>e(Vn(this,Gr)))),jn(this,"inspect",(()=>Vn(this,Vr)?[...Vn(this,Jr).values(),...Vn(this,Ur).values()].map((({ctx:e})=>{var t;return null==(t=null==e?void 0:e.inspector)?void 0:t.read()})).filter((e=>Boolean(e))):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])))}static make(){return new ro}get ctx(){return Vn(this,Gr)}get status(){return Vn(this,_r)}};let oo=ro;Vr=new WeakMap,_r=new WeakMap,Wr=new WeakMap,qr=new WeakMap,Kr=new WeakMap,Yr=new WeakMap,Ur=new WeakMap,Jr=new WeakMap,Gr=new WeakMap,Zr=new WeakMap,Xr=new WeakMap,Qr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap},11:(e,t,n)=>{"use strict";n.d(t,{A7:()=>I,SU:()=>F,W2:()=>p,eF:()=>V,oM:()=>g});var r,o,i,s=n(870),l=Object.defineProperty,a=(e,t,n)=>(((e,t,n)=>{t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),c=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},u=(e,t,n)=>(c(e,t,"read from private field"),n?n.call(e):t.get(e)),h=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},d=(e,t,n,r)=>(c(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class p{constructor(){a(this,"sliceMap",new Map),a(this,"get",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);if(!t){const t="string"==typeof e?e:e.name;throw(0,s.KE)(t)}return t})),a(this,"remove",(e=>{const t="string"==typeof e?[...this.sliceMap.values()].find((t=>t.type.name===e)):this.sliceMap.get(e.id);!t||this.sliceMap.delete(t.type.id)})),a(this,"has",(e=>"string"==typeof e?[...this.sliceMap.values()].some((t=>t.type.name===e)):this.sliceMap.has(e.id)))}}class f{constructor(e,t,n){a(this,"type"),h(this,r,[]),h(this,o,void 0),h(this,i,(()=>{u(this,r).forEach((e=>e(u(this,o))))})),a(this,"set",(e=>{d(this,o,e),u(this,i).call(this)})),a(this,"get",(()=>u(this,o))),a(this,"update",(e=>{d(this,o,e(u(this,o))),u(this,i).call(this)})),this.type=n,d(this,o,t),e.set(n.id,this)}on(e){return u(this,r).push(e),()=>{d(this,r,u(this,r).filter((t=>t!==e)))}}once(e){const t=this.on((n=>{e(n),t()}));return t}off(e){d(this,r,u(this,r).filter((t=>t!==e)))}offAll(){d(this,r,[])}}r=new WeakMap,o=new WeakMap,i=new WeakMap;class m{constructor(e,t){a(this,"id"),a(this,"name"),a(this,"_typeInfo"),a(this,"_defaultValue"),this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw(0,s.S1)()}}create(e,t=this._defaultValue){return new f(e,t,this)}}const g=(e,t)=>new m(e,t);var y,k,w,v,b,x,C,S,M,N,O,T,A;class E{constructor(e,t,n){h(this,y,void 0),h(this,k,void 0),h(this,w,void 0),h(this,v,new Set),h(this,b,new Set),h(this,x,new Map),h(this,C,new Map),a(this,"read",(()=>({metadata:u(this,y),injectedSlices:[...u(this,v)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),consumedSlices:[...u(this,b)].map((e=>({name:"string"==typeof e?e:e.name,value:u(this,S).call(this,e)}))),recordedTimers:[...u(this,x)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)}))),waitTimers:[...u(this,C)].map((([e,{duration:t}])=>({name:e.name,duration:t,status:u(this,M).call(this,e)})))}))),a(this,"onRecord",(e=>{u(this,x).set(e,{start:Date.now(),duration:0})})),a(this,"onClear",(e=>{u(this,x).delete(e)})),a(this,"onDone",(e=>{const t=u(this,x).get(e);!t||(t.duration=Date.now()-t.start)})),a(this,"onWait",((e,t)=>{const n=Date.now();t.finally((()=>{u(this,C).set(e,{duration:Date.now()-n})}))})),a(this,"onInject",(e=>{u(this,v).add(e)})),a(this,"onRemove",(e=>{u(this,v).delete(e)})),a(this,"onUse",(e=>{u(this,b).add(e)})),h(this,S,(e=>u(this,k).get(e).get())),h(this,M,(e=>u(this,w).get(e).status)),d(this,k,e),d(this,w,t),d(this,y,n)}}y=new WeakMap,k=new WeakMap,w=new WeakMap,v=new WeakMap,b=new WeakMap,x=new WeakMap,C=new WeakMap,S=new WeakMap,M=new WeakMap;const D=class{constructor(e,t,n){h(this,N,void 0),h(this,O,void 0),h(this,T,void 0),h(this,A,void 0),a(this,"produce",(e=>e&&Object.keys(e).length?new D(u(this,N),u(this,O),{...e}):this)),a(this,"inject",((e,t)=>{var n;const r=e.create(u(this,N).sliceMap);return null!=t&&r.set(t),null==(n=u(this,A))||n.onInject(e),this})),a(this,"remove",(e=>{var t;return u(this,N).remove(e),null==(t=u(this,A))||t.onRemove(e),this})),a(this,"record",(e=>{var t;return e.create(u(this,O).store),null==(t=u(this,A))||t.onRecord(e),this})),a(this,"clearTimer",(e=>{var t;return u(this,O).remove(e),null==(t=u(this,A))||t.onClear(e),this})),a(this,"isInjected",(e=>u(this,N).has(e))),a(this,"isRecorded",(e=>u(this,O).has(e))),a(this,"use",(e=>{var t;return null==(t=u(this,A))||t.onUse(e),u(this,N).get(e)})),a(this,"get",(e=>this.use(e).get())),a(this,"set",((e,t)=>this.use(e).set(t))),a(this,"update",((e,t)=>this.use(e).update(t))),a(this,"timer",(e=>u(this,O).get(e))),a(this,"done",(e=>{var t;this.timer(e).done(),null==(t=u(this,A))||t.onDone(e)})),a(this,"wait",(e=>{var t;const n=this.timer(e).start();return null==(t=u(this,A))||t.onWait(e,n),n})),a(this,"waitTimers",(async e=>{await Promise.all(this.get(e).map((e=>this.wait(e))))})),d(this,N,e),d(this,O,t),d(this,T,n),n&&d(this,A,new E(e,t,n))}get meta(){return u(this,T)}get inspector(){return u(this,A)}};let I=D;N=new WeakMap,O=new WeakMap,T=new WeakMap,A=new WeakMap;class F{constructor(){a(this,"store",new Map),a(this,"get",(e=>{const t=this.store.get(e.id);if(!t)throw(0,s._O)(e.name);return t})),a(this,"remove",(e=>{this.store.delete(e.id)})),a(this,"has",(e=>this.store.has(e.id)))}}var R,z,B,P,L,$;class j{constructor(e,t){a(this,"type"),h(this,R,null),h(this,z,null),h(this,B,void 0),h(this,P,"pending"),a(this,"start",(()=>(u(this,R)??d(this,R,new Promise(((e,t)=>{d(this,z,(t=>{t instanceof CustomEvent&&t.detail.id===u(this,B)&&(d(this,P,"resolved"),u(this,L).call(this),t.stopImmediatePropagation(),e())})),u(this,$).call(this,(()=>{"pending"===u(this,P)&&d(this,P,"rejected"),u(this,L).call(this),t(new Error(`Timing ${this.type.name} timeout.`))})),d(this,P,"pending"),addEventListener(this.type.name,u(this,z))}))),u(this,R)))),a(this,"done",(()=>{const e=new CustomEvent(this.type.name,{detail:{id:u(this,B)}});dispatchEvent(e)})),h(this,L,(()=>{u(this,z)&&removeEventListener(this.type.name,u(this,z))})),h(this,$,(e=>{setTimeout((()=>{e()}),this.type.timeout)})),d(this,B,Symbol(t.name)),this.type=t,e.set(t.id,this)}get status(){return u(this,P)}}R=new WeakMap,z=new WeakMap,B=new WeakMap,P=new WeakMap,L=new WeakMap,$=new WeakMap;class H{constructor(e,t=3e3){a(this,"id"),a(this,"name"),a(this,"timeout"),a(this,"create",(e=>new j(e,this))),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const V=(e,t=3e3)=>new H(e,t)},870:(e,t,n)=>{"use strict";n.d(t,{GZ:()=>g,KE:()=>c,OO:()=>m,S1:()=>h,Vh:()=>d,YN:()=>k,_O:()=>u,d2:()=>w,gq:()=>y,qw:()=>p,rf:()=>a,y$:()=>f});var r=Object.defineProperty,o=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(o||{});class i extends Error{constructor(e,t){super(t),((e,t,n)=>{((e,t,n)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"code"),this.name="MilkdownError",this.code=e}}const s=(e,t)=>"function"==typeof t?"[Function]":t,l=e=>JSON.stringify(e,s),a=e=>new i(o.docTypeError,`Doc type error, unsupported type: ${l(e)}`),c=e=>new i(o.contextNotFound,`Context "${e}" not found, do you forget to inject it?`),u=e=>new i(o.timerNotFound,`Timer "${e}" not found, do you forget to record it?`),h=()=>new i(o.ctxCallOutOfScope,"Should not call a context out of the plugin."),d=(...e)=>{const t=e.reduce(((e,t)=>{if(!t)return e;const n=e=>Array.isArray(e)?e.map((e=>n(e))).join(", "):e.toJSON?l(e.toJSON()):e.spec?l(e.spec):e.toString();return`${e}, ${n(t)}`}),"Create prosemirror node from remark failed in parser");return new i(o.createNodeInParserFail,t)},p=()=>new i(o.stackOverFlow,"Stack over flow, cannot pop on an empty stack."),f=e=>new i(o.parserMatchError,`Cannot match target parser for node: ${l(e)}.`),m=e=>new i(o.serializerMatchError,`Cannot match target serializer for node: ${l(e)}.`),g=e=>new i(o.expectDomTypeError,`Expect to be a dom, but get: ${l(e)}.`),y=()=>new i(o.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized"),k=e=>new i(o.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`),w=e=>new i(o.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)},790:(e,t,n)=>{"use strict";n.d(t,{m8:()=>I,Ow:()=>T,N7:()=>O});var r=n(8858),o=200,i=function(){};i.prototype.append=function(e){return e.length?(e=i.from(e),!this.length&&e||e.length<o&&this.leafAppend(e)||this.length<o&&e.leafPrepend(this)||this.appendInner(e)):this},i.prototype.prepend=function(e){return e.length?i.from(e).append(this):this},i.prototype.appendInner=function(e){return new l(this,e)},i.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?i.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},i.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},i.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},i.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},i.from=function(e){return e instanceof i?e:e&&e.length?new s(e):i.empty};var s=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=o)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=o)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(i);i.empty=new s([]);var l=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(i);const a=i;var c=n(6151),u=n(7191);class h{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,l=e.tr,a=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new d(e.map));let t,o=e.step.map(n.slice(r));o&&l.maybeStep(o).doc&&(t=l.mapping.maps[l.mapping.maps.length-1],a.push(new d(t,void 0,void 0,a.length+c.length))),r--,t&&n.appendMap(t,r)}else l.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new h(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(e,t,n,r){let o=[],i=this.eventCount,s=this.items,l=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let a,c=e.steps[n].invert(e.docs[n]),u=new d(e.mapping.maps[n],c,t);(a=l&&l.merge(u))&&(u=a,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(l=u)}let a=i-n.depth;return a>f&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,a),i-=a),new h(s.append(o),i)}remapping(e,t){let n=new c.vs;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new h(this.items.append(e.map((e=>new d(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let l=t;this.items.forEach((t=>{let r=o.getMirror(--l);if(null==r)return;i=Math.min(i,r);let a=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(l+1,r));c&&s++,n.push(new d(a,i,c))}else n.push(new d(a))}),r);let a=[];for(let e=t;e<i;e++)a.push(new d(o.maps[e]));let c=this.items.slice(0,r).append(a).append(n),u=new h(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=i.selection&&i.selection.map(t.slice(n));l&&o++;let a,c=new d(s.invert(),e,l),u=r.length-1;(a=r.length&&r[u].merge(c))?r[u]=a:r.push(c)}}else i.map&&n--}),this.items.length,0),new h(a.from(r.reverse()),o)}}h.empty=new h(a.empty,0);class d{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new d(t.getMap().invert(),t,this.selection)}}}class p{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const f=20;function m(e){let t=[];return e.forEach(((e,n,r,o)=>t.push(r,o))),t}function g(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function y(e,t,n,r){let o=v(t),i=b.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,o);if(!s)return;let l=s.selection.resolve(s.transform.doc),a=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),c=new p(r?a:s.remaining,r?s.remaining:a,null,0,-1);n(s.transform.setSelection(l).setMeta(b,{redo:r,historyState:c}).scrollIntoView())}let k=!1,w=null;function v(e){let t=e.plugins;if(w!=t){k=!1,w=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){k=!0;break}}return k}const b=new u.H$("history"),x=new u.H$("closeHistory");const C=(e,t)=>{let n=b.getState(e);return!(!n||0==n.done.eventCount||(t&&y(n,e,t,!1),0))},S=(e,t)=>{let n=b.getState(e);return!(!n||0==n.undone.eventCount||(t&&y(n,e,t,!0),0))};var M=n(948);const N=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e),O=(0,M.r1)("Undo",(()=>()=>C));N(O,{displayName:"Command<undo>"});const T=(0,M.r1)("Undo",(()=>()=>S));N(O,{displayName:"Command<redo>"});const A=(0,M.Tu)({},"historyProviderConfig");N(A,{displayName:"Ctx<historyProviderConfig>"});const E=(0,M.x6)((e=>function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new u.Sy({key:b,state:{init:()=>new p(h.empty,h.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(x)&&(e=new p(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(b))return s.getMeta(b).redo?new p(e.done.addTransform(n,void 0,r,v(t)),e.undone,m(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new p(e.done,e.undone.addTransform(n,void 0,r,v(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new p(e.done.rebased(n,o),e.undone.rebased(n,o),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new p(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),g(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),l=s?g(e.prevRanges,n.mapping):m(n.mapping.maps[n.steps.length-1]);return new p(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,v(t)),h.empty,l,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?C:"historyRedo"==n?S:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(e.get(A.key))));N(E,{displayName:"Ctx<historyProviderPlugin>"});const D=(0,M.Gv)("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(r.Xo);return()=>t.call(O.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(r.Xo);return()=>t.call(T.key)}}});N(D.ctx,{displayName:"KeymapCtx<history>"}),N(D.shortcuts,{displayName:"Keymap<history>"});const I=[A,E,D,O,T].flat()},3011:(e,t,n)=>{"use strict";n.d(t,{WY:()=>l});var r=n(7191),o=n(948);const i=(0,o.Tu)({type:"space",size:2},"indentConfig");i.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const s=(0,o.xM)((e=>({Tab:(t,n)=>{const o=e.get(i.key),{tr:s}=t,l=((e,t)=>{const{doc:n,selection:o}=e;if(!n||!o||!(o instanceof r.Bs||o instanceof r.C1))return e;const{to:i}=o,s="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(s,i)})(s,o);return!!l.docChanged&&(null==n||n(l),!0)}})));s.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const l=[i,s]},4547:(e,t,n)=>{"use strict";n.d(t,{QC:()=>u,X3:()=>d});var r=n(11),o=n(8858),i=n(7191),s=n(594),l=Object.defineProperty,a=(e,t,n)=>(((e,t,n)=>{t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);class c{constructor(){a(this,"beforeMountedListeners",[]),a(this,"mountedListeners",[]),a(this,"updatedListeners",[]),a(this,"markdownUpdatedListeners",[]),a(this,"blurListeners",[]),a(this,"focusListeners",[]),a(this,"destroyListeners",[]),a(this,"beforeMount",(e=>(this.beforeMountedListeners.push(e),this))),a(this,"mounted",(e=>(this.mountedListeners.push(e),this))),a(this,"updated",(e=>(this.updatedListeners.push(e),this)))}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}}const u=(0,r.oM)(new c,"listener"),h=new i.H$("MILKDOWN_LISTENER"),d=e=>(e.inject(u,new c),async()=>{await e.wait(o.Iq);const t=e.get(u),{listeners:n}=t;n.beforeMount.forEach((t=>t(e))),await e.wait(o.vc);const r=e.get(o.Ck);let l=null,a=null;const c=new i.Sy({key:h,view:()=>({destroy:()=>{n.destroy.forEach((t=>t(e)))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach((t=>t(e))),!1),blur:()=>(n.blur.forEach((t=>t(e))),!1)}},state:{init:()=>{},apply:t=>t.docChanged&&!1!==t.getMeta("addToHistory")?s((()=>{const{doc:o}=t;if(n.updated.length>0&&(null==l||!l.eq(o))&&n.updated.forEach((t=>{t(e,o,l)})),n.markdownUpdated.length>0&&(null==l||!l.eq(o))){const t=r(o);n.markdownUpdated.forEach((n=>{n(e,t,a)})),a=t}l=o}),200)():void 0}});e.update(o.ZV,(e=>e.concat(c))),await e.wait(o.$B),n.mounted.forEach((t=>t(e)))});d.meta={package:"@milkdown/plugin-listener",displayName:"Listener"}},4426:(e,t,n)=>{"use strict";n.d(t,{mS:()=>a,ws:()=>u});var r=n(8858),o=n(7191),i=n(2780),s=n(948),l=n(870);const a=(0,s.Tu)({uploader:async(e,t)=>{const n=[];for(let t=0;t<e.length;t++){const r=e.item(t);!r||!r.type.includes("image")||n.push(r)}const{image:r}=t.nodes;if(!r)throw(0,l.YN)("image");return(await Promise.all(n.map((e=>(e=>new Promise((t=>{const n=new FileReader;n.addEventListener("load",(()=>{t({alt:e.name,src:n.result})}),!1),n.readAsDataURL(e)})))(e))))).map((({alt:e,src:t})=>r.createAndFill({src:t,alt:e})))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",i.p.widget(e,n,t)}},"uploadConfig");a.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};const c=(0,s.x6)((e=>{const t=new o.H$("MILKDOWN_UPLOAD"),n=(n,o,i)=>{var s;if(!i||i.length<=0)return!1;const l=Symbol("upload symbol"),c=e.get(r.le),{tr:u}=n.state,h=o instanceof DragEvent?(null==(s=n.posAtCoords({left:o.clientX,top:o.clientY}))?void 0:s.pos)??u.selection.from:u.selection.from;n.dispatch(u.setMeta(t,{add:{id:l,pos:h}}));const{uploader:d}=e.get(a.key);return d(i,c).then((e=>{const r=((e,n)=>{var r;const o=t.getState(e);if(!o)return-1;const i=o.find(void 0,void 0,(e=>e.id===n));return i.length?(null==(r=i[0])?void 0:r.from)??-1:-1})(n.state,l);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:l}}))})).catch((e=>{console.error(e)})),!0};return new o.Sy({key:t,state:{init:()=>i.EH.empty,apply(t,n){const r=n.map(t.mapping,t.doc),o=t.getMeta(this);if(!o)return r;if(o.add){const{uploadWidgetFactory:n}=e.get(a.key),i=n(o.add.pos,{id:o.add.id});return r.add(t.doc,[i])}if(o.remove){const e=r.find(void 0,void 0,(e=>e.id===o.remove.id));return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{var o,i;const{enableHtmlFileUploader:s}=e.get(a.key);return!(!(r instanceof ClipboardEvent)||!s&&(null==(o=r.clipboardData)?void 0:o.getData("text/html")))&&n(t,r,null==(i=r.clipboardData)?void 0:i.files)},handleDrop:(e,t)=>{var r;return t instanceof DragEvent&&n(e,t,null==(r=t.dataTransfer)?void 0:r.files)}}})}));c.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};const u=[a,c]},3991:(e,t,n)=>{"use strict";n.d(t,{iO:()=>at,Yp:()=>Ie,F3:()=>V,QF:()=>N,gG:()=>E,vs:()=>ne,$m:()=>Se,vd:()=>Ae});var r=n(948),o=n(8858),i=n(737),s=n(2665),l=n(870),a=n(8892),c=n(3218);const u=[["ß","ss"],["ẞ","Ss"],["ä","ae"],["Ä","Ae"],["ö","oe"],["Ö","Oe"],["ü","ue"],["Ü","Ue"],["À","A"],["Á","A"],["Â","A"],["Ã","A"],["Ä","Ae"],["Å","A"],["Æ","AE"],["Ç","C"],["È","E"],["É","E"],["Ê","E"],["Ë","E"],["Ì","I"],["Í","I"],["Î","I"],["Ï","I"],["Ð","D"],["Ñ","N"],["Ò","O"],["Ó","O"],["Ô","O"],["Õ","O"],["Ö","Oe"],["Ő","O"],["Ø","O"],["Ù","U"],["Ú","U"],["Û","U"],["Ü","Ue"],["Ű","U"],["Ý","Y"],["Þ","TH"],["ß","ss"],["à","a"],["á","a"],["â","a"],["ã","a"],["ä","ae"],["å","a"],["æ","ae"],["ç","c"],["è","e"],["é","e"],["ê","e"],["ë","e"],["ì","i"],["í","i"],["î","i"],["ï","i"],["ð","d"],["ñ","n"],["ò","o"],["ó","o"],["ô","o"],["õ","o"],["ö","oe"],["ő","o"],["ø","o"],["ù","u"],["ú","u"],["û","u"],["ü","ue"],["ű","u"],["ý","y"],["þ","th"],["ÿ","y"],["ẞ","SS"],["à","a"],["À","A"],["á","a"],["Á","A"],["â","a"],["Â","A"],["ã","a"],["Ã","A"],["è","e"],["È","E"],["é","e"],["É","E"],["ê","e"],["Ê","E"],["ì","i"],["Ì","I"],["í","i"],["Í","I"],["ò","o"],["Ò","O"],["ó","o"],["Ó","O"],["ô","o"],["Ô","O"],["õ","o"],["Õ","O"],["ù","u"],["Ù","U"],["ú","u"],["Ú","U"],["ý","y"],["Ý","Y"],["ă","a"],["Ă","A"],["Đ","D"],["đ","d"],["ĩ","i"],["Ĩ","I"],["ũ","u"],["Ũ","U"],["ơ","o"],["Ơ","O"],["ư","u"],["Ư","U"],["ạ","a"],["Ạ","A"],["ả","a"],["Ả","A"],["ấ","a"],["Ấ","A"],["ầ","a"],["Ầ","A"],["ẩ","a"],["Ẩ","A"],["ẫ","a"],["Ẫ","A"],["ậ","a"],["Ậ","A"],["ắ","a"],["Ắ","A"],["ằ","a"],["Ằ","A"],["ẳ","a"],["Ẳ","A"],["ẵ","a"],["Ẵ","A"],["ặ","a"],["Ặ","A"],["ẹ","e"],["Ẹ","E"],["ẻ","e"],["Ẻ","E"],["ẽ","e"],["Ẽ","E"],["ế","e"],["Ế","E"],["ề","e"],["Ề","E"],["ể","e"],["Ể","E"],["ễ","e"],["Ễ","E"],["ệ","e"],["Ệ","E"],["ỉ","i"],["Ỉ","I"],["ị","i"],["Ị","I"],["ọ","o"],["Ọ","O"],["ỏ","o"],["Ỏ","O"],["ố","o"],["Ố","O"],["ồ","o"],["Ồ","O"],["ổ","o"],["Ổ","O"],["ỗ","o"],["Ỗ","O"],["ộ","o"],["Ộ","O"],["ớ","o"],["Ớ","O"],["ờ","o"],["Ờ","O"],["ở","o"],["Ở","O"],["ỡ","o"],["Ỡ","O"],["ợ","o"],["Ợ","O"],["ụ","u"],["Ụ","U"],["ủ","u"],["Ủ","U"],["ứ","u"],["Ứ","U"],["ừ","u"],["Ừ","U"],["ử","u"],["Ử","U"],["ữ","u"],["Ữ","U"],["ự","u"],["Ự","U"],["ỳ","y"],["Ỳ","Y"],["ỵ","y"],["Ỵ","Y"],["ỷ","y"],["Ỷ","Y"],["ỹ","y"],["Ỹ","Y"],["ء","e"],["آ","a"],["أ","a"],["ؤ","w"],["إ","i"],["ئ","y"],["ا","a"],["ب","b"],["ة","t"],["ت","t"],["ث","th"],["ج","j"],["ح","h"],["خ","kh"],["د","d"],["ذ","dh"],["ر","r"],["ز","z"],["س","s"],["ش","sh"],["ص","s"],["ض","d"],["ط","t"],["ظ","z"],["ع","e"],["غ","gh"],["ـ","_"],["ف","f"],["ق","q"],["ك","k"],["ل","l"],["م","m"],["ن","n"],["ه","h"],["و","w"],["ى","a"],["ي","y"],["َ","a"],["ُ","u"],["ِ","i"],["٠","0"],["١","1"],["٢","2"],["٣","3"],["٤","4"],["٥","5"],["٦","6"],["٧","7"],["٨","8"],["٩","9"],["چ","ch"],["ک","k"],["گ","g"],["پ","p"],["ژ","zh"],["ی","y"],["۰","0"],["۱","1"],["۲","2"],["۳","3"],["۴","4"],["۵","5"],["۶","6"],["۷","7"],["۸","8"],["۹","9"],["ټ","p"],["ځ","z"],["څ","c"],["ډ","d"],["ﺫ","d"],["ﺭ","r"],["ړ","r"],["ﺯ","z"],["ږ","g"],["ښ","x"],["ګ","g"],["ڼ","n"],["ۀ","e"],["ې","e"],["ۍ","ai"],["ٹ","t"],["ڈ","d"],["ڑ","r"],["ں","n"],["ہ","h"],["ھ","h"],["ے","e"],["А","A"],["а","a"],["Б","B"],["б","b"],["В","V"],["в","v"],["Г","G"],["г","g"],["Д","D"],["д","d"],["ъе","ye"],["Ъе","Ye"],["ъЕ","yE"],["ЪЕ","YE"],["Е","E"],["е","e"],["Ё","Yo"],["ё","yo"],["Ж","Zh"],["ж","zh"],["З","Z"],["з","z"],["И","I"],["и","i"],["ый","iy"],["Ый","Iy"],["ЫЙ","IY"],["ыЙ","iY"],["Й","Y"],["й","y"],["К","K"],["к","k"],["Л","L"],["л","l"],["М","M"],["м","m"],["Н","N"],["н","n"],["О","O"],["о","o"],["П","P"],["п","p"],["Р","R"],["р","r"],["С","S"],["с","s"],["Т","T"],["т","t"],["У","U"],["у","u"],["Ф","F"],["ф","f"],["Х","Kh"],["х","kh"],["Ц","Ts"],["ц","ts"],["Ч","Ch"],["ч","ch"],["Ш","Sh"],["ш","sh"],["Щ","Sch"],["щ","sch"],["Ъ",""],["ъ",""],["Ы","Y"],["ы","y"],["Ь",""],["ь",""],["Э","E"],["э","e"],["Ю","Yu"],["ю","yu"],["Я","Ya"],["я","ya"],["ă","a"],["Ă","A"],["ș","s"],["Ș","S"],["ț","t"],["Ț","T"],["ţ","t"],["Ţ","T"],["ş","s"],["Ş","S"],["ç","c"],["Ç","C"],["ğ","g"],["Ğ","G"],["ı","i"],["İ","I"],["ա","a"],["Ա","A"],["բ","b"],["Բ","B"],["գ","g"],["Գ","G"],["դ","d"],["Դ","D"],["ե","ye"],["Ե","Ye"],["զ","z"],["Զ","Z"],["է","e"],["Է","E"],["ը","y"],["Ը","Y"],["թ","t"],["Թ","T"],["ժ","zh"],["Ժ","Zh"],["ի","i"],["Ի","I"],["լ","l"],["Լ","L"],["խ","kh"],["Խ","Kh"],["ծ","ts"],["Ծ","Ts"],["կ","k"],["Կ","K"],["հ","h"],["Հ","H"],["ձ","dz"],["Ձ","Dz"],["ղ","gh"],["Ղ","Gh"],["ճ","tch"],["Ճ","Tch"],["մ","m"],["Մ","M"],["յ","y"],["Յ","Y"],["ն","n"],["Ն","N"],["շ","sh"],["Շ","Sh"],["ո","vo"],["Ո","Vo"],["չ","ch"],["Չ","Ch"],["պ","p"],["Պ","P"],["ջ","j"],["Ջ","J"],["ռ","r"],["Ռ","R"],["ս","s"],["Ս","S"],["վ","v"],["Վ","V"],["տ","t"],["Տ","T"],["ր","r"],["Ր","R"],["ց","c"],["Ց","C"],["ու","u"],["ՈՒ","U"],["Ու","U"],["փ","p"],["Փ","P"],["ք","q"],["Ք","Q"],["օ","o"],["Օ","O"],["ֆ","f"],["Ֆ","F"],["և","yev"],["ა","a"],["ბ","b"],["გ","g"],["დ","d"],["ე","e"],["ვ","v"],["ზ","z"],["თ","t"],["ი","i"],["კ","k"],["ლ","l"],["მ","m"],["ნ","n"],["ო","o"],["პ","p"],["ჟ","zh"],["რ","r"],["ს","s"],["ტ","t"],["უ","u"],["ფ","ph"],["ქ","q"],["ღ","gh"],["ყ","k"],["შ","sh"],["ჩ","ch"],["ც","ts"],["ძ","dz"],["წ","ts"],["ჭ","tch"],["ხ","kh"],["ჯ","j"],["ჰ","h"],["č","c"],["ď","d"],["ě","e"],["ň","n"],["ř","r"],["š","s"],["ť","t"],["ů","u"],["ž","z"],["Č","C"],["Ď","D"],["Ě","E"],["Ň","N"],["Ř","R"],["Š","S"],["Ť","T"],["Ů","U"],["Ž","Z"],["ހ","h"],["ށ","sh"],["ނ","n"],["ރ","r"],["ބ","b"],["ޅ","lh"],["ކ","k"],["އ","a"],["ވ","v"],["މ","m"],["ފ","f"],["ދ","dh"],["ތ","th"],["ލ","l"],["ގ","g"],["ޏ","gn"],["ސ","s"],["ޑ","d"],["ޒ","z"],["ޓ","t"],["ޔ","y"],["ޕ","p"],["ޖ","j"],["ޗ","ch"],["ޘ","tt"],["ޙ","hh"],["ޚ","kh"],["ޛ","th"],["ޜ","z"],["ޝ","sh"],["ޞ","s"],["ޟ","d"],["ޠ","t"],["ޡ","z"],["ޢ","a"],["ޣ","gh"],["ޤ","q"],["ޥ","w"],["ަ","a"],["ާ","aa"],["ި","i"],["ީ","ee"],["ު","u"],["ޫ","oo"],["ެ","e"],["ޭ","ey"],["ޮ","o"],["ޯ","oa"],["ް",""],["α","a"],["β","v"],["γ","g"],["δ","d"],["ε","e"],["ζ","z"],["η","i"],["θ","th"],["ι","i"],["κ","k"],["λ","l"],["μ","m"],["ν","n"],["ξ","ks"],["ο","o"],["π","p"],["ρ","r"],["σ","s"],["τ","t"],["υ","y"],["φ","f"],["χ","x"],["ψ","ps"],["ω","o"],["ά","a"],["έ","e"],["ί","i"],["ό","o"],["ύ","y"],["ή","i"],["ώ","o"],["ς","s"],["ϊ","i"],["ΰ","y"],["ϋ","y"],["ΐ","i"],["Α","A"],["Β","B"],["Γ","G"],["Δ","D"],["Ε","E"],["Ζ","Z"],["Η","I"],["Θ","TH"],["Ι","I"],["Κ","K"],["Λ","L"],["Μ","M"],["Ν","N"],["Ξ","KS"],["Ο","O"],["Π","P"],["Ρ","R"],["Σ","S"],["Τ","T"],["Υ","Y"],["Φ","F"],["Χ","X"],["Ψ","PS"],["Ω","O"],["Ά","A"],["Έ","E"],["Ί","I"],["Ό","O"],["Ύ","Y"],["Ή","I"],["Ώ","O"],["Ϊ","I"],["Ϋ","Y"],["ā","a"],["ē","e"],["ģ","g"],["ī","i"],["ķ","k"],["ļ","l"],["ņ","n"],["ū","u"],["Ā","A"],["Ē","E"],["Ģ","G"],["Ī","I"],["Ķ","K"],["Ļ","L"],["Ņ","N"],["Ū","U"],["č","c"],["š","s"],["ž","z"],["Č","C"],["Š","S"],["Ž","Z"],["ą","a"],["č","c"],["ę","e"],["ė","e"],["į","i"],["š","s"],["ų","u"],["ū","u"],["ž","z"],["Ą","A"],["Č","C"],["Ę","E"],["Ė","E"],["Į","I"],["Š","S"],["Ų","U"],["Ū","U"],["Ќ","Kj"],["ќ","kj"],["Љ","Lj"],["љ","lj"],["Њ","Nj"],["њ","nj"],["Тс","Ts"],["тс","ts"],["ą","a"],["ć","c"],["ę","e"],["ł","l"],["ń","n"],["ś","s"],["ź","z"],["ż","z"],["Ą","A"],["Ć","C"],["Ę","E"],["Ł","L"],["Ń","N"],["Ś","S"],["Ź","Z"],["Ż","Z"],["Є","Ye"],["І","I"],["Ї","Yi"],["Ґ","G"],["є","ye"],["і","i"],["ї","yi"],["ґ","g"],["IJ","IJ"],["ij","ij"],["¢","c"],["¥","Y"],["߿","b"],["৳","t"],["૱","Bo"],["฿","B"],["₠","CE"],["₡","C"],["₢","Cr"],["₣","F"],["₥","m"],["₦","N"],["₧","Pt"],["₨","Rs"],["₩","W"],["₫","s"],["€","E"],["₭","K"],["₮","T"],["₯","Dp"],["₰","S"],["₱","P"],["₲","G"],["₳","A"],["₴","S"],["₵","C"],["₶","tt"],["₷","S"],["₸","T"],["₹","R"],["₺","L"],["₽","P"],["₿","B"],["﹩","$"],["¢","c"],["¥","Y"],["₩","W"],["𝐀","A"],["𝐁","B"],["𝐂","C"],["𝐃","D"],["𝐄","E"],["𝐅","F"],["𝐆","G"],["𝐇","H"],["𝐈","I"],["𝐉","J"],["𝐊","K"],["𝐋","L"],["𝐌","M"],["𝐍","N"],["𝐎","O"],["𝐏","P"],["𝐐","Q"],["𝐑","R"],["𝐒","S"],["𝐓","T"],["𝐔","U"],["𝐕","V"],["𝐖","W"],["𝐗","X"],["𝐘","Y"],["𝐙","Z"],["𝐚","a"],["𝐛","b"],["𝐜","c"],["𝐝","d"],["𝐞","e"],["𝐟","f"],["𝐠","g"],["𝐡","h"],["𝐢","i"],["𝐣","j"],["𝐤","k"],["𝐥","l"],["𝐦","m"],["𝐧","n"],["𝐨","o"],["𝐩","p"],["𝐪","q"],["𝐫","r"],["𝐬","s"],["𝐭","t"],["𝐮","u"],["𝐯","v"],["𝐰","w"],["𝐱","x"],["𝐲","y"],["𝐳","z"],["𝐴","A"],["𝐵","B"],["𝐶","C"],["𝐷","D"],["𝐸","E"],["𝐹","F"],["𝐺","G"],["𝐻","H"],["𝐼","I"],["𝐽","J"],["𝐾","K"],["𝐿","L"],["𝑀","M"],["𝑁","N"],["𝑂","O"],["𝑃","P"],["𝑄","Q"],["𝑅","R"],["𝑆","S"],["𝑇","T"],["𝑈","U"],["𝑉","V"],["𝑊","W"],["𝑋","X"],["𝑌","Y"],["𝑍","Z"],["𝑎","a"],["𝑏","b"],["𝑐","c"],["𝑑","d"],["𝑒","e"],["𝑓","f"],["𝑔","g"],["𝑖","i"],["𝑗","j"],["𝑘","k"],["𝑙","l"],["𝑚","m"],["𝑛","n"],["𝑜","o"],["𝑝","p"],["𝑞","q"],["𝑟","r"],["𝑠","s"],["𝑡","t"],["𝑢","u"],["𝑣","v"],["𝑤","w"],["𝑥","x"],["𝑦","y"],["𝑧","z"],["𝑨","A"],["𝑩","B"],["𝑪","C"],["𝑫","D"],["𝑬","E"],["𝑭","F"],["𝑮","G"],["𝑯","H"],["𝑰","I"],["𝑱","J"],["𝑲","K"],["𝑳","L"],["𝑴","M"],["𝑵","N"],["𝑶","O"],["𝑷","P"],["𝑸","Q"],["𝑹","R"],["𝑺","S"],["𝑻","T"],["𝑼","U"],["𝑽","V"],["𝑾","W"],["𝑿","X"],["𝒀","Y"],["𝒁","Z"],["𝒂","a"],["𝒃","b"],["𝒄","c"],["𝒅","d"],["𝒆","e"],["𝒇","f"],["𝒈","g"],["𝒉","h"],["𝒊","i"],["𝒋","j"],["𝒌","k"],["𝒍","l"],["𝒎","m"],["𝒏","n"],["𝒐","o"],["𝒑","p"],["𝒒","q"],["𝒓","r"],["𝒔","s"],["𝒕","t"],["𝒖","u"],["𝒗","v"],["𝒘","w"],["𝒙","x"],["𝒚","y"],["𝒛","z"],["𝒜","A"],["𝒞","C"],["𝒟","D"],["𝒢","g"],["𝒥","J"],["𝒦","K"],["𝒩","N"],["𝒪","O"],["𝒫","P"],["𝒬","Q"],["𝒮","S"],["𝒯","T"],["𝒰","U"],["𝒱","V"],["𝒲","W"],["𝒳","X"],["𝒴","Y"],["𝒵","Z"],["𝒶","a"],["𝒷","b"],["𝒸","c"],["𝒹","d"],["𝒻","f"],["𝒽","h"],["𝒾","i"],["𝒿","j"],["𝓀","h"],["𝓁","l"],["𝓂","m"],["𝓃","n"],["𝓅","p"],["𝓆","q"],["𝓇","r"],["𝓈","s"],["𝓉","t"],["𝓊","u"],["𝓋","v"],["𝓌","w"],["𝓍","x"],["𝓎","y"],["𝓏","z"],["𝓐","A"],["𝓑","B"],["𝓒","C"],["𝓓","D"],["𝓔","E"],["𝓕","F"],["𝓖","G"],["𝓗","H"],["𝓘","I"],["𝓙","J"],["𝓚","K"],["𝓛","L"],["𝓜","M"],["𝓝","N"],["𝓞","O"],["𝓟","P"],["𝓠","Q"],["𝓡","R"],["𝓢","S"],["𝓣","T"],["𝓤","U"],["𝓥","V"],["𝓦","W"],["𝓧","X"],["𝓨","Y"],["𝓩","Z"],["𝓪","a"],["𝓫","b"],["𝓬","c"],["𝓭","d"],["𝓮","e"],["𝓯","f"],["𝓰","g"],["𝓱","h"],["𝓲","i"],["𝓳","j"],["𝓴","k"],["𝓵","l"],["𝓶","m"],["𝓷","n"],["𝓸","o"],["𝓹","p"],["𝓺","q"],["𝓻","r"],["𝓼","s"],["𝓽","t"],["𝓾","u"],["𝓿","v"],["𝔀","w"],["𝔁","x"],["𝔂","y"],["𝔃","z"],["𝔄","A"],["𝔅","B"],["𝔇","D"],["𝔈","E"],["𝔉","F"],["𝔊","G"],["𝔍","J"],["𝔎","K"],["𝔏","L"],["𝔐","M"],["𝔑","N"],["𝔒","O"],["𝔓","P"],["𝔔","Q"],["𝔖","S"],["𝔗","T"],["𝔘","U"],["𝔙","V"],["𝔚","W"],["𝔛","X"],["𝔜","Y"],["𝔞","a"],["𝔟","b"],["𝔠","c"],["𝔡","d"],["𝔢","e"],["𝔣","f"],["𝔤","g"],["𝔥","h"],["𝔦","i"],["𝔧","j"],["𝔨","k"],["𝔩","l"],["𝔪","m"],["𝔫","n"],["𝔬","o"],["𝔭","p"],["𝔮","q"],["𝔯","r"],["𝔰","s"],["𝔱","t"],["𝔲","u"],["𝔳","v"],["𝔴","w"],["𝔵","x"],["𝔶","y"],["𝔷","z"],["𝔸","A"],["𝔹","B"],["𝔻","D"],["𝔼","E"],["𝔽","F"],["𝔾","G"],["𝕀","I"],["𝕁","J"],["𝕂","K"],["𝕃","L"],["𝕄","M"],["𝕆","N"],["𝕊","S"],["𝕋","T"],["𝕌","U"],["𝕍","V"],["𝕎","W"],["𝕏","X"],["𝕐","Y"],["𝕒","a"],["𝕓","b"],["𝕔","c"],["𝕕","d"],["𝕖","e"],["𝕗","f"],["𝕘","g"],["𝕙","h"],["𝕚","i"],["𝕛","j"],["𝕜","k"],["𝕝","l"],["𝕞","m"],["𝕟","n"],["𝕠","o"],["𝕡","p"],["𝕢","q"],["𝕣","r"],["𝕤","s"],["𝕥","t"],["𝕦","u"],["𝕧","v"],["𝕨","w"],["𝕩","x"],["𝕪","y"],["𝕫","z"],["𝕬","A"],["𝕭","B"],["𝕮","C"],["𝕯","D"],["𝕰","E"],["𝕱","F"],["𝕲","G"],["𝕳","H"],["𝕴","I"],["𝕵","J"],["𝕶","K"],["𝕷","L"],["𝕸","M"],["𝕹","N"],["𝕺","O"],["𝕻","P"],["𝕼","Q"],["𝕽","R"],["𝕾","S"],["𝕿","T"],["𝖀","U"],["𝖁","V"],["𝖂","W"],["𝖃","X"],["𝖄","Y"],["𝖅","Z"],["𝖆","a"],["𝖇","b"],["𝖈","c"],["𝖉","d"],["𝖊","e"],["𝖋","f"],["𝖌","g"],["𝖍","h"],["𝖎","i"],["𝖏","j"],["𝖐","k"],["𝖑","l"],["𝖒","m"],["𝖓","n"],["𝖔","o"],["𝖕","p"],["𝖖","q"],["𝖗","r"],["𝖘","s"],["𝖙","t"],["𝖚","u"],["𝖛","v"],["𝖜","w"],["𝖝","x"],["𝖞","y"],["𝖟","z"],["𝖠","A"],["𝖡","B"],["𝖢","C"],["𝖣","D"],["𝖤","E"],["𝖥","F"],["𝖦","G"],["𝖧","H"],["𝖨","I"],["𝖩","J"],["𝖪","K"],["𝖫","L"],["𝖬","M"],["𝖭","N"],["𝖮","O"],["𝖯","P"],["𝖰","Q"],["𝖱","R"],["𝖲","S"],["𝖳","T"],["𝖴","U"],["𝖵","V"],["𝖶","W"],["𝖷","X"],["𝖸","Y"],["𝖹","Z"],["𝖺","a"],["𝖻","b"],["𝖼","c"],["𝖽","d"],["𝖾","e"],["𝖿","f"],["𝗀","g"],["𝗁","h"],["𝗂","i"],["𝗃","j"],["𝗄","k"],["𝗅","l"],["𝗆","m"],["𝗇","n"],["𝗈","o"],["𝗉","p"],["𝗊","q"],["𝗋","r"],["𝗌","s"],["𝗍","t"],["𝗎","u"],["𝗏","v"],["𝗐","w"],["𝗑","x"],["𝗒","y"],["𝗓","z"],["𝗔","A"],["𝗕","B"],["𝗖","C"],["𝗗","D"],["𝗘","E"],["𝗙","F"],["𝗚","G"],["𝗛","H"],["𝗜","I"],["𝗝","J"],["𝗞","K"],["𝗟","L"],["𝗠","M"],["𝗡","N"],["𝗢","O"],["𝗣","P"],["𝗤","Q"],["𝗥","R"],["𝗦","S"],["𝗧","T"],["𝗨","U"],["𝗩","V"],["𝗪","W"],["𝗫","X"],["𝗬","Y"],["𝗭","Z"],["𝗮","a"],["𝗯","b"],["𝗰","c"],["𝗱","d"],["𝗲","e"],["𝗳","f"],["𝗴","g"],["𝗵","h"],["𝗶","i"],["𝗷","j"],["𝗸","k"],["𝗹","l"],["𝗺","m"],["𝗻","n"],["𝗼","o"],["𝗽","p"],["𝗾","q"],["𝗿","r"],["𝘀","s"],["𝘁","t"],["𝘂","u"],["𝘃","v"],["𝘄","w"],["𝘅","x"],["𝘆","y"],["𝘇","z"],["𝘈","A"],["𝘉","B"],["𝘊","C"],["𝘋","D"],["𝘌","E"],["𝘍","F"],["𝘎","G"],["𝘏","H"],["𝘐","I"],["𝘑","J"],["𝘒","K"],["𝘓","L"],["𝘔","M"],["𝘕","N"],["𝘖","O"],["𝘗","P"],["𝘘","Q"],["𝘙","R"],["𝘚","S"],["𝘛","T"],["𝘜","U"],["𝘝","V"],["𝘞","W"],["𝘟","X"],["𝘠","Y"],["𝘡","Z"],["𝘢","a"],["𝘣","b"],["𝘤","c"],["𝘥","d"],["𝘦","e"],["𝘧","f"],["𝘨","g"],["𝘩","h"],["𝘪","i"],["𝘫","j"],["𝘬","k"],["𝘭","l"],["𝘮","m"],["𝘯","n"],["𝘰","o"],["𝘱","p"],["𝘲","q"],["𝘳","r"],["𝘴","s"],["𝘵","t"],["𝘶","u"],["𝘷","v"],["𝘸","w"],["𝘹","x"],["𝘺","y"],["𝘻","z"],["𝘼","A"],["𝘽","B"],["𝘾","C"],["𝘿","D"],["𝙀","E"],["𝙁","F"],["𝙂","G"],["𝙃","H"],["𝙄","I"],["𝙅","J"],["𝙆","K"],["𝙇","L"],["𝙈","M"],["𝙉","N"],["𝙊","O"],["𝙋","P"],["𝙌","Q"],["𝙍","R"],["𝙎","S"],["𝙏","T"],["𝙐","U"],["𝙑","V"],["𝙒","W"],["𝙓","X"],["𝙔","Y"],["𝙕","Z"],["𝙖","a"],["𝙗","b"],["𝙘","c"],["𝙙","d"],["𝙚","e"],["𝙛","f"],["𝙜","g"],["𝙝","h"],["𝙞","i"],["𝙟","j"],["𝙠","k"],["𝙡","l"],["𝙢","m"],["𝙣","n"],["𝙤","o"],["𝙥","p"],["𝙦","q"],["𝙧","r"],["𝙨","s"],["𝙩","t"],["𝙪","u"],["𝙫","v"],["𝙬","w"],["𝙭","x"],["𝙮","y"],["𝙯","z"],["𝙰","A"],["𝙱","B"],["𝙲","C"],["𝙳","D"],["𝙴","E"],["𝙵","F"],["𝙶","G"],["𝙷","H"],["𝙸","I"],["𝙹","J"],["𝙺","K"],["𝙻","L"],["𝙼","M"],["𝙽","N"],["𝙾","O"],["𝙿","P"],["𝚀","Q"],["𝚁","R"],["𝚂","S"],["𝚃","T"],["𝚄","U"],["𝚅","V"],["𝚆","W"],["𝚇","X"],["𝚈","Y"],["𝚉","Z"],["𝚊","a"],["𝚋","b"],["𝚌","c"],["𝚍","d"],["𝚎","e"],["𝚏","f"],["𝚐","g"],["𝚑","h"],["𝚒","i"],["𝚓","j"],["𝚔","k"],["𝚕","l"],["𝚖","m"],["𝚗","n"],["𝚘","o"],["𝚙","p"],["𝚚","q"],["𝚛","r"],["𝚜","s"],["𝚝","t"],["𝚞","u"],["𝚟","v"],["𝚠","w"],["𝚡","x"],["𝚢","y"],["𝚣","z"],["𝚤","l"],["𝚥","j"],["𝛢","A"],["𝛣","B"],["𝛤","G"],["𝛥","D"],["𝛦","E"],["𝛧","Z"],["𝛨","I"],["𝛩","TH"],["𝛪","I"],["𝛫","K"],["𝛬","L"],["𝛭","M"],["𝛮","N"],["𝛯","KS"],["𝛰","O"],["𝛱","P"],["𝛲","R"],["𝛳","TH"],["𝛴","S"],["𝛵","T"],["𝛶","Y"],["𝛷","F"],["𝛸","x"],["𝛹","PS"],["𝛺","O"],["𝛻","D"],["𝛼","a"],["𝛽","b"],["𝛾","g"],["𝛿","d"],["𝜀","e"],["𝜁","z"],["𝜂","i"],["𝜃","th"],["𝜄","i"],["𝜅","k"],["𝜆","l"],["𝜇","m"],["𝜈","n"],["𝜉","ks"],["𝜊","o"],["𝜋","p"],["𝜌","r"],["𝜍","s"],["𝜎","s"],["𝜏","t"],["𝜐","y"],["𝜑","f"],["𝜒","x"],["𝜓","ps"],["𝜔","o"],["𝜕","d"],["𝜖","E"],["𝜗","TH"],["𝜘","K"],["𝜙","f"],["𝜚","r"],["𝜛","p"],["𝜜","A"],["𝜝","V"],["𝜞","G"],["𝜟","D"],["𝜠","E"],["𝜡","Z"],["𝜢","I"],["𝜣","TH"],["𝜤","I"],["𝜥","K"],["𝜦","L"],["𝜧","M"],["𝜨","N"],["𝜩","KS"],["𝜪","O"],["𝜫","P"],["𝜬","S"],["𝜭","TH"],["𝜮","S"],["𝜯","T"],["𝜰","Y"],["𝜱","F"],["𝜲","X"],["𝜳","PS"],["𝜴","O"],["𝜵","D"],["𝜶","a"],["𝜷","v"],["𝜸","g"],["𝜹","d"],["𝜺","e"],["𝜻","z"],["𝜼","i"],["𝜽","th"],["𝜾","i"],["𝜿","k"],["𝝀","l"],["𝝁","m"],["𝝂","n"],["𝝃","ks"],["𝝄","o"],["𝝅","p"],["𝝆","r"],["𝝇","s"],["𝝈","s"],["𝝉","t"],["𝝊","y"],["𝝋","f"],["𝝌","x"],["𝝍","ps"],["𝝎","o"],["𝝏","a"],["𝝐","e"],["𝝑","i"],["𝝒","k"],["𝝓","f"],["𝝔","r"],["𝝕","p"],["𝝖","A"],["𝝗","B"],["𝝘","G"],["𝝙","D"],["𝝚","E"],["𝝛","Z"],["𝝜","I"],["𝝝","TH"],["𝝞","I"],["𝝟","K"],["𝝠","L"],["𝝡","M"],["𝝢","N"],["𝝣","KS"],["𝝤","O"],["𝝥","P"],["𝝦","R"],["𝝧","TH"],["𝝨","S"],["𝝩","T"],["𝝪","Y"],["𝝫","F"],["𝝬","X"],["𝝭","PS"],["𝝮","O"],["𝝯","D"],["𝝰","a"],["𝝱","v"],["𝝲","g"],["𝝳","d"],["𝝴","e"],["𝝵","z"],["𝝶","i"],["𝝷","th"],["𝝸","i"],["𝝹","k"],["𝝺","l"],["𝝻","m"],["𝝼","n"],["𝝽","ks"],["𝝾","o"],["𝝿","p"],["𝞀","r"],["𝞁","s"],["𝞂","s"],["𝞃","t"],["𝞄","y"],["𝞅","f"],["𝞆","x"],["𝞇","ps"],["𝞈","o"],["𝞉","a"],["𝞊","e"],["𝞋","i"],["𝞌","k"],["𝞍","f"],["𝞎","r"],["𝞏","p"],["𝞐","A"],["𝞑","V"],["𝞒","G"],["𝞓","D"],["𝞔","E"],["𝞕","Z"],["𝞖","I"],["𝞗","TH"],["𝞘","I"],["𝞙","K"],["𝞚","L"],["𝞛","M"],["𝞜","N"],["𝞝","KS"],["𝞞","O"],["𝞟","P"],["𝞠","S"],["𝞡","TH"],["𝞢","S"],["𝞣","T"],["𝞤","Y"],["𝞥","F"],["𝞦","X"],["𝞧","PS"],["𝞨","O"],["𝞩","D"],["𝞪","av"],["𝞫","g"],["𝞬","d"],["𝞭","e"],["𝞮","z"],["𝞯","i"],["𝞰","i"],["𝞱","th"],["𝞲","i"],["𝞳","k"],["𝞴","l"],["𝞵","m"],["𝞶","n"],["𝞷","ks"],["𝞸","o"],["𝞹","p"],["𝞺","r"],["𝞻","s"],["𝞼","s"],["𝞽","t"],["𝞾","y"],["𝞿","f"],["𝟀","x"],["𝟁","ps"],["𝟂","o"],["𝟃","a"],["𝟄","e"],["𝟅","i"],["𝟆","k"],["𝟇","f"],["𝟈","r"],["𝟉","p"],["𝟊","F"],["𝟋","f"],["⒜","(a)"],["⒝","(b)"],["⒞","(c)"],["⒟","(d)"],["⒠","(e)"],["⒡","(f)"],["⒢","(g)"],["⒣","(h)"],["⒤","(i)"],["⒥","(j)"],["⒦","(k)"],["⒧","(l)"],["⒨","(m)"],["⒩","(n)"],["⒪","(o)"],["⒫","(p)"],["⒬","(q)"],["⒭","(r)"],["⒮","(s)"],["⒯","(t)"],["⒰","(u)"],["⒱","(v)"],["⒲","(w)"],["⒳","(x)"],["⒴","(y)"],["⒵","(z)"],["Ⓐ","(A)"],["Ⓑ","(B)"],["Ⓒ","(C)"],["Ⓓ","(D)"],["Ⓔ","(E)"],["Ⓕ","(F)"],["Ⓖ","(G)"],["Ⓗ","(H)"],["Ⓘ","(I)"],["Ⓙ","(J)"],["Ⓚ","(K)"],["Ⓛ","(L)"],["Ⓝ","(N)"],["Ⓞ","(O)"],["Ⓟ","(P)"],["Ⓠ","(Q)"],["Ⓡ","(R)"],["Ⓢ","(S)"],["Ⓣ","(T)"],["Ⓤ","(U)"],["Ⓥ","(V)"],["Ⓦ","(W)"],["Ⓧ","(X)"],["Ⓨ","(Y)"],["Ⓩ","(Z)"],["ⓐ","(a)"],["ⓑ","(b)"],["ⓒ","(b)"],["ⓓ","(c)"],["ⓔ","(e)"],["ⓕ","(f)"],["ⓖ","(g)"],["ⓗ","(h)"],["ⓘ","(i)"],["ⓙ","(j)"],["ⓚ","(k)"],["ⓛ","(l)"],["ⓜ","(m)"],["ⓝ","(n)"],["ⓞ","(o)"],["ⓟ","(p)"],["ⓠ","(q)"],["ⓡ","(r)"],["ⓢ","(s)"],["ⓣ","(t)"],["ⓤ","(u)"],["ⓥ","(v)"],["ⓦ","(w)"],["ⓧ","(x)"],["ⓨ","(y)"],["ⓩ","(z)"],["Ċ","C"],["ċ","c"],["Ġ","G"],["ġ","g"],["Ħ","H"],["ħ","h"],["Ż","Z"],["ż","z"],["𝟎","0"],["𝟏","1"],["𝟐","2"],["𝟑","3"],["𝟒","4"],["𝟓","5"],["𝟔","6"],["𝟕","7"],["𝟖","8"],["𝟗","9"],["𝟘","0"],["𝟙","1"],["𝟚","2"],["𝟛","3"],["𝟜","4"],["𝟝","5"],["𝟞","6"],["𝟟","7"],["𝟠","8"],["𝟡","9"],["𝟢","0"],["𝟣","1"],["𝟤","2"],["𝟥","3"],["𝟦","4"],["𝟧","5"],["𝟨","6"],["𝟩","7"],["𝟪","8"],["𝟫","9"],["𝟬","0"],["𝟭","1"],["𝟮","2"],["𝟯","3"],["𝟰","4"],["𝟱","5"],["𝟲","6"],["𝟳","7"],["𝟴","8"],["𝟵","9"],["𝟶","0"],["𝟷","1"],["𝟸","2"],["𝟹","3"],["𝟺","4"],["𝟻","5"],["𝟼","6"],["𝟽","7"],["𝟾","8"],["𝟿","9"],["①","1"],["②","2"],["③","3"],["④","4"],["⑤","5"],["⑥","6"],["⑦","7"],["⑧","8"],["⑨","9"],["⑩","10"],["⑪","11"],["⑫","12"],["⑬","13"],["⑭","14"],["⑮","15"],["⑯","16"],["⑰","17"],["⑱","18"],["⑲","19"],["⑳","20"],["⑴","1"],["⑵","2"],["⑶","3"],["⑷","4"],["⑸","5"],["⑹","6"],["⑺","7"],["⑻","8"],["⑼","9"],["⑽","10"],["⑾","11"],["⑿","12"],["⒀","13"],["⒁","14"],["⒂","15"],["⒃","16"],["⒄","17"],["⒅","18"],["⒆","19"],["⒇","20"],["⒈","1."],["⒉","2."],["⒊","3."],["⒋","4."],["⒌","5."],["⒍","6."],["⒎","7."],["⒏","8."],["⒐","9."],["⒑","10."],["⒒","11."],["⒓","12."],["⒔","13."],["⒕","14."],["⒖","15."],["⒗","16."],["⒘","17."],["⒙","18."],["⒚","19."],["⒛","20."],["⓪","0"],["⓫","11"],["⓬","12"],["⓭","13"],["⓮","14"],["⓯","15"],["⓰","16"],["⓱","17"],["⓲","18"],["⓳","19"],["⓴","20"],["⓵","1"],["⓶","2"],["⓷","3"],["⓸","4"],["⓹","5"],["⓺","6"],["⓻","7"],["⓼","8"],["⓽","9"],["⓾","10"],["⓿","0"],["🙰","&"],["🙱","&"],["🙲","&"],["🙳","&"],["🙴","&"],["🙵","&"],["🙶",'"'],["🙷",'"'],["🙸",'"'],["‽","?!"],["🙹","?!"],["🙺","?!"],["🙻","?!"],["🙼","/"],["🙽","\\"],["🜇","AR"],["🜈","V"],["🜉","V"],["🜆","VR"],["🜅","VF"],["🜩","2"],["🜪","5"],["🝡","f"],["🝢","W"],["🝣","U"],["🝧","V"],["🝨","T"],["🝪","V"],["🝫","MB"],["🝬","VB"],["🝲","3B"],["🝳","3B"],["💯","100"],["🔙","BACK"],["🔚","END"],["🔛","ON!"],["🔜","SOON"],["🔝","TOP"],["🔞","18"],["🔤","abc"],["🔠","ABCD"],["🔡","abcd"],["🔢","1234"],["🔣","T&@%"],["#️⃣","#"],["*️⃣","*"],["0️⃣","0"],["1️⃣","1"],["2️⃣","2"],["3️⃣","3"],["4️⃣","4"],["5️⃣","5"],["6️⃣","6"],["7️⃣","7"],["8️⃣","8"],["9️⃣","9"],["🔟","10"],["🅰️","A"],["🅱️","B"],["🆎","AB"],["🆑","CL"],["🅾️","O"],["🅿","P"],["🆘","SOS"],["🅲","C"],["🅳","D"],["🅴","E"],["🅵","F"],["🅶","G"],["🅷","H"],["🅸","I"],["🅹","J"],["🅺","K"],["🅻","L"],["🅼","M"],["🅽","N"],["🆀","Q"],["🆁","R"],["🆂","S"],["🆃","T"],["🆄","U"],["🆅","V"],["🆆","W"],["🆇","X"],["🆈","Y"],["🆉","Z"]],h=[["&"," and "],["🦄"," unicorn "],["♥"," love "]];function d(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);const n=(t={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],...t}).preserveLeadingUnderscore&&e.startsWith("_"),r=t.preserveTrailingDash&&e.endsWith("-");e=function(e,t){if("string"!=typeof e)throw new TypeError(`Expected a string, got \`${typeof e}\``);t={customReplacements:[],...t};const n=new Map([...u,...t.customReplacements]);return(e=((e,t)=>{for(const[n,r]of t)e=e.replace(new RegExp((0,c.Z)(n),"g"),r);return e})(e=e.normalize(),n)).normalize("NFD").replace(/\p{Diacritic}/gu,"").normalize()}(e,{customReplacements:new Map([...h,...t.customReplacements])}),t.decamelize&&(e=(e=>e.replace(/([A-Z]{2,})(\d+)/g,"$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"))(e));const o=(e=>{let t="a-z\\d";if(t+=e.lowercase?"":"A-Z",e.preserveCharacters.length>0)for(const n of e.preserveCharacters){if(n===e.separator)throw new Error(`The separator character \`${e.separator}\` cannot be included in preserved characters: ${e.preserveCharacters}`);t+=(0,c.Z)(n)}return new RegExp(`[^${t}]+`,"g")})(t);return t.lowercase&&(e=e.toLowerCase()),e=(e=(e=e.replace(/([a-zA-Z\d]+)'([ts])(\s|$)/g,"$1$2$3")).replace(o,t.separator)).replace(/\\/g,""),t.separator&&(e=((e,t)=>{const n=(0,c.Z)(t);return e.replace(new RegExp(`${n}{2,}`,"g"),t).replace(new RegExp(`^${n}|${n}$`,"g"),"")})(e,t.separator)),n&&(e=`_${e}`),r&&(e=`${e}-`),e}var p=n(7191),f=n(4285),m=n(6151);var g=n(2780),y=n(6355),k=n(1104);const w={}.hasOwnProperty;function v(e){return String(e||"").toUpperCase()}function b(){return e=>{const t=function(e){const t=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return(0,y.Vn)(e,"definition",(e=>{const n=v(e.identifier);n&&!w.call(t,n)&&(t[n]=e)})),function(e){const n=v(e);return n&&w.call(t,n)?t[n]:null}}(e);(0,y.Vn)(e,((e,n,r)=>{if("definition"===e.type&&null!==r&&"number"==typeof n)return r.children.splice(n,1),[k.AM,n];if("imageReference"===e.type||"linkReference"===e.type){const o=t(e.identifier);if(o&&null!==r&&"number"==typeof n){const t="imageReference"===e.type?{type:"image",url:o.url,title:o.title,alt:e.alt}:{type:"link",url:o.url,title:o.title,children:e.children};return r.children[n]=t,[k.AM,n]}}}))}}const x=(e,t)=>{var n;if(!(t.childCount>=1&&"hardbreak"===(null==(n=t.lastChild)?void 0:n.type.name)))return void e.next(t.content);const r=[];t.content.forEach(((e,n,o)=>{o!==t.childCount-1&&r.push(e)})),e.next(s.HY.fromArray(r))},C=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e),S=(0,r.we)("emphasis");C(S,{displayName:"Attr<emphasis>",group:"Emphasis"});const M=(0,r.c8)("emphasis",(e=>({inclusive:!1,parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(S.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis")}}})));C(M.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),C(M.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const N=(0,r.r1)("ToggleEmphasis",(()=>()=>(0,i.w9)(M.type())));C(N,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const O=(0,r.Gv)("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(o.Xo);return()=>t.call(N.key)}}});C(O.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),C(O.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const T=(0,r.we)("strong");C(T,{displayName:"Attr<strong>",group:"Strong"});const A=(0,r.c8)("strong",(e=>({inclusive:!1,parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e}],toDOM:t=>["strong",e.get(T.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong")}}})));C(A.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),C(A.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const E=(0,r.r1)("ToggleStrong",(()=>()=>(0,i.w9)(A.type())));C(E,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const D=(0,r.Gv)("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(o.Xo);return()=>t.call(E.key)}}});C(D.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),C(D.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const I=(0,r.we)("inlineCode");C(I,{displayName:"Attr<inlineCode>",group:"InlineCode"});const F=(0,r.c8)("inlineCode",(e=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(I.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}})));C(F.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),C(F.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const R=(0,r.r1)("ToggleInlineCode",(()=>()=>(e,t)=>{const{selection:n,tr:r}=e;if(n.empty)return!1;const{from:o,to:i}=n;return e.doc.rangeHasMark(o,i,F.type())?(null==t||t(r.removeMark(o,i,F.type())),!0):(Object.keys(e.schema.marks).filter((e=>e!==F.type.name)).map((t=>e.schema.marks[t])).forEach((e=>{r.removeMark(o,i,e)})),null==t||t(r.addMark(o,i,F.type().create())),!0)}));C(R,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const z=(0,r.Gv)("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(o.Xo);return()=>t.call(R.key)}}});C(z.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),C(z.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const B=(0,r.we)("link");C(B,{displayName:"Attr<link>",group:"Link"});const P=(0,r.c8)("link",(e=>({attrs:{href:{},title:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(B.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,o=t.title;e.openMark(n,{href:r,title:o}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}})));C(P.mark,{displayName:"MarkSchema<link>",group:"Link"});const L=(0,r.r1)("ToggleLink",(()=>(e={})=>(0,i.w9)(P.type(),e)));C(L,{displayName:"Command<toggleLinkCommand>",group:"Link"});const $=(0,r.r1)("UpdateLink",(()=>(e={})=>(t,n)=>{if(!n)return!1;let r,o=-1;const{selection:i}=t,{from:s,to:l}=i;if(t.doc.nodesBetween(s,s===l?l+1:l,((e,t)=>{if(P.type().isInSet(e.marks))return r=e,o=t,!1})),!r)return!1;const a=r.marks.find((({type:e})=>e===P.type()));if(!a)return!1;const c=o,u=o+r.nodeSize,{tr:h}=t,d=P.type().create({...a.attrs,...e});return!!d&&(n(h.removeMark(c,u,a).addMark(c,u,d).setSelection(new p.Bs(h.selection.$anchor)).scrollIntoView()),!0)}));C($,{displayName:"Command<updateLinkCommand>",group:"Link"});const j=(0,r.qT)("doc",(()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}})));C(j,{displayName:"NodeSchema<doc>",group:"Doc"});const H=(0,r.jO)("paragraph");C(H,{displayName:"Attr<paragraph>",group:"Paragraph"});const V=(0,r.yU)("paragraph",(e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(H.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),x(e,t),e.closeNode()}}})));C(V.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),C(V.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const _=(0,r.r1)("TurnIntoText",(()=>()=>(0,i.uJ)(V.type())));C(_,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const W=(0,r.Gv)("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(o.Xo);return()=>t.call(_.key)}}});C(W.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),C(W.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const q=Array(6).fill(0).map(((e,t)=>t+1)),K=(0,r.Tu)((e=>d(e.textContent)),"headingIdGenerator");C(K,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const Y=(0,r.jO)("heading");C(Y,{displayName:"Attr<heading>",group:"Heading"});const U=(0,r.yU)("heading",(e=>{const t=e.get(K.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:""},level:{default:1}},parseDOM:q.map((e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw(0,l.GZ)(t);return{level:e,id:t.id}}}))),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Y.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),x(e,t),e.closeNode()}}}}));C(U.node,{displayName:"NodeSchema<heading>",group:"Heading"}),C(U.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const J=(0,r.Xt)((e=>(0,a.zK)(/^(?<hashes>#+)\s$/,U.type(),(t=>{var n,r;const i=(null==(r=null==(n=t.groups)?void 0:n.hashes)?void 0:r.length)||0,s=e.get(o.U7),{$from:l}=s.state.selection,a=l.node();if("heading"===a.type.name){let e=Number(a.attrs.level)+Number(i);return e>6&&(e=6),{level:e}}return{level:i}}))));C(J,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const G=(0,r.r1)("WrapInHeading",(()=>e=>(e??(e=1),e<1?(0,i.uJ)(V.type()):(0,i.uJ)(U.type(),{level:e}))));C(G,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const Z=(0,r.r1)("DowngradeHeading",(()=>()=>(e,t,n)=>{const{$from:r}=e.selection,o=r.node();if(o.type!==U.type()||!e.selection.empty||0!==r.parentOffset)return!1;const s=o.attrs.level-1;return s?(null==t||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):(0,i.uJ)(V.type())(e,t,n)}));C(Z,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const X=(0,r.Gv)("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,3)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,3)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(o.Xo);return()=>t.call(G.key,3)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(o.Xo);return()=>t.call(Z.key)}}});C(X.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),C(X.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const Q=(0,r.jO)("blockquote");C(Q,{displayName:"Attr<blockquote>",group:"Blockquote"});const ee=(0,r.yU)("blockquote",(e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Q.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}})));C(ee.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),C(ee.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const te=(0,r.Xt)((()=>(0,a.S0)(/^\s*>\s$/,ee.type())));C(te,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const ne=(0,r.r1)("WrapInBlockquote",(()=>()=>(0,i.ym)(ee.type())));C(ne,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const re=(0,r.Gv)("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(o.Xo);return()=>t.call(ne.key)}}});C(re.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),C(re.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const oe=(0,r.jO)("codeBlock",(()=>({pre:{},code:{}})));C(oe,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const ie=(0,r.yU)("code_block",(e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(oe.key)(t);return["pre",{...n.pre,"data-language":t.attrs.language},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang,o=t.value;e.openNode(n,{language:r}),o&&e.addText(o),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{var n;e.addNode("code",void 0,(null==(n=t.content.firstChild)?void 0:n.text)||"",{lang:t.attrs.language})}}})));C(ie.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),C(ie.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const se=(0,r.Xt)((()=>(0,a.zK)(/^```(?<language>[a-z]*)?[\s\n]$/,ie.type(),(e=>{var t;return{language:(null==(t=e.groups)?void 0:t.language)??""}}))));C(se,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const le=(0,r.r1)("CreateCodeBlock",(()=>(e="")=>(0,i.uJ)(ie.type(),{language:e})));C(le,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),C((0,r.r1)("UpdateCodeBlockLanguage",(()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(null==r||r(n.tr.setNodeAttribute(e,"language",t)),!0))),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const ae=(0,r.Gv)("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(o.Xo);return()=>t.call(le.key)}}});C(ae.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),C(ae.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const ce=(0,r.jO)("image");C(ce,{displayName:"Attr<image>",group:"Image"});const ue=(0,r.yU)("image",(e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(ce.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,o=t.alt,i=t.title;e.addNode(n,{src:r,alt:o,title:i})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}})));C(ue.node,{displayName:"NodeSchema<image>",group:"Image"}),C(ue.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const he=(0,r.r1)("InsertImage",(()=>(e={})=>(t,n)=>{if(!n)return!0;const{src:r="",alt:o="",title:i=""}=e,s=ue.type().create({src:r,alt:o,title:i});return s&&n(t.tr.replaceSelectionWith(s).scrollIntoView()),!0}));C(he,{displayName:"Command<insertImageCommand>",group:"Image"});const de=(0,r.r1)("UpdateImage",(()=>(e={})=>(t,n)=>{const r=(0,f.a1)(t.selection,ue.type());if(!r)return!1;const{node:o,pos:i}=r,s={...o.attrs},{src:l,alt:a,title:c}=e;return void 0!==l&&(s.src=l),void 0!==a&&(s.alt=a),void 0!==c&&(s.title=c),null==n||n(t.tr.setNodeMarkup(i,void 0,s).scrollIntoView()),!0}));C(de,{displayName:"Command<updateImageCommand>",group:"Image"}),C((0,r.Xt)((()=>new a.VK(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,((e,t,n,r)=>{const[o,i,s="",l]=t;return o?e.tr.replaceWith(n,r,ue.type().create({src:s,alt:i,title:l})):null})))),{displayName:"InputRule<insertImageInputRule>",group:"Image"});const pe=(0,r.jO)("hardbreak",(e=>({"data-is-inline":e.attrs.isInline})));C(pe,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const fe=(0,r.yU)("hardbreak",(e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1}},selectable:!1,parseDOM:[{tag:"br"}],toDOM:t=>["br",e.get(pe.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{var r;e.addNode(n,{isInline:Boolean(null==(r=t.data)?void 0:r.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}})));C(fe.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),C(fe.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const me=(0,r.r1)("InsertHardbreak",(()=>()=>(e,t)=>{var n;const{selection:r,tr:o}=e;if(r.empty){const i=r.$from.node();if(i.childCount>0&&"hardbreak"===(null==(n=i.lastChild)?void 0:n.type.name))return null==t||t(o.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(p.Y1.near(o.doc.resolve(r.to))).scrollIntoView()),!0}return null==t||t(o.setMeta("hardbreak",!0).replaceSelectionWith(fe.type().create()).scrollIntoView()),!0}));C(me,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const ge=(0,r.Gv)("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(o.Xo);return()=>t.call(me.key)}}});C(ge.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),C(ge.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const ye=(0,r.jO)("hr");C(ye,{displayName:"Attr<hr>",group:"Hr"});const ke=(0,r.yU)("hr",(e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(ye.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}})));C(ke.node,{displayName:"NodeSchema<hr>",group:"Hr"}),C(ke.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const we=(0,r.Xt)((()=>new a.VK(/^(?:---|___\s|\*\*\*\s)$/,((e,t,n,r)=>{const{tr:o}=e;return t[0]&&o.replaceWith(n-1,r,ke.type().create()),o}))));C(we,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const ve=(0,r.r1)("InsertHr",(()=>()=>(e,t)=>{if(!t)return!0;const n=V.node.type().create(),{tr:r,selection:o}=e,{from:i}=o,s=ke.type().create();if(!s)return!0;const l=r.replaceSelectionWith(s).insert(i,n),a=p.Y1.findFrom(l.doc.resolve(i),1,!0);return a&&t(l.setSelection(a).scrollIntoView()),!0}));C(ve,{displayName:"Command<insertHrCommand>",group:"Hr"});const be=(0,r.jO)("bulletList");C(be,{displayName:"Attr<bulletList>",group:"BulletList"});const xe=(0,r.yU)("bullet_list",(e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{spread:e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(be.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:"true"===t.attrs.spread}).next(t.content).closeNode()}}})));C(xe.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),C(xe.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const Ce=(0,r.Xt)((()=>(0,a.S0)(/^\s*([-+*])\s$/,xe.type())));C(Ce,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const Se=(0,r.r1)("WrapInBulletList",(()=>()=>(0,i.ym)(xe.type())));C(Se,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Me=(0,r.Gv)("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(o.Xo);return()=>t.call(Se.key)}}});C(Me.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),C(Me.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const Ne=(0,r.jO)("orderedList");C(Ne,{displayName:"Attr<orderedList>",group:"OrderedList"});const Oe=(0,r.yU)("ordered_list",(e=>({content:"listItem+",group:"block",attrs:{order:{default:1},spread:{default:!1}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Ne.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Oe.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),C(Oe.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const Te=(0,r.Xt)((()=>(0,a.S0)(/^\s*(\d+)\.\s$/,Oe.type(),(e=>({order:Number(e[1])})),((e,t)=>t.childCount+t.attrs.order===Number(e[1])))));C(Te,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const Ae=(0,r.r1)("WrapInOrderedList",(()=>()=>(0,i.ym)(Oe.type())));C(Ae,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const Ee=(0,r.Gv)("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(o.Xo);return()=>t.call(Ae.key)}}});C(Ee.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),C(Ee.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const De=(0,r.jO)("listItem");C(De,{displayName:"Attr<listItem>",group:"ListItem"});const Ie=(0,r.yU)("list_item",(e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•"},listType:{default:"bullet"},spread:{default:"true"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,l.GZ)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread}}}],toDOM:t=>["li",{...e.get(De.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",o=null!=t.label?"ordered":"bullet",i=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:o,spread:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}})));C(Ie.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),C(Ie.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Fe=(0,r.r1)("SinkListItem",(()=>()=>{return e=Ie.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));if(!i)return!1;let l=i.startIndex;if(0==l)return!1;let a=i.parent,c=a.child(l-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==a.type,o=s.HY.from(r?e.create():null),l=new s.p2(s.HY.from(e.create(null,s.HY.from(a.type.create(null,o)))),r?3:1,0),u=i.start,h=i.end;n(t.tr.step(new m.FC(u-(r?3:1),h,u,h,l,1,!0)).scrollIntoView())}return!0};var e}));C(Fe,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Re=(0,r.r1)("SplitListItem",(()=>()=>{return e=Ie.type(),function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,l=r.$to.end(r.depth);i<l&&(o.step(new m.FC(i-1,l,i,l,new s.p2(s.HY.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new s.Ts(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const a=(0,m.k9)(r);if(null==a)return!1;o.lift(r,a);let c=o.mapping.map(i,-1)-1;return(0,m.Mn)(o.doc,c)&&o.join(c),t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),l=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,c=n.endIndex==o.childCount,u=i.node(-1),h=i.index(-1);if(!u.canReplace(h+(a?0:1),h+1,l.content.append(c?s.HY.empty:s.HY.from(o))))return!1;let d=i.pos,p=d+l.nodeSize;return r.step(new m.FC(d-(a?1:0),p+(c?1:0),d+1,p-1,new s.p2((a?s.HY.empty:s.HY.from(o.copy(s.HY.empty))).append(c?s.HY.empty:s.HY.from(o.copy(s.HY.empty))),a?0:1,c?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))};var e}));C(Re,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const ze=(0,r.r1)("SplitListItem",(()=>()=>{return e=Ie.type(),function(t,n){let{$from:r,$to:o,node:i}=t.selection;if(i&&i.isBlock||r.depth<2||!r.sameParent(o))return!1;let l=r.node(-1);if(l.type!=e)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=e||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let o=s.HY.empty,i=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-i;e>=r.depth-3;e--)o=s.HY.from(r.node(e).copy(o));let l=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;o=o.append(s.HY.from(e.createAndFill()));let a=r.before(r.depth-(i-1)),c=t.tr.replace(a,r.after(-l),new s.p2(o,4-i,0)),u=-1;c.doc.nodesBetween(a,c.doc.content.size,((e,t)=>{if(u>-1)return!1;e.isTextblock&&0==e.content.size&&(u=t+1)})),u>-1&&c.setSelection(p.Y1.near(c.doc.resolve(u))),n(c.scrollIntoView())}return!0}let a=o.pos==r.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(r.pos,o.pos),u=a?[null,{type:a}]:void 0;return!!(0,m.Ax)(c.doc,r.pos,2,u)&&(n&&n(c.split(r.pos,2,u).scrollIntoView()),!0)};var e}));C(ze,{displayName:"Command<splitListItemCommand>",group:"ListItem"});const Be=(0,r.Gv)("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(o.Xo);return()=>t.call(ze.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(o.Xo);return()=>t.call(Fe.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(o.Xo);return()=>t.call(Re.key)}}});C(Be.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),C(Be.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const Pe=(0,r.qT)("text",(()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}})));C(Pe,{displayName:"NodeSchema<text>",group:"Text"});const Le=(0,r.jO)("html");C(Le,{displayName:"Attr<html>",group:"Html"});const $e=(0,r.yU)("html",(e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:""}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(Le.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}})));C($e.node,{displayName:"NodeSchema<html>",group:"Html"}),C($e.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const je=[j,H,V,K,Y,U,pe,fe,Q,ee,oe,ie,ye,ke,ce,ue,be,xe,Ne,Oe,De,Ie,S,M,T,A,I,F,B,P,Le,$e,Pe].flat(),He=[te,Ce,Te,se,we,J].flat(),Ve=[_,ne,G,Z,le,me,ve,he,de,Ae,Se,Fe,ze,Re,N,R,E,L,$],_e=[re,ae,ge,X,Be,Ee,Me,W,O,z,D].flat(),We=/\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/,qe=e=>{let t=e,n=t.match(We);for(;n&&n.groups;){const{span:e}=n.groups;t=t.replace(We,e),n=t.match(We)}return t},Ke=(e,t,n)=>{const r=e.split(""),o=r[t];return r[t]&&r[n]&&(r[t]=r[n],r[n]=o),r.join("").toString()},Ye={placeholderConfig:{hole:"∅",punctuation:"⁂",char:"∴"},globalNodes:["footnote_definition"],shouldSyncNode:({prevNode:e,nextNode:t})=>e.inlineContent&&t&&e.type===t.type&&!e.eq(t),movePlaceholder:(e,t)=>{const n=["*","_"];let r=t.indexOf(e);for(;n.includes(t[r-1]||"")&&n.includes(t[r+1]||"");)t=Ke(t,r,r+1),r+=1;return t}},Ue=(0,r.Tu)(Ye,"inlineSyncConfig");C(Ue,{displayName:"Ctx<inlineSyncConfig>",group:"Prose"});const Je=e=>e.split("\n\n")[0]||"",Ge=(e,t)=>{try{const n=((e,t)=>{const{globalNodes:n}=e.get(Ue.key),r=[];return t.doc.descendants((e=>{if(n.includes(e.type.name)||n.includes(e.type))return r.push(e),!1})),r})(e,t),i=(e=>e.selection.$from.node())(t),s=((e,t,n,r)=>e.get(o.Ck)(t.schema.topNodeType.create(void 0,[n,...r])))(e,t,i,n),[l,a]=((e,t)=>{const n=e.get(Ue.key),o=n.placeholderConfig.hole,[i="",...s]=t.split("\n\n");let l=(0,r.zG)((e=>t=>t.replace((e=>new RegExp(`\\\\(?=[^\\w\\s${e}\\\\]|_)`,"g"))(e),""))(o),(e=>n.movePlaceholder(o,e)),qe)(i);const a=(e=>t=>{const n=t.indexOf(e.hole),r=t.charAt(n-1),o=t.charAt(n+1),i=/[^\w]|_/;return o?r&&i.test(r)&&i.test(o)?e.punctuation:e.char:e.punctuation})(n.placeholderConfig)(l);return l=l.replace(o,a),l=[l,...s].join("\n\n"),[l,a]})(e,s),c=((e,t)=>{const n=e.get(o._z)(t);return n?n.firstChild:null})(e,l);return!c||i.type!==c.type||(e=>1===e.childCount&&"html"===e.child(0).type.name)(c)?null:(c.attrs={...i.attrs},c.descendants((e=>{var t;const n=e.marks.find((e=>"link"===e.type.name));n&&(null==(t=e.text)?void 0:t.includes(a))&&n.attrs.href.includes(a)&&(n.attrs.href=n.attrs.href.replace(a,""))})),{text:Je(l),prevNode:i,nextNode:c,placeholder:a})}catch{return null}},Ze=(0,r.x6)((e=>{let t=null;const n=new p.H$("MILKDOWN_INLINE_SYNC");return new p.Sy({key:n,state:{init:()=>null,apply:(r,i,s,l)=>{var a;const c=e.get(o.U7);if(null==(a=c.hasFocus)||!a.call(c)||!c.editable||!r.docChanged||r.getMeta(n))return null;const u=Ge(e,l);if(!u)return null;t&&(cancelAnimationFrame(t),t=null);const{prevNode:h,nextNode:d,text:f}=u,{shouldSyncNode:m}=e.get(Ue.key);return m({prevNode:h,nextNode:d,ctx:e,tr:r,text:f})&&(t=requestAnimationFrame((()=>{t=null;const{dispatch:r,state:i}=e.get(o.U7);((e,t,n,r,o)=>{const{placeholderConfig:i}=e.get(Ue.key),s=i.hole;let l=n.tr.setMeta(t,!0).insertText(s,n.selection.from);const a=n.apply(l),c=Ge(e,a);if(!c)return;const{$from:u}=a.selection,h=u.before(),d=u.after(),f=((e,t,n)=>{let r=t,o=!1;return e.descendants((e=>{var t;if(o)return!1;if(e.isText){const i=null==(t=e.text)?void 0:t.indexOf(n);if(null!=i&&i>=0)return o=!0,r+=i,!1}r+=e.nodeSize})),r})(c.nextNode,h,c.placeholder);l=l.replaceWith(h,d,c.nextNode).setNodeMarkup(h,void 0,o).delete(f+1,f+2),l=l.setSelection(p.Bs.near(l.doc.resolve(f+1))),r(l)})(e,n,i,r,h.attrs)})),r.setMeta("addToHistory",!1)),null}}})}));C(Ze,{displayName:"Prose<inlineSyncPlugin>",group:"Prose"});const Xe=(0,r.te)((()=>()=>e=>{(0,y.Vn)(e,"list",(e=>{if(e.ordered){const t=e.start??1;e.children.forEach(((e,n)=>{e.label=n+t}))}}))}));C(Xe,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});const Qe=(0,r.te)((()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;(0,y.Vn)(e,"text",((e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const o=[];let i=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;i!==n&&o.push({type:"text",value:e.value.slice(i,n)}),o.push({type:"break",data:{isInline:!0}}),i=n+s[0].length,s=t.exec(e.value)}return o.length>0&&r&&"number"==typeof n?(i<e.value.length&&o.push({type:"text",value:e.value.slice(i)}),r.children.splice(n,1,...o),n+o.length):void 0}))}));C(Qe,{displayName:"Remark<remarkLineBreak>",group:"Remark"});const et=(0,r.te)((()=>b));C(et,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});const tt=(0,r.te)((()=>()=>e=>{!function(e,t){(function e(t,n,r){if((e=>!!e.children)(t)){const n=[];for(let r=0,o=t.children.length;r<o;r++){const o=t.children[r];if(o){const i=e(o,r,t);if(i)for(let e=0,t=i.length;e<t;e++){const t=i[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>(e=>"html"===e.type)(e)?("root"===(null==n?void 0:n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])(t,0,r)})(e,0,null)[0]}(e)}));C(tt,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});const nt=(0,r.x6)((()=>{let e=!1;const t=new p.H$("MILKDOWN_INLINE_NODES_CURSOR"),n=new p.Sy({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame((()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}})),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=g.p.widget(t,n,{side:-1}),o=document.createElement("span"),i=g.p.widget(t,o);return setTimeout((()=>{n.contentEditable="true",o.contentEditable="true"})),g.EH.create(e.doc,[r,i])}return g.EH.empty}}});return n}));C(nt,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const rt=(0,r.x6)((()=>new p.Sy({key:new p.H$("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,n)=>{if(!e.length)return;const[r]=e;if(!r)return;const[o]=r.steps;if(r.getMeta("hardbreak")){if(!(o instanceof m.Pu))return;const{from:e}=o;return n.tr.setNodeMarkup(e,fe.type(),void 0,[])}if(o instanceof m.WJ){let e=n.tr;const{from:t,to:r}=o;return n.doc.nodesBetween(t,r,((t,n)=>{t.type===fe.type()&&(e=e.setNodeMarkup(n,fe.type(),void 0,[]))})),e}}})));C(rt,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const ot=(0,r.Tu)(["table","code_block"],"hardbreakFilterNodes");C(ot,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const it=(0,r.x6)((e=>{const t=e.get(ot.key);return new p.Sy({key:new p.H$("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[o]=e.steps;if(r&&o){const{from:e}=o,r=n.doc.resolve(e);let i=r.depth,s=!0;for(;i>0;)t.includes(r.node(i).type.name)&&(s=!1),i--;return s}return!0}})}));C(it,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const st=(0,r.x6)((e=>{const t=new p.H$("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing||!n.editable)return;const r=e.get(K.key),o=n.state.tr.setMeta("addToHistory",!1);let i=!1;n.state.doc.descendants(((e,n)=>{if(e.type===U.type()){if(0===e.textContent.trim().length)return;const s=e.attrs,l=r(e);s.id!==l&&(i=!0,o.setMeta(t,!0).setNodeMarkup(n,void 0,{...s,id:l}))}})),i&&n.dispatch(o)};return new p.Sy({key:t,view:e=>(n(e),{update:e=>{n(e)}})})}));C(st,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const lt=(0,r.x6)((()=>{const e=e=>{if(e.composing||!e.editable)return;const t=Oe.type(),n=xe.type(),r=Ie.type(),o=e.state,i=(e,t)=>{let n=!1;const r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n};let s=o.tr,l=!1;o.doc.descendants(((e,o,a,c)=>{if(e.type===n){const n=e.maybeChild(0);(null==n?void 0:n.type)===r&&"ordered"===n.attrs.listType&&(l=!0,s.setNodeMarkup(o,t,{spread:"true"}),e.descendants(((e,t,n,o)=>{if(e.type===r){const n={...e.attrs};i(n,o)&&(s=s.setNodeMarkup(t,void 0,n))}return!1})))}else if(e.type===r&&(null==a?void 0:a.type)===t){const t={...e.attrs};let n=!1;"ordered"!==t.listType&&(t.listType="ordered",n=!0),(null==a?void 0:a.maybeChild(0))&&(n=i(t,c)),n&&(s=s.setNodeMarkup(o,void 0,t),l=!0)}})),l&&e.dispatch(s.setMeta("addToHistory",!1))};return new p.Sy({key:new p.H$("MILKDOWN_KEEP_LIST_ORDER"),view:t=>(e(t),{update:t=>{e(t)}})})}));C(lt,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const at=[je,He,Ve,_e,[Ue,Ze,rt,ot,it,nt,Xe,et,Qe,tt,st,lt]].flat()},6784:(e,t,n)=>{"use strict";n.d(t,{r0:()=>Zn,Jp:()=>Sn,S2:()=>Xt});var r,o,i=n(870),s=n(3991),l=n(8892),a=n(948),c=n(8858),u=n(7191),h=n(2665),d=n(2780),p=n(840),f=n(6151);if("undefined"!=typeof WeakMap){let e=new WeakMap;r=t=>e.get(t),o=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;r=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},o=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var m=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(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(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:l,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return r(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let l=0,a=0;l<n;l++){const c=e.child(l);a++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const u=c.child(e),{colspan:h,rowspan:d,colwidth:p}=u.attrs;for(let e=0;e<d;e++){if(e+l>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:a,n:d-e});break}const c=o+e*t;for(let e=0;e<h;e++){0==r[c+e]?r[c+e]=a:(i||(i=[])).push({type:"collision",row:l,pos:a,n:h-e});const n=p&&p[e];if(n){const r=(c+e)%t*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+=h,a+=u.nodeSize}const u=(l+1)*t;let h=0;for(;o<u;)0==r[o++]&&h++;h&&(i||(i=[])).push({type:"missing",row:l,n:h}),a++}const l=new m(t,n,r,i);let a=!1;for(let e=0;!a&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(a=!0);return a&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.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=t[(o+n)%e.width*2];null==r||a.colwidth&&a.colwidth[n]==r||((l||(l=g(a)))[n]=r)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}(l,s,e),l}(e))}};function g(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function y(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((e=>Number(e))):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function k(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function w(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}var v=new u.H$("selectingCells");function b(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function x(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function C(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=b(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function S(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function M(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function N(e,t,n){const r=e.node(-1),o=m.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function O(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((e=>e>0))||(r.colwidth=null)),r}function T(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var A=class extends u.Y1{constructor(e,t=e){const n=e.node(-1),r=m.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),s=e.node(0),l=r.cellsInRect(i).filter((e=>e!=t.pos-o));l.unshift(t.pos-o);const a=l.map((e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new u.xm(s.resolve(r),s.resolve(r+t.content.size))}));super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(S(n)&&S(r)&&M(n,r)){const e=this.$anchorCell.node(-1)!=n.node(-1);return e&&this.isRowSelection()?A.rowSelection(n,r):e&&this.isColSelection()?A.colSelection(n,r):new A(n,r)}return u.Bs.between(n,r)}content(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const s=[];for(let i=n*t.width+r.left,l=r.left;l<r.right;l++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const l=t.findCell(n);let a=e.nodeAt(n);if(!a)throw RangeError(`No cell with offset ${n} found`);const c=r.left-l.left,u=l.right-r.right;if(c>0||u>0){let e=a.attrs;if(c>0&&(e=O(e,0,c)),u>0&&(e=O(e,e.colspan-u,u)),l.left<r.left){if(a=a.type.createAndFill(e),!a)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else a=a.type.create(e,a.content)}if(l.top<r.top||l.bottom>r.bottom){const e={...a.attrs,rowspan:Math.min(l.bottom,r.bottom)-Math.max(l.top,r.top)};a=l.top<r.top?a.type.createAndFill(e):a.type.create(e,a.content)}s.push(a)}i.push(e.child(n).copy(h.HY.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:i;return new h.p2(h.HY.from(s),1,1)}replace(e,t=h.p2.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:s}=r[o],l=e.mapping.slice(n);e.replace(l.map(i.pos),l.map(s.pos),o?h.p2.empty:t)}const o=u.Y1.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new h.p2(h.HY.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=m.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),r=m.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),l=e.node(0);return i.top<=s.top?(i.top>0&&(e=l.resolve(o+r.map[i.left])),s.bottom<r.height&&(t=l.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(t=l.resolve(o+r.map[s.left])),i.bottom<r.height&&(e=l.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new A(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.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)==t.width}eq(e){return e instanceof A&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),r=m.get(n),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),l=e.node(0);return i.left<=s.left?(i.left>0&&(e=l.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(t=l.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(t=l.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(e=l.resolve(o+r.map[r.width*(i.top+1)-1]))),new A(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new A(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new A(e.resolve(t),e.resolve(n))}getBookmark(){return new E(this.$anchorCell.pos,this.$headCell.pos)}};A.prototype.visible=!1,u.Y1.jsonID("cell",A);var E=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new E(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&M(t,n)?new A(t,n):u.Y1.near(n,1)}};function D(e){if(!(e.selection instanceof A))return null;const t=[];return e.selection.forEachCell(((e,n)=>{t.push(d.p.node(n,n+e.nodeSize,{class:"selectedCell"}))})),d.EH.create(e.doc,t)}var I=new u.H$("fix-tables");function F(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,l=0;s<i;s++){const i=t.child(s);for(let t=l,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){l=t+1,n+=i.nodeSize;continue e}r(i,n),l<o&&e.child(l).sameMarkup(i)?F(e.child(l),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function R(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=m.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const s=o.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,O(o,o.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}}let s,l;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),l=e);for(let a=0,c=n+1;a<o.height;a++){const n=t.child(a),o=c+n.nodeSize,u=i[a];if(u>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<u;n++){const n=w(e.schema)[t].createAndFill();n&&i.push(n)}const h=0!=a&&s!=a-1||l!=a?o-1:c+1;r.insert(r.mapping.map(h),i)}c=o}return r.setMeta(I,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&F(t.doc,e.doc,0,r):e.doc.descendants(r),n}function z(e,t){const n=e.createAndFill();return new f.wx(n).replace(0,n.content.size,t).doc}function B(e,t,n,r,o,i,s,l){if(0==s||s==t.height)return!1;let a=!1;for(let c=o;c<i;c++){const o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){a=!0;const o=n.nodeAt(i),{top:u,left:h}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(l).map(i+r),null,{...o.attrs,rowspan:s-u}),e.insert(e.mapping.slice(l).map(t.positionAt(s,h,n)),o.type.createAndFill({...o.attrs,rowspan:u+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return a}function P(e,t,n,r,o,i,s,l){if(0==s||s==t.width)return!1;let a=!1;for(let c=o;c<i;c++){const o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){a=!0;const o=n.nodeAt(i),u=t.colCount(i),h=e.mapping.slice(l).map(i+r);e.setNodeMarkup(h,null,O(o.attrs,s-u,o.attrs.colspan-(s-u))),e.insert(h+o.nodeSize,o.type.createAndFill(O(o.attrs,0,s-u))),c+=o.attrs.rowspan-1}}return a}function L(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let s=m.get(i);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=e.tr;let p=0;function f(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=m.get(i),p=d.mapping.maps.length}(function(e,t,n,r,o,i,s){const l=w(e.doc.type.schema);let a,c;if(o>t.width)for(let i=0,u=0;i<t.height;i++){const h=n.child(i);u+=h.nodeSize;const d=[];let p;p=null==h.lastChild||h.lastChild.type==l.cell?a||(a=l.cell.createAndFill()):c||(c=l.header_cell.createAndFill());for(let e=t.width;e<o;e++)d.push(p);e.insert(e.mapping.slice(s).map(u-1+r),d)}if(i>t.height){const u=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;u.push(o?c||(c=l.header_cell.createAndFill()):a||(a=l.cell.createAndFill()))}const d=l.row.create(null,h.HY.from(u)),p=[];for(let e=t.height;e<i;e++)p.push(d);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),p)}return!(!a&&!c)})(d,s,i,n,c,u,p)&&f(),B(d,s,i,n,a,c,l,p)&&f(),B(d,s,i,n,a,c,u,p)&&f(),P(d,s,i,n,l,u,a,p)&&f(),P(d,s,i,n,l,u,c,p)&&f();for(let e=l;e<u;e++){const t=s.positionAt(e,a,i),r=s.positionAt(e,c,i);d.replace(d.mapping.slice(p).map(t+n),d.mapping.slice(p).map(r+n),new h.p2(o.rows[e-l],0,0))}f(),d.setSelection(new A(d.doc.resolve(n+s.positionAt(l,a,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),t(d)}var $=(0,p.$)({ArrowLeft:H("horiz",-1),ArrowRight:H("horiz",1),ArrowUp:H("vert",-1),ArrowDown:H("vert",1),"Shift-ArrowLeft":V("horiz",-1),"Shift-ArrowRight":V("horiz",1),"Shift-ArrowUp":V("vert",-1),"Shift-ArrowDown":V("vert",1),Backspace:_,"Mod-Backspace":_,Delete:_,"Mod-Delete":_});function j(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function H(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof A)return j(n,r,u.Y1.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const s=Y(o,e,t);if(null==s)return!1;if("horiz"==e)return j(n,r,u.Y1.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(s),i=N(o,e,t);let l;return l=i?u.Y1.near(i,1):t<0?u.Y1.near(n.doc.resolve(o.before(-1)),-1):u.Y1.near(n.doc.resolve(o.after(-1)),1),j(n,r,l)}}}function V(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof A)s=i;else{const r=Y(o,e,t);if(null==r)return!1;s=new A(n.doc.resolve(r))}const l=N(s.$headCell,e,t);return!!l&&j(n,r,new A(s.$anchorCell,l))}}function _(e,t){const n=e.selection;if(!(n instanceof A))return!1;if(t){const r=e.tr,o=w(e.schema).cell.createAndFill().content;n.forEachCell(((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new h.p2(o,0,0))})),r.docChanged&&t(r)}return!0}function W(e,t){const n=b(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new A(n))),!0)}function q(e,t,n){if(!x(e.state))return!1;let r=function(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),a=e<t.childCount-1?0:Math.max(0,r-1);(i||a)&&(o=z(w(s).row,new h.p2(o,i,a)).content),l.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?z(w(s).row,new h.p2(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(h.HY.empty),n[o]<r){const i=w(e).cell.createAndFill(),s=[];for(let e=n[o];e<r;e++)s.push(i);t[o]=t[o].append(h.HY.from(s))}return{height:t.length,width:r,rows:t}}(s,l)}(n);const o=e.state.selection;if(o instanceof A){r||(r={width:1,height:1,rows:[h.HY.from(z(w(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),s=m.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],s=[];for(let n=t[e]||0,o=0;n<r;o++){let l=i.child(o%i.childCount);n+l.attrs.colspan>r&&(l=l.type.createChecked(O(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++)t[e+n]=(t[e+n]||0)+l.attrs.colspan}o.push(h.HY.from(s))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const s=[],l=n[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),s.push(t)}e.push(h.HY.from(s))}n=e,t=o}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),L(e.state,e.dispatch,i,s,r),!0}if(r){const t=C(e.state),n=t.start(-1);return L(e.state,e.dispatch,n,m.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function K(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=U(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof A)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=b(e.state.selection.$anchor))&&(null==(n=J(e,t))?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=J(e,n);const o=null==v.getState(e.state);if(!r||!M(t,r)){if(!o)return;r=t}const i=new A(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(v,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",l),null!=v.getState(e.state)&&e.dispatch(e.state.tr.setMeta(v,-1))}function l(n){const o=n,l=v.getState(e.state);let a;if(null!=l)a=e.state.doc.resolve(l);else if(U(e,o.target)!=r&&(a=J(e,t),!a))return s();a&&i(a,o)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",l)}function Y(e,t,n){if(!(e.state.selection instanceof u.Bs))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(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"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function U(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function J(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?b(e.state.doc.resolve(n.pos)):null}var G=class{constructor(e,t){this.node=e,this.cellMinWidth=t,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")),Z(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,Z(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function Z(e,t,n,r,o,i){var s;let l=0,a=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){const{colspan:s,colwidth:h}=u.child(e).attrs;for(let e=0;e<s;e++,n++){const s=o==n?i:h&&h[e],u=s?s+"px":"";l+=s||r,s||(a=!1),c?(c.style.width!=u&&(c.style.width=u),c=c.nextSibling):t.appendChild(document.createElement("col")).style.width=u}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var X=new u.H$("tableColumnResizing");var Q=class{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,n=e.getMeta(X);if(n&&null!=n.setHandle)return new Q(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new Q(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let n=e.mapping.map(t.activeHandle,-1);return S(e.doc.resolve(n))||(n=-1),new Q(n,t.dragging)}return t}};function ee(e,t,n){const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;const{pos:o}=r,i=b(e.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;const s=m.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 te(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function ne(e,t){e.dispatch(e.state.tr.setMeta(X,{setHandle:t}))}function re(e){const t=e.selection,n=C(e),r=n.node(-1),o=n.start(-1),i=m.get(r);return{...t instanceof A?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function oe(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){const r=w(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){const l=s*t.width+o;if(o>0&&o<t.width&&t.map[l-1]==t.map[l]){const i=t.map[l],a=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,T(a.attrs,o-t.colCount(i))),s+=a.attrs.rowspan-1}else{const a=null==i?w(r.type.schema).cell:r.nodeAt(t.map[l+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function ie(e,t){if(!x(e))return!1;if(t){const n=re(e);t(oe(e.tr,n,n.left))}return!0}function se(e,t){if(!x(e))return!1;if(t){const n=re(e);t(oe(e.tr,n,n.right))}return!0}function le(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const l=s*t.width+o,a=t.map[l],c=n.nodeAt(a),u=c.attrs;if(o>0&&t.map[l-1]==a||o<t.width-1&&t.map[l+1]==a)e.setNodeMarkup(e.mapping.slice(i).map(r+a),null,O(u,o-t.colCount(a)));else{const t=e.mapping.slice(i).map(r+a);e.delete(t,t+c.nodeSize)}s+=u.rowspan}}function ae(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const s=i+n.child(o).nodeSize,l=e.mapping.maps.length;e.delete(i+r,s+r);for(let i=0,s=o*t.width;i<t.width;i++,s++){const a=t.map[s];if(o>0&&a==t.map[s-t.width]){const t=n.nodeAt(a).attrs;e.setNodeMarkup(e.mapping.slice(l).map(a+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.width&&a==t.map[s+t.width]){const s=n.nodeAt(a),c=s.attrs,u=s.type.create({...c,rowspan:s.attrs.rowspan-1},s.content),h=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(l).map(r+h),u),i+=c.colspan-1}}}function ce(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function ue(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=re(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map((e=>o.table.nodeAt(e)));for(let e=0;e<s.length;e++)l[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,l[e].attrs);if(0==i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,l[e].attrs);n(i)}return!0}}(e):function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=re(t),i=t.tr,s=ce("row",o,r),l=ce("column",o,r),a=("column"===e?s:"row"===e&&l)?1:0,c="column"==e?{left:0,top:a,right:1,bottom:o.map.height}:"row"==e?{left:a,top:0,right:o.map.width,bottom:1}:o,u="column"==e?l?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}function he(e){return function(t,n){if(!x(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(C(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(u.Bs.between(e,(o=e,o.node(0).resolve(o.pos+o.nodeAfter.nodeSize)))).scrollIntoView())}var o;return!0}}ue("row",{useDeprecatedLogic:!0}),ue("column",{useDeprecatedLogic:!0}),ue("cell",{useDeprecatedLogic:!0});var de=n(4285),pe=n(737),fe=n(7842),me=n(5185);const ge={tokenize:function(e,t,n){let r=0;return function t(i){return(87===i||119===i)&&r<3?(r++,e.consume(i),t):46===i&&3===r?(e.consume(i),o):n(i)};function o(e){return null===e?n(e):t(e)}},partial:!0},ye={tokenize:function(e,t,n){let r,o,i;return s;function s(t){return 46===t||95===t?e.check(we,a,l)(t):null===t||(0,me.z3)(t)||(0,me.B8)(t)||45!==t&&(0,me.Xh)(t)?a(t):(i=!0,e.consume(t),s)}function l(t){return 95===t?r=!0:(o=r,r=void 0),e.consume(t),s}function a(e){return o||r||!i?n(e):t(e)}},partial:!0},ke={tokenize:function(e,t){let n=0,r=0;return o;function o(s){return 40===s?(n++,e.consume(s),o):41===s&&r<n?i(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(we,t,i)(s):null===s||(0,me.z3)(s)||(0,me.B8)(s)?t(s):(e.consume(s),o)}function i(t){return 41===t&&r++,e.consume(t),o}},partial:!0},we={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),i):93===s?(e.consume(s),o):60===s||null===s||(0,me.z3)(s)||(0,me.B8)(s)?t(s):n(s)}function o(e){return null===e||40===e||91===e||(0,me.z3)(e)||(0,me.B8)(e)?t(e):r(e)}function i(e){return(0,me.jv)(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):(0,me.jv)(t)?(e.consume(t),s):n(t)}},partial:!0},ve={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return(0,me.H$)(e)?n(e):t(e)}},partial:!0},be={tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!Oe.call(r,r.previous)||De(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ge,e.attempt(ye,e.attempt(ke,o),n),n)(t))};function o(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Oe},xe={tokenize:function(e,t,n){const r=this;let o="",i=!1;return function(t){return 72!==t&&104!==t||!Te.call(r,r.previous)||De(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(t),e.consume(t),s)};function s(t){if((0,me.jv)(t)&&o.length<5)return o+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=o.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),i?a:(i=!0,l)):n(t)}function a(t){return null===t||(0,me.Av)(t)||(0,me.z3)(t)||(0,me.B8)(t)||(0,me.Xh)(t)?n(t):e.attempt(ye,e.attempt(ke,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Te},Ce={tokenize:function(e,t,n){const r=this;let o,i;return function(t){return Ee(t)&&Ae.call(r,r.previous)&&!De(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return Ee(t)?(e.consume(t),s):64===t?(e.consume(t),l):n(t)}function l(t){return 46===t?e.check(ve,c,a)(t):45===t||95===t||(0,me.H$)(t)?(i=!0,e.consume(t),l):c(t)}function a(t){return e.consume(t),o=!0,l}function c(s){return i&&o&&(0,me.jv)(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:Ae},Se={},Me={text:Se};let Ne=48;for(;Ne<123;)Se[Ne]=Ce,Ne++,58===Ne?Ne=65:91===Ne&&(Ne=97);function Oe(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,me.z3)(e)}function Te(e){return!(0,me.jv)(e)}function Ae(e){return!(47===e||Ee(e))}function Ee(e){return 43===e||45===e||46===e||95===e||(0,me.H$)(e)}function De(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}Se[43]=Ce,Se[45]=Ce,Se[46]=Ce,Se[95]=Ce,Se[72]=[Ce,xe],Se[104]=[Ce,xe],Se[87]=[Ce,be],Se[119]=[Ce,be];var Ie=n(8466),Fe=n(2473),Re=n(6910);const ze={tokenize:function(e,t,n){const r=this;return(0,Fe.f)(e,(function(e){const o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function Be(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const e=r.events[o][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!s||!s._balanced)return n(o);const l=(0,Re.d)(r.sliceSerialize({start:s.end,end:r.now()}));return 94===l.codePointAt(0)&&i.includes(l.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)):n(o)}}function Pe(e,t){let n,r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[r+1],e[r+2],["enter",o,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",o,t]];return e.splice(r,e.length-r+1,...a),e}function Le(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",a)}function a(l){if(s>999||93===l&&!i||null===l||91===l||(0,me.z3)(l))return n(l);if(93===l){e.exit("chunkString");const i=e.exit("gfmFootnoteCallString");return o.includes((0,Re.d)(r.sliceSerialize(i)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return(0,me.z3)(l)||(i=!0),s++,e.consume(l),92===l?c:a}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,a):a(t)}}function $e(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s,l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),a};function a(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!s||null===t||91===t||(0,me.z3)(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,Re.d)(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return(0,me.z3)(t)||(s=!0),l++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(i)||o.push(i),(0,Fe.f)(e,d,"gfmFootnoteDefinitionWhitespace")):n(t)}function d(e){return t(e)}}function je(e,t,n){return e.check(Ie.w,t,e.attempt(ze,t,n))}function He(e){e.exit("gfmFootnoteDefinition")}var Ve=n(8391),_e=n(898),We=n(7828);function qe(e){let t=(e||{}).singleTilde;const n={tokenize:function(e,n,r){const o=this.previous,i=this.events;let s=0;return function(t){return 126===o&&"characterEscape"!==i[i.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),l(t))};function l(i){const a=(0,_e.r)(o);if(126===i)return s>1?r(i):(e.consume(i),s++,l);if(s<2&&!t)return r(i);const c=e.exit("strikethroughSequenceTemporary"),u=(0,_e.r)(i);return c._open=!u||2===u&&Boolean(a),c._close=!a||2===a&&Boolean(u),n(i)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const o={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},i={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",o,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",i,t]],l=t.parser.constructs.insideSpan.null;l&&(0,Ve.d)(s,s.length,0,(0,We.C)(l,e.slice(r+1,n),t)),(0,Ve.d)(s,s.length,0,[["exit",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",o,t]]),(0,Ve.d)(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class Ke{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0!==n||0!==r.length){for(;o<e.map.length;){if(e.map[o][0]===t)return e.map[o][1]+=n,void e.map[o][2].push(...r);o+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(((e,t)=>e[0]-t[0])),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1])),n.push(this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}function Ye(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if("enter"===o[0])"tableContent"===o[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===o[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===o[1].type)break}else"enter"===o[0]&&"tableDelimiterRow"===o[1].type&&(n=!0);t+=1}return r}const Ue={flow:{null:{tokenize:function(e,t,n){const r=this;let o,i=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const o=t>-1?r.events[t][1].type:null,i="tableHead"===o||"tableRow"===o?v:l;return i===v&&r.parser.lazy[r.now().line]?n(e):i(e)};function l(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(o=!0,s+=1),a(e)}(t)}function a(t){return null===t?n(t):(0,me.Ch)(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h):n(t):(0,me.xz)(t)?(0,Fe.f)(e,a,"whitespace")(t):(s+=1,o&&(o=!1,i+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),o=!0,a):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||(0,me.z3)(t)?(e.exit("data"),a(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function h(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),o=!1,(0,me.xz)(t)?(0,Fe.f)(e,d,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):d(t))}function d(t){return 45===t||58===t?f(t):124===t?(o=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):w(t)}function p(t){return(0,me.xz)(t)?(0,Fe.f)(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||(0,me.Ch)(t)?k(t):w(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):w(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(t))}function y(t){return(0,me.xz)(t)?(0,Fe.f)(e,k,"whitespace")(t):k(t)}function k(n){return 124===n?d(n):(null===n||(0,me.Ch)(n))&&o&&i===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):w(n)}function w(e){return n(e)}function v(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||(0,me.Ch)(n)?(e.exit("tableRow"),t(n)):(0,me.xz)(n)?(0,Fe.f)(e,b,"whitespace")(n):(e.enter("data"),x(n))}function x(t){return null===t||124===t||(0,me.z3)(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?C:x)}function C(t){return 92===t||124===t?(e.consume(t),x):x(t)}},resolveAll:function(e,t){let n,r,o,i=-1,s=!0,l=0,a=[0,0,0,0],c=[0,0,0,0],u=!1,h=0;const d=new Ke;for(;++i<e.length;){const p=e[i],f=p[1];"enter"===p[0]?"tableHead"===f.type?(u=!1,0!==h&&(Ge(d,t,h,n,r),r=void 0,h=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(i,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,o=void 0,a=[0,0,0,0],c=[0,i+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(i,0,[["enter",r,t]])),l="tableDelimiterRow"===f.type?2:r?3:1):!l||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(s?s=!1:(0!==a[1]&&(c[0]=c[1],o=Je(d,t,a,l,void 0,o)),a=c,c=[a[1],i,0,0])):(s=!1,0===c[2]&&(0!==a[1]&&(c[0]=c[1],o=Je(d,t,a,l,void 0,o),a=[0,0,0,0]),c[2]=i)):"tableHead"===f.type?(u=!0,h=i):"tableRow"===f.type||"tableDelimiterRow"===f.type?(h=i,0!==a[1]?(c[0]=c[1],o=Je(d,t,a,l,i,o)):0!==c[1]&&(o=Je(d,t,c,l,i,o)),l=0):!l||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=i)}for(0!==h&&Ge(d,t,h,n,r),d.consume(t.events),i=-1;++i<t.events.length;){const e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=Ye(t.events,i))}return e}}}};function Je(e,t,n,r,o,i){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(i.end=Object.assign({},Ze(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Ze(t.events,n[1]);if(i={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),0!==n[2]){const o=Ze(t.events,n[2]),i=Ze(t.events,n[3]),s={type:"tableContent",start:Object.assign({},o),end:Object.assign({},i)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],o=t.events[n[3]];if(r[1].end=Object.assign({},o[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==o&&(i.end=Object.assign({},Ze(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function Ge(e,t,n,r,o){const i=[],s=Ze(t.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Ze(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Xe={tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),o):n(t)};function o(t){return(0,me.z3)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):n(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return(0,me.Ch)(r)?t(r):(0,me.xz)(r)?e.check({tokenize:et},t,n)(r):n(r)}}},Qe={text:{91:Xe}};function et(e,t,n){return(0,Fe.f)(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}function tt(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}var nt=n(3218),rt=n(1104),ot=n(7689);const it={}.hasOwnProperty;function st(e){return"string"==typeof e?new RegExp((0,nt.Z)(e),"g"):e}function lt(e){return"function"==typeof e?e:()=>e}const at="phrasing",ct=["autolink","link","image","label"],ut={transforms:[function(e){!function(e,t,n,r){let o,i;"string"==typeof t||t instanceof RegExp?(i=[[t,n]],o=r):(i=t,o=n),o||(o={});const s=(0,ot.O)(o.ignore||[]),l=function(e){const t=[];if("object"!=typeof e)throw new TypeError("Expected array or object as schema");if(Array.isArray(e)){let n=-1;for(;++n<e.length;)t.push([st(e[n][0]),lt(e[n][1])])}else{let n;for(n in e)it.call(e,n)&&t.push([st(n),lt(e[n])])}return t}(i);let a=-1;for(;++a<l.length;)(0,rt.S4)(e,"text",c);return e;function c(e,t){let n,r=-1;for(;++r<t.length;){const e=t[r];if(s(e,n?n.children.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=l[a][0],o=l[a][1];let i=0;const s=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let h=r.exec(e.value);for(;h;){const n=h.index,s={index:h.index,input:h.input,stack:[...t,e]};let l=o(...h,s);if("string"==typeof l&&(l=l.length>0?{type:"text",value:l}:void 0),!1!==l&&(i!==n&&u.push({type:"text",value:e.value.slice(i,n)}),Array.isArray(l)?u.push(...l):l&&u.push(l),i=n+h[0].length,c=!0),!r.global)break;h=r.exec(e.value)}return c?(i<e.value.length&&u.push({type:"text",value:e.value.slice(i)}),n.children.splice(s,1,...u)):u=[e],s+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pt],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ft]],{ignore:["link","linkReference"]})}],enter:{literalAutolink:function(e){this.enter({type:"link",title:null,url:"",children:[]},e)},literalAutolinkEmail:dt,literalAutolinkHttp:dt,literalAutolinkWww:dt},exit:{literalAutolink:function(e){this.exit(e)},literalAutolinkEmail:function(e){this.config.exit.autolinkEmail.call(this,e)},literalAutolinkHttp:function(e){this.config.exit.autolinkProtocol.call(this,e)},literalAutolinkWww:function(e){this.config.exit.data.call(this,e),this.stack[this.stack.length-1].url="http://"+this.sliceSerialize(e)}}},ht={unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:at,notInConstruct:ct},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:at,notInConstruct:ct},{character:":",before:"[ps]",after:"\\/",inConstruct:at,notInConstruct:ct}]};function dt(e){this.config.enter.autolinkProtocol.call(this,e)}function pt(e,t,n,r,o){let i="";if(!mt(o))return!1;if(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=tt(e,"(");let i=tt(e,")");for(;-1!==r&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}(n+r);if(!s[0])return!1;const l={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function ft(e,t,n,r){return!(!mt(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function mt(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,me.B8)(n)||(0,me.Xh)(n))&&(!t||47!==n)}var gt=n(2042),yt=n(736),kt=n(2312),wt=n(9836),vt=n(1969);function bt(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xt(){this.buffer()}function Ct(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,Re.d)(this.sliceSerialize(e)).toLowerCase()}function St(e){this.exit(e)}function Mt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Nt(){this.buffer()}function Ot(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,Re.d)(this.sliceSerialize(e)).toLowerCase()}function Tt(e){this.exit(e)}function At(e,t,n,r){const o=(0,vt.j)(r);let i=o.move("[^");const s=n.enter("footnoteReference"),l=n.enter("reference");return i+=o.move((0,wt.T)(n,(0,gt.L)(e),{...o.current(),before:i,after:"]"})),l(),s(),i+=o.move("]"),i}function Et(e,t,n,r){const o=(0,vt.j)(r);let i=o.move("[^");const s=n.enter("footnoteDefinition"),l=n.enter("label");return i+=o.move((0,wt.T)(n,(0,gt.L)(e),{...o.current(),before:i,after:"]"})),l(),i+=o.move("]:"+(e.children&&e.children.length>0?" ":"")),o.shift(4),i+=o.move((0,kt.Q)((0,yt.K)(e,n,o.current()),Dt)),s(),i}function Dt(e,t,n){return 0===t?e:(n?"":" ")+e}At.peek=function(){return"["};var It=n(5917);zt.peek=function(){return"~"};const Ft={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},Rt={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:zt}};function zt(e,t,n,r){const o=(0,vt.j)(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=(0,It.p)(e,n,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}var Bt=n(7875);function Pt(e){return e.length}function Lt(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}const $t={enter:{table:function(e){const t=e._align;this.enter({type:"table",align:t.map((e=>"none"===e?null:e)),children:[]},e),this.setData("inTable",!0)},tableData:Ht,tableHeader:Ht,tableRow:function(e){this.enter({type:"tableRow",children:[]},e)}},exit:{codeText:function(e){let t=this.resume();this.getData("inTable")&&(t=t.replace(/\\([\\|])/g,Vt)),this.stack[this.stack.length-1].value=t,this.exit(e)},table:function(e){this.exit(e),this.setData("inTable")},tableData:jt,tableHeader:jt,tableRow:jt}};function jt(e){this.exit(e)}function Ht(e){this.enter({type:"tableCell",children:[]},e)}function Vt(e,t){return"|"===t?t:e}function _t(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{table:function(e,t,n,r){return l(function(e,t,n){const r=e.children;let o=-1;const i=[],s=t.enter("table");for(;++o<r.length;)i[o]=a(r[o],t,n);return s(),i}(e,n,r),e.align)},tableRow:function(e,t,n,r){const o=l([a(e,n,r)]);return o.slice(0,o.indexOf("\n"))},tableCell:s,inlineCode:function(e,t,n){let r=(0,Bt.Y)(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r}}};function s(e,t,n,r){const o=n.enter("tableCell"),s=n.enter("phrasing"),l=(0,It.p)(e,n,{...r,before:i,after:i});return s(),o(),l}function l(e,t){return function(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||Pt,o=[],i=[],s=[],l=[];let a=0,c=-1;for(;++c<e.length;){const n=[],o=[];let h=-1;for(e[c].length>a&&(a=e[c].length);++h<e[c].length;){const i=null==(u=e[c][h])?"":String(u);if(!1!==t.alignDelimiters){const e=r(i);o[h]=e,(void 0===l[h]||e>l[h])&&(l[h]=e)}n.push(i)}i[c]=n,s[c]=o}var u;let h=-1;if("object"==typeof n&&"length"in n)for(;++h<a;)o[h]=Lt(n[h]);else{const e=Lt(n);for(;++h<a;)o[h]=e}h=-1;const d=[],p=[];for(;++h<a;){const e=o[h];let n="",r="";99===e?(n=":",r=":"):108===e?n=":":114===e&&(r=":");let i=!1===t.alignDelimiters?1:Math.max(1,l[h]-n.length-r.length);const s=n+"-".repeat(i)+r;!1!==t.alignDelimiters&&(i=n.length+i+r.length,i>l[h]&&(l[h]=i),p[h]=i),d[h]=s}i.splice(1,0,d),s.splice(1,0,p),c=-1;const f=[];for(;++c<i.length;){const e=i[c],n=s[c];h=-1;const r=[];for(;++h<a;){const i=e[h]||"";let s="",c="";if(!1!==t.alignDelimiters){const e=l[h]-(n[h]||0),t=o[h];114===t?s=" ".repeat(e):99===t?e%2?(s=" ".repeat(e/2+.5),c=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),c=s):c=" ".repeat(e)}!1===t.delimiterStart||h||r.push("|"),!1===t.padding||!1===t.alignDelimiters&&""===i||!1===t.delimiterStart&&!h||r.push(" "),!1!==t.alignDelimiters&&r.push(s),r.push(i),!1!==t.alignDelimiters&&r.push(c),!1!==t.padding&&r.push(" "),!1===t.delimiterEnd&&h===a-1||r.push("|")}f.push(!1===t.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return f.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:o})}function a(e,t,n){const r=e.children;let o=-1;const i=[],l=t.enter("tableRow");for(;++o<r.length;)i[o]=s(r[o],0,t,n);return l(),i}}var Wt=n(207);const qt={exit:{taskListCheckValueChecked:Yt,taskListCheckValueUnchecked:Yt,paragraph:function(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1],n=e.children[0];if(n&&"text"===n.type){const r=t.children;let o,i=-1;for(;++i<r.length;){const e=r[i];if("paragraph"===e.type){o=e;break}}o===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}}},Kt={unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:function(e,t,n,r){const o=e.children[0],i="boolean"==typeof e.checked&&o&&"paragraph"===o.type,s="["+(e.checked?"x":" ")+"] ",l=(0,vt.j)(r);i&&l.move(s);let a=(0,Wt.q)(e,t,n,{...r,...l.current()});return i&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,(function(e){return e+s}))),a}}};function Yt(e){this.stack[this.stack.length-2].checked="taskListCheckValueChecked"===e.type}function Ut(e={}){const t=this.data();function n(e,n){(t[e]?t[e]:t[e]=[]).push(n)}n("micromarkExtensions",function(e){return(0,fe.W)([Me,{document:{91:{tokenize:$e,continuation:{tokenize:je},exit:He}},text:{91:{tokenize:Le},93:{add:"after",tokenize:Be,resolveTo:Pe}}},qe(e),Ue,Qe])}(e)),n("fromMarkdownExtensions",[ut,{enter:{gfmFootnoteDefinition:bt,gfmFootnoteDefinitionLabelString:xt,gfmFootnoteCall:Mt,gfmFootnoteCallString:Nt},exit:{gfmFootnoteDefinition:St,gfmFootnoteDefinitionLabelString:Ct,gfmFootnoteCall:Tt,gfmFootnoteCallString:Ot}},Ft,$t,qt]),n("toMarkdownExtensions",function(e){return{extensions:[ht,{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:Et,footnoteReference:At}},Rt,_t(e),Kt]}}(e))}const Jt=(e,t)=>(Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e),Gt=(0,a.we)("strike_through");Jt(Gt,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const Zt=(0,a.c8)("strike_through",(e=>({inclusive:!1,parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(Gt.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}})));Jt(Zt.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),Jt(Zt.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const Xt=(0,a.r1)("ToggleStrikeThrough",(()=>()=>(0,pe.w9)(Zt.type())));Jt(Xt,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const Qt=(0,a.Gv)("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(c.Xo);return()=>t.call(Xt.key)}}});Jt(Qt.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),Jt(Qt.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const en=(e=3,t=3)=>{const n=Array(t).fill(0).map((()=>kn.type().createAndFill())),r=Array(t).fill(0).map((()=>wn.type().createAndFill())),o=Array(e).fill(0).map(((e,t)=>yn.type().create(null,0===t?r:n)));return gn.type().create(null,o)},tn=e=>(0,de.Kk)((e=>"table"===e.type.spec.tableRole))(e),nn=(e,t)=>{const n=tn(t);if(!n)return;const r=m.get(n.node);return e<0||e>=r.width?void 0:r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))},rn=(e,t)=>{const n=tn(t);if(!n)return;const r=m.get(n.node);return e<0||e>=r.height?void 0:r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map((e=>{const t=n.node.nodeAt(e);if(!t)return;const r=e+n.start;return{pos:r,start:r+1,node:t}})).filter((e=>null!=e))};function on(e,{map:t,tableStart:n,table:r},o){const i=Array(o).fill(0).reduce(((e,t,n)=>e+r.child(n).nodeSize),n),s=Array(t.width).fill(0).map(((e,n)=>{const o=r.nodeAt(t.map[n]);return kn.type().createAndFill({alignment:null==o?void 0:o.attrs.alignment})}));return e.insert(i,yn.type().create(null,s)),e}const sn=e=>t=>n=>{const r=tn(n.selection),o="row"===e;if(r){const e=m.get(r.node);if(t>=0&&t<(o?e.height:e.width)){const i=e.positionAt(o?t:e.height-1,o?e.width-1:t,r.node),s=n.doc.resolve(r.start+i),l=o?A.rowSelection:A.colSelection,a=e.positionAt(o?t:0,o?0:t,r.node),c=n.doc.resolve(r.start+a);return(0,de.zN)(n.setSelection(l(s,c)))}}return n},ln=sn("row"),an=sn("col"),cn=e=>e[0].map(((t,n)=>e.map((e=>e[n])))),un=(e,t)=>{const n=[],r=m.get(e);for(let o=0;o<r.height;o++){const i=e.child(o),s=[];for(let n=0;n<r.width;n++){if(!t[o][n])continue;const i=r.map[o*r.width+n],l=t[o][n],a=e.nodeAt(i).type.createChecked(Object.assign({},l.attrs),l.content,l.marks);s.push(a)}n.push(i.type.createChecked(i.attrs,s,i.marks))}return e.type.createChecked(e.attrs,n,e.marks)},hn=e=>{const t=m.get(e),n=[];for(let r=0;r<t.height;r++){const o=[],i={};for(let n=0;n<t.width;n++){const s=t.map[r*t.width+n],l=e.nodeAt(s),a=t.findCell(s);i[s]||a.top!==r?o.push(null):(i[s]=!0,o.push(l))}n.push(o)}return n},dn=(e,t,n,r)=>{const o=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),s=i.length%2==0?1:0;let l;return l=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-s+1:-1===o?n[0]:n[n.length-1]-s,e.splice(l,0,...i),e},pn=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--){const e=nn(o,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+o-1;t>=n&&(n=o),t>r&&(r=t)}))}for(let n=e;n<=r;n++){const e=nn(n,t.selection);e&&e.forEach((e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>r&&(r=t)}))}const o=[];for(let e=n;e<=r;e++){const n=nn(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=nn(n,t.selection),s=rn(0,t.selection),l=t.doc.resolve(i[i.length-1].pos);let a;for(let e=r;e>=n;e--){const n=nn(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){a=n[0];break}if(a)break}}return{$anchor:l,$head:t.doc.resolve(a.pos),indexes:o}},fn=(e,t)=>{let n=e,r=e;for(let o=e;o>=0;o--)rn(o,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+o-1;t>=n&&(n=o),t>r&&(r=t)}));for(let n=e;n<=r;n++)rn(n,t.selection).forEach((e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>r&&(r=t)}));const o=[];for(let e=n;e<=r;e++){const n=rn(e,t.selection);n&&n.length&&o.push(e)}n=o[0],r=o[o.length-1];const i=rn(n,t.selection),s=nn(0,t.selection),l=t.doc.resolve(i[i.length-1].pos);let a;for(let e=r;e>=n;e--){const n=rn(e,t.selection);if(n&&n.length){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){a=n[0];break}if(a)break}}return{$anchor:l,$head:t.doc.resolve(a.pos),indexes:o}};const mn=function(e){const t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const e in t)n[e]={default:t[e].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>y(e,t)}],toDOM:e=>["td",k(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>y(e,t)}],toDOM:e=>["th",k(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),gn=(0,a.yU)("table",(()=>({...mn.table,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,t)=>({...e,align:r,isHeader:0===t})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{var n;const r=null==(n=t.content.firstChild)?void 0:n.content;if(!r)return;const o=[];r.forEach((e=>{o.push(e.attrs.alignment)})),e.openNode("table",void 0,{align:o}),e.next(t.content),e.closeNode()}}})));Jt(gn.node,{displayName:"NodeSchema<table>",group:"Table"}),Jt(gn.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const yn=(0,a.yU)("table_row",(()=>({...mn.table_row,parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map(((e,n)=>({...e,align:r[n],isHeader:t.isHeader})));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{e.openNode("tableRow"),e.next(t.content),e.closeNode()}}})));Jt(yn.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),Jt(yn.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const kn=(0,a.yU)("table_cell",(()=>({...mn.table_cell,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}})));Jt(kn.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),Jt(kn.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const wn=(0,a.yU)("table_header",(()=>({...mn.table_header,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}})));Jt(wn.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),Jt(wn.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});const vn=(0,a.Xt)((()=>new l.VK(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,((e,t,n,r)=>{var o,i;const s=e.doc.resolve(n);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),gn.type()))return null;const l=en(Number(null==(o=t.groups)?void 0:o.row),Number(null==(i=t.groups)?void 0:i.col)),a=e.tr.replaceRangeWith(n,r,l).scrollIntoView();return a.setSelection(u.Bs.create(a.doc,n+3))}))));Jt(vn,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const bn=(0,a.r1)("GoToPrevTableCell",(()=>()=>he(-1)));Jt(bn,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const xn=(0,a.r1)("GoToNextTableCell",(()=>()=>he(1)));Jt(xn,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const Cn=(0,a.r1)("BreakTable",(()=>()=>(e,t)=>{if(!x(e))return!1;const{$head:n}=e.selection,r=n.after(),o=e.tr.replaceWith(r,r,s.F3.type().createAndFill());return o.setSelection(u.Y1.near(o.doc.resolve(r),1)).scrollIntoView(),null==t||t(o),!0}));Jt(Cn,{displayName:"Command<breakTableCommand>",group:"Table"});const Sn=(0,a.r1)("InsertTable",(()=>({row:e,col:t}={})=>(n,r)=>{const{selection:o,tr:i}=n,{from:s}=o,l=en(e,t),a=i.replaceSelectionWith(l),c=u.Y1.findFrom(a.doc.resolve(s),1,!0);return c&&(null==r||r(a.setSelection(c))),!0}));Jt(Sn,{displayName:"Command<insertTableCommand>",group:"Table"});const Mn=(0,a.r1)("MoveRow",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=tn(e.selection);if(!o)return e;const{indexes:i}=fn(t,e),{indexes:s}=fn(n,e);if(i.includes(n))return e;const l=((e,t,n,r)=>{let o=hn(e.node);return o=dn(o,t,n,0),un(e.node,o)})(o,i,s),a=(0,de.zN)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,l);if(!r)return a;const c=m.get(l),u=o.start,h=n,d=c.positionAt(h,c.width-1,l),p=a.doc.resolve(u+d),f=A.rowSelection,g=c.positionAt(h,0,l),y=a.doc.resolve(u+g);return a.setSelection(f(p,y))}(o,e??0,t??0,!0));return Boolean(i)}));Jt(Mn,{displayName:"Command<moveRowCommand>",group:"Table"});const Nn=(0,a.r1)("MoveCol",(()=>({from:e,to:t}={})=>(n,r)=>{const{tr:o}=n,i=null==r?void 0:r(function(e,t,n,r=!0){const o=tn(e.selection);if(!o)return e;const{indexes:i}=pn(t,e),{indexes:s}=pn(n,e);if(i.includes(n))return e;const l=((e,t,n,r)=>{let o=cn(hn(e.node));return o=dn(o,t,n,0),o=cn(o),un(e.node,o)})(o,i,s),a=(0,de.zN)(e).replaceWith(o.pos,o.pos+o.node.nodeSize,l);if(!r)return a;const c=m.get(l),u=o.start,h=n,d=c.positionAt(c.height-1,h,l),p=a.doc.resolve(u+d),f=A.colSelection,g=c.positionAt(0,h,l),y=a.doc.resolve(u+g);return a.setSelection(f(p,y))}(o,e??0,t??0,!0));return Boolean(i)}));Jt(Nn,{displayName:"Command<moveColCommand>",group:"Table"});const On=(0,a.r1)("SelectRow",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(ln(e)(r));return Boolean(o)}));Jt(On,{displayName:"Command<selectRowCommand>",group:"Table"});const Tn=(0,a.r1)("SelectCol",(()=>(e=0)=>(t,n)=>{const{tr:r}=t,o=null==n?void 0:n(an(e)(r));return Boolean(o)}));Jt(Tn,{displayName:"Command<selectColCommand>",group:"Table"});const An=(0,a.r1)("SelectTable",(()=>()=>(e,t)=>{const{tr:n}=e,r=null==t?void 0:t((e=>{const t=(e=>{const t=tn(e);if(!t)return;const n=m.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map((e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}}))})(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return(0,de.zN)(e.setSelection(new A(t,n)))}}return e})(n));return Boolean(r)}));Jt(An,{displayName:"Command<selectTableCommand>",group:"Table"});const En=(0,a.r1)("DeleteSelectedCells",(()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof A))return!1;const r=n.isRowSelection(),o=n.isColSelection();return r&&o?function(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}(e,t):o?function(e,t){if(!x(e))return!1;if(t){const n=re(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;le(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(e)}t(r)}return!0}(e,t):function(e,t){if(!x(e))return!1;if(t){const n=re(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;ae(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(n.table)}t(r)}return!0}(e,t)}));Jt(En,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const Dn=(0,a.r1)("AddColBefore",(()=>()=>ie));Jt(Dn,{displayName:"Command<addColBeforeCommand>",group:"Table"});const In=(0,a.r1)("AddColAfter",(()=>()=>se));Jt(In,{displayName:"Command<addColAfterCommand>",group:"Table"});const Fn=(0,a.r1)("AddRowBefore",(()=>()=>(e,t)=>{if(!x(e))return!1;if(t){const n=re(e);t(on(e.tr,n,n.top))}return!0}));Jt(Fn,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const Rn=(0,a.r1)("AddRowAfter",(()=>()=>(e,t)=>{if(!x(e))return!1;if(t){const n=re(e);t(on(e.tr,n,n.bottom))}return!0}));Jt(Rn,{displayName:"Command<addRowAfterCommand>",group:"Table"});const zn=(0,a.r1)("SetAlign",(()=>(e="left")=>{return t="alignment",n=e,function(e,r){if(!x(e))return!1;const o=C(e);if(o.nodeAfter.attrs[t]===n)return!1;if(r){const i=e.tr;e.selection instanceof A?e.selection.forEachCell(((e,r)=>{e.attrs[t]!==n&&i.setNodeMarkup(r,null,{...e.attrs,[t]:n})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:n}),r(i)}return!0};var t,n}));Jt(zn,{displayName:"Command<setAlignCommand>",group:"Table"});const Bn=(0,a.Gv)("tableKeymap",{NextCell:{shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(c.Xo);return()=>t.call(xn.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(c.Xo);return()=>t.call(bn.key)}},ExitTable:{shortcuts:["Mod-Enter"],command:e=>{const t=e.get(c.Xo);return()=>t.call(Cn.key)}}});Jt(Bn.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),Jt(Bn.shortcuts,{displayName:"Keymap<table>",group:"Table"});const Pn="footnote_definition",Ln="footnoteDefinition",$n=(0,a.yU)("footnote_definition",(()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:""}},parseDOM:[{tag:`dl[data-type="${Pn}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,i.GZ)(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":Pn},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===Ln,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===Pn,runner:(e,t)=>{e.openNode(Ln,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}})));Jt($n.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),Jt($n.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const jn="footnote_reference",Hn=(0,a.yU)("footnote_reference",(()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:""}},parseDOM:[{tag:`sup[data-type="${jn}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,i.GZ)(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":jn},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===jn,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}})));Jt(Hn.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),Jt(Hn.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const Vn=s.Yp.extendSchema((e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw(0,i.GZ)(e);return{label:e.dataset.label,listType:e.dataset["list-type"],spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...(null==n?void 0:n.parseDOM)||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const o=null!=t.label?`${t.label}.`:"•",i=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",l=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:o,listType:s,spread:l,checked:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,o=t.attrs.listType,i="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:o,spread:i,checked:s}),e.next(t.content),e.closeNode()}}}}));Jt(Vn,{displayName:"NodeSchema<listItem>",group:"ListItem"});const _n=(0,a.Xt)((()=>new l.VK(/^\[(?<checked>\s|x)\]\s$/,((e,t,n,r)=>{var o;const i=e.doc.resolve(n);let s=0,l=i.node(s);for(;l&&"list_item"!==l.type.name;)s--,l=i.node(s);if(!l||null!=l.attrs.checked)return null;const a=Boolean("x"===(null==(o=t.groups)?void 0:o.checked)),c=i.before(s),u=e.tr;return u.deleteRange(n,r).setNodeMarkup(c,void 0,{...l.attrs,checked:a}),u}))));Jt(_n,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const Wn=[Qt,Bn].flat(),qn=[vn,_n],Kn=(0,a.x6)((()=>{const e=new u.H$("MILKDOWN_AUTO_INSERT_ZERO_SPACE"),t=e=>e.type===s.F3.type();return new u.Sy({key:e,props:{handleDOMEvents:{compositionstart(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return de.Xh.safari&&x(n)&&i.empty&&(e=>t(e)&&2===e.nodeSize)(s.parent)&&r(o.insertText("",s.start())),!1},compositionend(e){const{state:n,dispatch:r}=e,{tr:o,selection:i}=n,{$from:s}=i;return de.Xh.safari&&x(n)&&i.empty&&t(s.parent)&&s.parent.textContent.startsWith("")&&r(o.delete(s.start(),s.start()+1)),!1}}}})}));Jt(Kn,{displayName:"Prose<autoInsertZeroSpaceInTablePlugin>",group:"Prose"});const Yn=(0,a.x6)((()=>function({handleWidth:e=5,cellMinWidth:t=25,View:n=G,lastColumnResizable:r=!0}={}){const o=new u.Sy({key:X,state:{init:(e,r)=>(o.spec.props.nodeViews[w(r.schema).table.name]=(e,r)=>new n(e,t,r),new Q(-1,!1)),apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=X.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r,o){const i=X.getState(e.state);if(i&&!i.dragging){const r=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(r){const{left:o,right:i}=r.getBoundingClientRect();t.clientX-o<=n?s=ee(e,t,"left"):i-t.clientX<=n&&(s=ee(e,t,"right"))}if(s!=i.activeHandle){if(!o&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=m.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}ne(e,s)}}}(t,n,e,0,r)},mouseleave:e=>{!function(e){const t=X.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&ne(e,-1)}(e)},mousedown:(e,n)=>{!function(e,t,n){const r=X.getState(e.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const o=e.state.doc.nodeAt(r.activeHandle),i=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],l--);return s/l}(e,r.activeHandle,o.attrs);function s(t){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",l);const r=X.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=m.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+l;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],u=o.nodeAt(r).attrs,h=1==u.colspan?0:l-i.colCount(r);if(u.colwidth&&u.colwidth[h]==n)continue;const d=u.colwidth?u.colwidth.slice():(c=u.colspan,Array(c).fill(0));d[h]=n,a.setNodeMarkup(s+r,null,{...u,colwidth:d})}var c;a.docChanged&&e.dispatch(a)}(e,r.activeHandle,te(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(X,{setDragging:null})))}function l(t){if(!t.which)return s(t);const r=X.getState(e.state);if(r&&r.dragging){const o=te(r.dragging,t,n);!function(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),l=m.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=e.domAtPos(o.start(-1)).node;for(;a&&"TABLE"!=a.nodeName;)a=a.parentNode;a&&Z(i,a.firstChild,a,r,l,n)}(e,r.activeHandle,o,n)}}e.dispatch(e.state.tr.setMeta(X,{setDragging:{startX:t.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",l),t.preventDefault()}(e,n,t)}},decorations:e=>{const t=X.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return d.EH.empty;const i=m.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let e=0;e<i.height;e++){const t=l+e*i.width-1;if(!(l!=i.width&&i.map[t]==i.map[t+1]||0!=e&&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(d.p.widget(r,l))}}return d.EH.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o}({})));Jt(Yn,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const Un=(0,a.x6)((()=>function({allowTableNodeSelection:e=!1}={}){return new u.Sy({key:v,state:{init:()=>null,apply(e,t){const n=e.getMeta(v);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:D,handleDOMEvents:{mousedown:K},createSelectionBetween:e=>null!=v.getState(e.state)?e.state.selection:null,handleTripleClick:W,handleKeyDown:$,handlePaste:q},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,s;if(r instanceof u.qv&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)i=A.create(o,r.from);else if("row"==s){const e=o.resolve(r.from+1);i=A.rowSelection(e,e)}else if(!n){const e=m.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=A.create(o,t+1,n)}}else r instanceof u.Bs&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<e.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?i=u.Bs.create(o,r.from):r instanceof u.Bs&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(i=u.Bs.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(r,R(r,n),e)})}()));Jt(Un,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const Jn=(0,a.te)((()=>Ut));Jt(Jn,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});const Gn=[Kn,Yn,Un,Jn],Zn=[[Vn,gn,yn,wn,kn,$n,Hn,Gt,Zt].flat(),qn,Wn,Gn,[xn,bn,Cn,Sn,Mn,Nn,On,Tn,An,En,Fn,Rn,Dn,In,zn,Xt]].flat()},4285:(e,t,n)=>{"use strict";n.d(t,{Kk:()=>T,NJ:()=>N,Xh:()=>C,a1:()=>A,zN:()=>O});var r=n(7191);const o="undefined"!=typeof navigator?navigator:null,i="undefined"!=typeof document?document:null,s=o&&o.userAgent||"",l=/Edge\/(\d+)/.exec(s),a=/MSIE \d/.exec(s),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s),u=!!(a||c||l),h=a?document.documentMode:c?+c[1]:l?+l[1]:0,d=!u&&/gecko\/(\d+)/i.test(s),p=d&&+(/Firefox\/(\d+)/.exec(s)||[0,0])[1],f=!u&&/Chrome\/(\d+)/.exec(s),m=!!f,g=f?+f[1]:0,y=!u&&!!o&&/Apple Computer/.test(o.vendor),k=y&&(/Mobile\/\w+/.test(s)||!!o&&o.maxTouchPoints>2),w=k||!!o&&/Mac/.test(o.platform),v=/Android \d/.test(s),b=!!i&&"webkitFontSmoothing"in i.documentElement.style,x=b?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var C=Object.freeze({__proto__:null,ie:u,ie_version:h,gecko:d,gecko_version:p,chrome:m,chrome_version:g,safari:y,ios:k,mac:w,android:v,webkit:b,webkit_version:x});function S(e,t,n,r,o,i){if(e.composing)return!1;const s=e.state,l=s.doc.resolve(t);if(l.parent.type.spec.code)return!1;const a=l.parent.textBetween(Math.max(0,l.parentOffset-500),l.parentOffset,void 0,"")+r;for(let l=0;l<o.length;l++){const c=o[l].match.exec(a),u=c&&c[0]&&o[l].handler(s,c,t-(c[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(i,{transform:u,from:t,to:n,text:r})),!0}return!1}const M=new r.H$("MILKDOWN_CUSTOM_INPUTRULES"),N=({rules:e})=>{const t=new r.Sy({key:M,isInputRules:!0,state:{init:()=>null,apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>S(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>(setTimeout((()=>{const{$cursor:r}=n.state.selection;r&&S(n,r.pos,r.pos,"",e,t)})),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:o}=n.state.selection;return!!o&&S(n,o.pos,o.pos,"\n",e,t)}}});return t};Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const O=e=>Object.assign(Object.create(e),e).setTime(Date.now()),T=e=>t=>(e=>t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}})(e)(t.$from),A=(e,t)=>{if(!(e instanceof r.qv))return;const{node:n,$from:o}=e;return((e,t)=>Array.isArray(e)&&e.includes(t.type)||t.type===e)(t,n)?{node:n,pos:o.pos,start:o.start(o.depth),depth:o.depth}:void 0}},4611:(e,t,n)=>{"use strict";n.d(t,{Nl:()=>i,iz:()=>s,jE:()=>l});var r=n(8657);const o=(0,r.createContext)({}),i=()=>{const e=(()=>{const{dom:e,editor:t,setLoading:n,editorFactory:i}=(0,r.useContext)(o),s=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const r=s.current;if(!i||!r)return;e.current=r;const o=i(r);return o?(n(!0),o.create().then((e=>{t.current=e})).finally((()=>{n(!1)})).catch(console.error),()=>{var e;null==(e=t.current)||e.destroy()}):void 0}),[e,t,i,n]),s})();return r.createElement("div",{"data-milkdown-root":!0,ref:e})},s=({children:e})=>{const t=(0,r.useRef)(void 0),[n,i]=(0,r.useState)(void 0),s=(0,r.useRef)(),[l,a]=(0,r.useState)(!0),c=(0,r.useMemo)((()=>({loading:l,dom:t,editor:s,setLoading:a,editorFactory:n,setEditorFactory:i})),[l,n]);return r.createElement(o.Provider,{value:c},e)},l=(e,t=[])=>{const n=(0,r.useContext)(o),i=(0,r.useCallback)(e,t);return(0,r.useLayoutEffect)((()=>{n.setEditorFactory((()=>i))}),[n,i]),{loading:n.loading,get:()=>n.editor.current}}},8652:(e,t,n)=>{"use strict";n.d(t,{Q:()=>s});var r=n(8858);function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=o(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=o(e))&&(r&&(r+=" "),r+=t);return r},s=e=>{e.update(r.i8,(e=>{const t=e.attributes;return{...e,attributes:e=>{const n="function"==typeof t?t(e):t;return{...n,class:i("prose dark:prose-invert outline-none",(null==n?void 0:n.class)||"","milkdown-theme-nord")}}}}))}},948:(e,t,n)=>{"use strict";n.d(t,{r1:()=>l,Tu:()=>p,Xt:()=>a,we:()=>k,c8:()=>m,qT:()=>c,jO:()=>y,yU:()=>f,x6:()=>u,te:()=>h,xM:()=>d,Gv:()=>g,lB:()=>w,zG:()=>v});var r=n(8858),o=n(11);var i=n(870),s=n(840);((e,t=21)=>{((e,t,n)=>{Math.log(e.length-1),Math.LN2,e.length})("abcedfghicklmn",t)})(0,10);const l=(e,t)=>{const n=(0,r.uW)(e),o=i=>async()=>{o.key=n,await i.wait(r.R3);const s=t(i);return i.get(r.Xo).create(n,s),o.run=t=>i.get(r.Xo).call(e,t),()=>{i.get(r.Xo).remove(n)}};return o},a=e=>{const t=n=>async()=>{await n.wait(r.R3);const o=e(n);return n.update(r.tQ,(e=>[...e,o])),t.inputRule=o,()=>{n.update(r.tQ,(e=>e.filter((e=>e!==o))))}};return t},c=(e,t)=>{let n;const o=s=>async()=>{const l=t(s);if(s.update(r.pB,(t=>[...t.filter((t=>t[0]!==e)),[e,l]])),o.id=e,o.schema=l,await s.wait(r.R3),n=s.get(r.le).nodes[e],!n)throw(0,i.YN)(e);return()=>{s.update(r.pB,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o},u=e=>{let t;const n=n=>async()=>(await n.wait(r.R3),t=e(n),n.update(r.ZV,(e=>[...e,t])),()=>{n.update(r.ZV,(e=>e.filter((e=>e!==t))))});return n.plugin=()=>t,n.key=()=>t.spec.key,n},h=e=>{const t=n=>async()=>{await n.wait(r.Iq);const o=e(n);return n.update(r.CG,(e=>[...e,o])),t.plugin=o,()=>{n.update(r.CG,(e=>e.filter((e=>e!==o))))}};return t},d=e=>{const t=n=>async()=>{await n.wait(r.R3);const o=e(n),i=(0,s.h)(o);return n.update(r.ZV,(e=>[...e,i])),t.keymap=o,()=>{n.update(r.ZV,(e=>e.filter((e=>e!==i))))}};return t},p=(e,t)=>{const n=(0,o.oM)(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r},f=(e,t)=>{const n=p(t,e),o=c(e,(e=>e.get(n.key)(e))),i=[n,o];return i.id=o.id,i.node=o,i.type=o.type,i.schema=o.schema,i.ctx=n,i.key=n.key,i.extendSchema=t=>o=>()=>{const s=o.get(n.key),l=t(s)(o);o.update(r.pB,(t=>[...t.filter((t=>t[0]!==e)),[e,l]])),i.schema=l},i},m=(e,t)=>{const n=p(t,e),o=((e,t)=>{let n;const o=s=>async()=>{const l=t(s);if(s.update(r.ZP,(t=>[...t.filter((t=>t[0]!==e)),[e,l]])),o.id=e,o.schema=l,await s.wait(r.R3),n=s.get(r.le).marks[e],!n)throw(0,i.d2)(e);return()=>{s.update(r.ZP,(t=>t.filter((([t])=>t!==e))))}};return o.type=()=>n,o})(e,(e=>e.get(n.key)(e))),s=[n,o];return s.id=o.id,s.mark=o,s.type=o.type,s.schema=o.schema,s.ctx=n,s.key=n.key,s.extendSchema=t=>o=>()=>{const i=o.get(n.key),l=t(i)(o);o.update(r.ZP,(t=>[...t.filter((t=>t[0]!==e)),[e,l]])),s.schema=l},s},g=(e,t)=>{const n=Object.fromEntries(Object.entries(t).map((([e,{shortcuts:t}])=>[e,t]))),r=p(n,`${e}Keymap`),o=d((e=>{const n=e.get(r.key),o=Object.entries(t).flatMap((([t,{command:r}])=>[n[t]].flat().map((t=>[t,r(e)]))));return Object.fromEntries(o)})),i=[r,o];return i.ctx=r,i.shortcuts=o,i.key=r.key,i.keymap=o.keymap,i},y=(e,t=(()=>({})))=>p(t,`${e}Attr`),k=(e,t=(()=>({})))=>p(t,`${e}Attr`);function w(e,t){return n=>n.get(r.Xo).call(e,t)}const v=(...e)=>{const t=e.length;let n=t;for(;n--;)if("function"!=typeof e[n])throw new TypeError("Expected a function");return(...n)=>{let r=0,o=t?e[r](...n):n[0];for(;++r<t;)o=e[r](o);return o}}},6226:(e,t,n)=>{"use strict";n.d(t,{Q:()=>i});var r=n(4795),o=n(3352),i=function(){var e=(0,r.Z)((function*(e,t,n){var r=new FormData,i=function*(){if(Array.isArray(l)){var e="".concat(s,"[]");l.forEach((t=>{r.append(e,t)}))}else r.append(s,l)};for(var[s,l]of Object.entries(t))yield*i();return(yield o.http.put("api/gateway/object_store.object_store.PutObject/api/v1/objectStore/bucket/".concat(e,"/object"),r,n)).data}));return function(t,n,r){return e.apply(this,arguments)}}()},8731:(e,t,n)=>{"use strict";n.d(t,{T:()=>o});const r=document.createElement("i");function o(e){const t="&"+e+";";r.innerHTML=t;const n=r.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}},3218:(e,t,n)=>{"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}n.d(t,{Z:()=>r})},7875:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});var r=n(9239);function o(e,t,n){let o=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(o);)i+="`";for(/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^`|`$/.test(o))&&(o=" "+o+" ");++s<n.unsafe.length;){const e=n.unsafe[s],t=(0,r.T)(e);let i;if(e.atBreak)for(;i=t.exec(o);){let e=i.index;10===o.charCodeAt(e)&&13===o.charCodeAt(e-1)&&e--,o=o.slice(0,e)+" "+o.slice(i.index+1)}}return i+o+i}o.peek=function(){return"`"}},207:(e,t,n)=>{"use strict";n.d(t,{q:()=>o});var r=n(2527);function o(e,t,n,o){const i=function(e){const t=e.options.listItemIndent||"tab";if(1===t||"1"===t)return"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let s=n.bulletCurrent||(0,r.g)(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let l=s.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(l=4*Math.ceil(l/4));const a=n.createTracker(o);a.move(s+" ".repeat(l-s.length)),a.shift(l);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){return t?(n?"":" ".repeat(l))+e:(n?s:s+" ".repeat(l-s.length))+e}));return c(),u}},2042:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});var r=n(2857);function o(e){return e.label||!e.identifier?e.label||"":(0,r.v)(e.identifier)}},2527:(e,t,n)=>{"use strict";function r(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}n.d(t,{g:()=>r})},736:(e,t,n)=>{"use strict";function r(e,t,n){const r=t.indexStack,i=e.children||[],s=t.createTracker(n),l=[];let a=-1;for(r.push(-1);++a<i.length;){const n=i[a];r[r.length-1]=a,l.push(s.move(t.handle(n,e,t,{before:"\n",after:"\n",...s.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&l.push(s.move(o(n,i[a+1],e,t)))}return r.pop(),l.join("")}function o(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}n.d(t,{K:()=>r})},5917:(e,t,n)=>{"use strict";function r(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,l=n.before;r.push(-1);let a=t.createTracker(n);for(;++s<o.length;){const c=o[s];let u;if(r[r.length-1]=s,s+1<o.length){let n=t.handle.handlers[o[s+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[s+1],e,t,{before:"",after:"",...a.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===l||"\n"===l)&&"html"===c.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),l=" ",a=t.createTracker(n),a.move(i.join(""))),i.push(a.move(t.handle(c,e,t,{...a.current(),before:l,after:u}))),l=i[i.length-1].slice(-1)}return r.pop(),i.join("")}n.d(t,{p:()=>r})},2312:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});const r=/\r?\n|\r/g;function o(e,t){const n=[];let o,i=0,s=0;for(;o=r.exec(e);)l(e.slice(i,o.index)),n.push(o[0]),i=o.index+o[0].length,s++;return l(e.slice(i)),n.join("");function l(e){n.push(t(e,s,!e))}}},9239:(e,t,n)=>{"use strict";function r(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}n.d(t,{T:()=>r})},2590:(e,t,n)=>{"use strict";function r(e,t){return o(e,t.inConstruct,!0)&&!o(e,t.notInConstruct,!1)}function o(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}n.d(t,{P:()=>r})},9836:(e,t,n)=>{"use strict";n.d(t,{T:()=>i});var r=n(9239),o=n(2590);function i(e,t,n){const i=(n.before||"")+(t||"")+(n.after||""),a=[],c=[],u={};let h=-1;for(;++h<e.unsafe.length;){const t=e.unsafe[h];if(!(0,o.P)(e.stack,t))continue;const n=(0,r.T)(t);let s;for(;s=n.exec(i);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=s.index+(e?s[1].length:0);a.includes(r)?(u[r].before&&!e&&(u[r].before=!1),u[r].after&&!n&&(u[r].after=!1)):(a.push(r),u[r]={before:e,after:n})}}a.sort(s);let d=n.before?n.before.length:0;const p=i.length-(n.after?n.after.length:0);for(h=-1;++h<a.length;){const e=a[h];e<d||e>=p||e+1<p&&a[h+1]===e+1&&u[e].after&&!u[e+1].before&&!u[e+1].after||a[h-1]===e-1&&u[e].before&&!u[e-1].before&&!u[e-1].after||(d!==e&&c.push(l(i.slice(d,e),"\\")),d=e,!/[!-/:-@[-`{-~]/.test(i.charAt(e))||n.encode&&n.encode.includes(i.charAt(e))?(c.push("&#x"+i.charCodeAt(e).toString(16).toUpperCase()+";"),d++):c.push("\\"))}return c.push(l(i.slice(d,p),n.after)),c.join("")}function s(e,t){return e-t}function l(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,l=-1,a=0;for(;s=n.exec(i);)r.push(s.index);for(;++l<r.length;)a!==r[l]&&o.push(e.slice(a,r[l])),o.push("\\"),a=r[l];return o.push(e.slice(a)),o.join("")}},1969:(e,t,n)=>{"use strict";function r(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}n.d(t,{j:()=>r})},8466:(e,t,n)=>{"use strict";n.d(t,{w:()=>i});var r=n(2473),o=n(5185);const i={tokenize:function(e,t,n){return function(t){return(0,o.xz)(t)?(0,r.f)(e,i,"linePrefix")(t):i(t)};function i(e){return null===e||(0,o.Ch)(e)?t(e):n(e)}},partial:!0}},2473:(e,t,n)=>{"use strict";n.d(t,{f:()=>o});var r=n(5185);function o(e,t,n,o){const i=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(o){return(0,r.xz)(o)?(e.enter(n),l(o)):t(o)};function l(o){return(0,r.xz)(o)&&s++<i?(e.consume(o),l):(e.exit(n),t(o))}}},5185:(e,t,n)=>{"use strict";n.d(t,{jv:()=>r,H$:()=>s,n9:()=>a,Av:()=>c,pY:()=>o,AF:()=>i,sR:()=>l,Ch:()=>h,z3:()=>u,xz:()=>d,Xh:()=>f,B8:()=>p});const r=m(/[A-Za-z]/),o=m(/\d/),i=m(/[\dA-Fa-f]/),s=m(/[\dA-Za-z]/),l=m(/[!-/:-@[-`{-~]/),a=m(/[#-'*+\--9=?A-Z^-~]/);function c(e){return null!==e&&(e<32||127===e)}function u(e){return null!==e&&(e<0||32===e)}function h(e){return null!==e&&e<-2}function d(e){return-2===e||-1===e||32===e}const p=m(/\s/),f=m(/[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/);function m(e){return function(t){return null!==t&&e.test(String.fromCharCode(t))}}},8391:(e,t,n)=>{"use strict";function r(e,t,n,r){const o=e.length;let i,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),[].splice.apply(e,i);else for(n&&[].splice.apply(e,[t,n]);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),[].splice.apply(e,i),s+=1e4,t+=1e4}function o(e,t){return e.length>0?(r(e,e.length,0,t),e):t}n.d(t,{V:()=>o,d:()=>r})},898:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var r=n(5185);function o(e){return null===e||(0,r.z3)(e)||(0,r.B8)(e)?1:(0,r.Xh)(e)?2:void 0}},7842:(e,t,n)=>{"use strict";n.d(t,{W:()=>i});var r=n(8391);const o={}.hasOwnProperty;function i(e){const t={};let n=-1;for(;++n<e.length;)s(t,e[n]);return t}function s(e,t){let n;for(n in t){const r=(o.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;for(s in i){o.call(r,s)||(r[s]=[]);const e=i[s];l(r[s],Array.isArray(e)?e:e?[e]:[])}}}function l(e,t){let n=-1;const o=[];for(;++n<t.length;)("after"===t[n].add?e:o).push(t[n]);(0,r.d)(e,0,0,o)}},8578:(e,t,n)=>{"use strict";function r(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||65535==(65535&n)||65534==(65535&n)||n>1114111?"�":String.fromCharCode(n)}n.d(t,{o:()=>r})},2857:(e,t,n)=>{"use strict";n.d(t,{v:()=>s});var r=n(8731),o=n(8578);const i=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function s(e){return e.replace(i,l)}function l(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return(0,o.o)(n.slice(t?2:1),t?16:10)}return(0,r.T)(n)||e}},6910:(e,t,n)=>{"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{d:()=>r})},7828:(e,t,n)=>{"use strict";function r(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}n.d(t,{C:()=>r})},737:(e,t,n)=>{"use strict";n.d(t,{YR:()=>S,uJ:()=>y,w9:()=>k,ym:()=>g});var r=n(6151),o=n(2665),i=n(7191);const s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function l(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function a(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function c(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function u(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var h;function d(e,t,n){let s,a,c=t.nodeBefore,u=t.nodeAfter;if(c.type.spec.isolating||u.type.spec.isolating)return!1;if(function(e,t,n){let o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!(0,r.Mn)(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,o.type,o.contentMatchAt(o.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let h=t.parent.canReplace(t.index(),t.index()+1);if(h&&(s=(a=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&a.matchType(s[0]||u.type).validEnd){if(n){let i=t.pos+u.nodeSize,l=o.HY.empty;for(let e=s.length-1;e>=0;e--)l=o.HY.from(s[e].create(null,l));l=o.HY.from(c.copy(l));let a=e.tr.step(new r.FC(t.pos-1,i,t.pos,i,new o.p2(l,1,0),s.length,!0)),h=i+2*s.length;(0,r.Mn)(a.doc,h)&&a.join(h),n(a.scrollIntoView())}return!0}let d=i.Y1.findFrom(t,1),p=d&&d.$from.blockRange(d.$to),f=p&&(0,r.k9)(p);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(p,f).scrollIntoView()),!0;if(h&&l(u,"start",!0)&&l(c,"end")){let i=c,s=[];for(;s.push(i),!i.isTextblock;)i=i.lastChild;let l=u,a=1;for(;!l.isTextblock;l=l.firstChild)a++;if(i.canReplace(i.childCount,i.childCount,l.content)){if(n){let i=o.HY.empty;for(let e=s.length-1;e>=0;e--)i=o.HY.from(s[e].copy(i));n(e.tr.step(new r.FC(t.pos-s.length,t.pos+u.nodeSize,t.pos+a,t.pos+u.nodeSize-a,new o.p2(i,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function p(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.Bs.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}const f=p(-1),m=p(1);function g(e,t=null){return function(n,o){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),a=l&&(0,r.nd)(l,e,t);return!!a&&(o&&o(n.tr.wrap(l,a).scrollIntoView()),!0)}}function y(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}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,e,t)}r(o.scrollIntoView())}return!0}}function k(e,t=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,(e=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o=!1,i=n.tr;for(let t=0;!o&&t<s.length;t++){let{$from:r,$to:i}=s[t];o=n.doc.rangeHasMark(r.pos,i.pos,e)}for(let n=0;n<s.length;n++){let{$from:r,$to:l}=s[n];if(o)i.removeMark(r.pos,l.pos,e);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,u=a&&a.isText?/\s*$/.exec(a.text)[0].length:0;n+c<o&&(n+=c,o-=u),i.addMark(n,o,e.create(t))}}r(i.scrollIntoView())}return!0}}function w(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let v=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!s)return!1;let c=a(s);if(!c){let n=s.blockRange(),o=n&&(0,r.k9)(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let u=c.nodeBefore;if(!u.type.spec.isolating&&d(e,c,t))return!0;if(0==s.parent.content.size&&(l(u,"end")||i.qv.isSelectable(u))){let n=(0,r.dR)(e.doc,s.before(),s.after(),o.p2.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(l(u,"end")?i.Y1.findFrom(r.doc.resolve(r.mapping.map(c.pos,-1)),-1):i.qv.create(r.doc,c.pos-u.nodeSize)),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||c.depth!=s.depth-1||(t&&t(e.tr.delete(c.pos-u.nodeSize,c.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=a(r)}let l=s&&s.nodeBefore;return!(!l||!i.qv.isSelectable(l)||(t&&t(e.tr.setSelection(i.qv.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),0))})),b=w(s,((e,t,n)=>{let s=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!s)return!1;let a=c(s);if(!a)return!1;let u=a.nodeAfter;if(d(e,a,t))return!0;if(0==s.parent.content.size&&(l(u,"start")||i.qv.isSelectable(u))){let n=(0,r.dR)(e.doc,s.before(),s.after(),o.p2.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(l(u,"start")?i.Y1.findFrom(r.doc.resolve(r.mapping.map(a.pos)),1):i.qv.create(r.doc,r.mapping.map(a.pos))),t(r.scrollIntoView())}return!0}}return!(!u.isAtom||a.depth!=s.depth-1||(t&&t(e.tr.delete(a.pos,a.pos+u.nodeSize).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=c(r)}let l=s&&s.nodeAfter;return!(!l||!i.qv.isSelectable(l)||(t&&t(e.tr.setSelection(i.qv.create(e.doc,s.pos)).scrollIntoView()),0))}));const x={Enter:w(((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}),((e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof i.C1||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=u(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(n,s.createAndFill());l.setSelection(i.Bs.create(l.doc,n+1)),t(l.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if((0,r.Ax)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&(0,r.k9)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof i.qv&&e.selection.node.isBlock)return!(!n.parentOffset||!(0,r.Ax)(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(t){let s=o.parentOffset==o.parent.content.size,l=e.tr;(e.selection instanceof i.Bs||e.selection instanceof i.C1)&&l.deleteSelection();let a=0==n.depth?null:u(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=h?[h]:s&&a?[{type:a}]:void 0,d=(0,r.Ax)(l.doc,l.mapping.map(n.pos),1,c);if(c||d||!(0,r.Ax)(l.doc,l.mapping.map(n.pos),1,a?[{type:a}]:void 0)||(a&&(c=[{type:a}]),d=!0),d&&(l.split(l.mapping.map(n.pos),1,c),!s&&!n.parentOffset&&n.parent.type!=a)){let e=l.mapping.map(n.before()),t=l.doc.resolve(e);a&&n.node(-1).canReplaceWith(t.index(),t.index()+1,a)&&l.setNodeMarkup(l.mapping.map(n.before()),a)}t(l.scrollIntoView())}return!0})),"Mod-Enter":(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),l=u(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,l.createAndFill());o.setSelection(i.Y1.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Backspace:v,"Mod-Backspace":v,"Shift-Backspace":v,Delete:b,"Mod-Delete":b,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new i.C1(e.doc))),!0)},C={"Ctrl-h":x.Backspace,"Alt-Backspace":x["Mod-Backspace"],"Ctrl-d":x.Delete,"Ctrl-Alt-Backspace":x["Mod-Delete"],"Alt-Delete":x["Mod-Delete"],"Alt-d":x["Mod-Delete"],"Ctrl-a":f,"Ctrl-e":m};for(let e in x)C[e]=x[e];const S=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?C:x},8892:(e,t,n)=>{"use strict";n.d(t,{S0:()=>i,VK:()=>o,zK:()=>s});var r=n(6151);class o{constructor(e,t){var n;this.match=e,this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,o){let i=n;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let n=(r+=e)-o;n>0&&(i=t[0].slice(e-n,e)+i,r=o)}return e.tr.insertText(i,r,o)}):t}}function i(e,t,n=null,i){return new o(e,((e,o,s,l)=>{let a=n instanceof Function?n(o):n,c=e.tr.delete(s,l),u=c.doc.resolve(s).blockRange(),h=u&&(0,r.nd)(u,t,a);if(!h)return null;c.wrap(u,h);let d=c.doc.resolve(s-1).nodeBefore;return d&&d.type==t&&(0,r.Mn)(c.doc,s-1)&&(!i||i(o,d))&&c.join(s-1),c}))}function s(e,t,n=null){return new o(e,((e,r,o,i)=>{let s=e.doc.resolve(o),l=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,l):null}))}new o(/--$/,"—"),new o(/\.\.\.$/,"…"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new o(/"$/,"”"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new o(/'$/,"’")},840:(e,t,n)=>{"use strict";n.d(t,{$:()=>g,h:()=>m});for(var r={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:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=s||i&&+i[1]<57,c=0;c<10;c++)r[48+c]=r[96+c]=String(c);for(c=1;c<=24;c++)r[c+111]="F"+c;for(c=65;c<=90;c++)r[c]=String.fromCharCode(c+32),o[c]=String.fromCharCode(c);for(var u in r)o.hasOwnProperty(u)||(o[u]=r[u]);var h=n(7191);const d="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function p(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);d?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function f(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function m(e){return new h.Sy({props:{handleKeyDown:g(e)}})}function g(e){let t=function(e){let t=Object.create(null);for(let n in e)t[p(n)]=e[n];return t}(e);return function(e,n){let i,s=function(e){var t=!(a&&(e.ctrlKey||e.altKey||e.metaKey)||l&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),c=t[f(s,n)];if(c&&c(e.state,e.dispatch,e))return!0;if(1==s.length&&" "!=s){if(n.shiftKey){let r=t[f(s,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||s.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=s){let r=t[f(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}},2665:(e,t,n)=>{"use strict";function r(e){this.content=e}n.d(t,{aw:()=>Z,PW:()=>le,HY:()=>l,vc:()=>h,ZU:()=>U,NB:()=>D,Ts:()=>A,e4:()=>d,V_:()=>J,p2:()=>p}),r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};const o=r;function i(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)n++;return n}if(o.content.size||s.content.size){let e=i(o.content,s.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function s(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let l=e.child(--o),a=t.child(--i),c=l.nodeSize;if(l!=a){if(!l.sameMarkup(a))return{a:n,b:r};if(l.isText&&l.text!=a.text){let e=0,t=Math.min(l.text.length,a.text.length);for(;e<t&&l.text[l.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(l.content.size||a.content.size){let e=s(l.content,a.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class l{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,o||null,i)&&l.content.size){let o=s+1;l.nodesBetween(Math.max(0,e-o),Math.min(l.content.size,t-o),n,r+o)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,l)=>{s.isText?(o+=s.text.slice(Math.max(e,l)-l,t-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(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new l(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],l=i+s.nodeSize;l>e&&((i<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=l}return new l(n,r)}cutByIndex(e,t){return e==t?l.empty:0==e&&t==this.content.length?this:new l(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new l(r,o)}addToStart(e){return new l([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new l(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return i(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return s(this,e,t,n)}findIndex(e,t=-1){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?c(n+1,o):c(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return l.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new l(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return l.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new l(t||e,n)}static from(e){if(!e)return l.empty;if(e instanceof l)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new l([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}l.empty=new l([],0);const a={index:0,offset:0};function c(e,t){return a.index=e,a.offset=t,a}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class h{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&u(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return h.none;if(e instanceof h)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}h.none=[];class d extends Error{}class p{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(e,t){return new p(f(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return p.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(l.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new p(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:l}=e.findIndex(n);if(o==t||i.isText){if(l!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=m(s.content,t-i-1,n);return l&&e.replaceChild(o,s.copy(l))}function g(e,t,n){if(n.openStart>e.depth)throw new d("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new d("Inconsistent open depths");return y(e,t,n,0)}function y(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=y(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(l.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return x(i,C(e,o,s,t,r))}{let r=e.parent,o=r.content;return x(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return x(i,S(e,t,r))}function k(e,t){if(!t.type.compatibleContent(e.type))throw new d("Cannot join "+t.type.name+" onto "+e.type.name)}function w(e,t,n){let r=e.node(n);return k(r,t.node(n)),r}function v(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function b(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(v(e.nodeAfter,r),i++));for(let e=i;e<s;e++)v(o.child(e),r);t&&t.depth==n&&t.textOffset&&v(t.nodeBefore,r)}function x(e,t){return e.type.checkContent(t),e.copy(t)}function C(e,t,n,r,o){let i=e.depth>o&&w(e,t,o+1),s=r.depth>o&&w(n,r,o+1),a=[];return b(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(k(i,s),v(x(i,C(e,t,n,r,o+1)),a)):(i&&v(x(i,S(e,t,o+1)),a),b(t,n,o,a),s&&v(x(s,S(n,r,o+1)),a)),b(r,null,o,a),new l(a)}function S(e,t,n){let r=[];return b(null,e,n,r),e.depth>n&&v(x(w(e,t,n+1),S(e,t,n+1)),r),b(t,null,n,r),new l(r)}p.empty=new p(l.empty,0,0);class M{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return h.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let 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(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var 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(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new A(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new M(t,n,o)}static resolveCached(e,t){for(let n=0;n<N.length;n++){let r=N[n];if(r.pos==t&&r.doc==e)return r}let n=N[O]=M.resolve(e,t);return O=(O+1)%T,n}}let N=[],O=0,T=12;class A{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const E=Object.create(null);class D{constructor(e,t,n,r=h.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||l.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||E)&&h.sameSet(this.marks,n||h.none)}copy(e=null){return e==this.content?this:new D(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new D(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return p.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),l=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(l,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return M.resolveCached(this,e)}resolveNoCache(e){return M.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),F(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=l.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=h.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!h.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=l.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}D.prototype.text=void 0;class I extends D{constructor(e,t,n,r){if(super(e,t,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):F(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new I(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new I(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function F(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class R{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new z(e,t);if(null==n.next)return R.empty;let r=B(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);V(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new R(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(H);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(V(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,i))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return l.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}R.empty=new R(!0);class z{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function B(e){let t=[];do{t.push(P(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function P(e){let t=[];do{t.push(L(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function L(e){let t=function(e){if(e.eat("(")){let t=B(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.groups.indexOf(t)>-1&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=j(e,t)}return t}function $(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function j(e,t){let n=$(e),r=n;return e.eat(",")&&(r="}"!=e.next?$(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function H(e,t){return t-e}function V(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(H)}function _(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function W(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function q(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Y(e[n]);return t}class K{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=q(n.attrs),this.defaultAttrs=_(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==R.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new D(this,this.computeAttrs(e),l.from(t),h.setFrom(n))}createChecked(e=null,t,n){return t=l.from(t),this.checkContent(t),new D(this,this.computeAttrs(e),t,h.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=l.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(l.empty,!0);return o?new D(this,e,t.append(o),h.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:h.none:e}static compile(e,t){let n=Object.create(null);e.forEach(((e,r)=>n[e]=new K(e,t,r)));let r=t.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 e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class Y{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class U{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=q(r.attrs),this.excluded=null;let o=_(this.attrs);this.instance=o?new h(this,o):null}create(e=null){return!e&&this.instance?this.instance:new h(this,W(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new U(e,r++,t,o))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class J{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=K.compile(this.spec.nodes,this),this.marks=U.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;t.contentMatch=n[r]||(n[r]=R.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==o?null:o?G(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:G(this,n.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(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof K))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new I(n,n.defaultAttrs,e,h.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return D.fromJSON(this,e)}markFromJSON(e){return h.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function G(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Z{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new re(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new re(this,t,!0);return n.addAll(e,t.from,t.to),p.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,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(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Z(e,Z.schemaRules(e)))}}const X={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},Q={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ee={ol:!0,ul:!0};function te(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ne{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=h.none,this.stashMarks=[],this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(l.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=l.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(l.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):se(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!X.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class re{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=te(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ne(o.type,o.attrs,h.none,h.none,!0,t.topMatch||o.type.contentMatch,i):new ne(n?null:e.schema.topNodeType,null,h.none,h.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){let t=e.getAttribute("style");if(t){let n=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t));if(!n)return;let[r,o]=n,i=this.top;for(let e=0;e<o.length;e++)this.removePendingMark(o[e],i);for(let e=0;e<r.length;e++)this.addPendingMark(r[e]);this.addElement(e);for(let e=0;e<r.length;e++)this.removePendingMark(r[e],i);for(let e=0;e<o.length;e++)this.addPendingMark(o[e])}else this.addElement(e)}}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ee.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ee.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:Q.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(X.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),t&&this.sync(n),this.needsBlock=i}else this.addElementByRule(e,o,!1===o.consuming?n:void 0)}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=h.none,n=h.none;for(let r=0;r<e.length;r+=2)for(let o;;){let i=this.parser.matchStyle(e[r],e[r+1],this,o);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{i.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;o=i}return[t,n]}addElementByRule(e,t,n){let r,o,i;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let e=0;e<t.length;e++)this.enterInner(t[e],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=te(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ne(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=l&&-1==e.groups.indexOf(l))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ie(e){let t={};for(let n in e)t[n]=e[n];return t}function se(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class le{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ce(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=le.renderSpec(ce(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&le.renderSpec(ce(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),l=t[1],a=1;if(l&&"object"==typeof l&&null==l.nodeType&&!Array.isArray(l)){a=2;for(let e in l)if(null!=l[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):s.setAttribute(e,l[e])}}for(let o=a;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:o}=le.renderSpec(e,i,n);if(s.appendChild(t),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new le(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ae(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ae(e.marks)}}function ae(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ce(e){return e.document||window.document}},7191:(e,t,n)=>{"use strict";n.d(t,{Bs:()=>u,C1:()=>f,H$:()=>T,Sy:()=>M,Y1:()=>s,qv:()=>d,xm:()=>l,yy:()=>C});var r=n(2665),o=n(6151);const i=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new l(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=r.p2.empty){let n=t.content.lastChild,o=null;for(let e=0;e<t.openEnd;e++)o=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?r.p2.empty:t),0==l&&y(e,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],l=e.mapping.slice(n),a=l.map(i.pos),c=l.map(s.pos);o?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),y(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new u(e):g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?g(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):g(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return u.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class l{constructor(e,t){this.$from=e,this.$to=t}}let a=!1;function c(e){a||e.parent.inlineContent||(a=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class u extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new u(r.parent.inlineContent?r:n,n)}replace(e,t=r.p2.empty){if(super.replace(e,t),t==r.p2.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof u&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new h(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new u(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new u(e,t)}}s.jsonID("text",u);class h{constructor(e,t){this.anchor=e,this.head=t}map(e){return new h(e.map(this.anchor),e.map(this.head))}resolve(e){return u.between(e.resolve(this.anchor),e.resolve(this.head))}}class d extends s{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?s.near(o):new d(o)}content(){return new r.p2(r.HY.from(this.node),0,0)}eq(e){return e instanceof d&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new p(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new d(e.resolve(t.anchor))}static create(e,t){return new d(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}d.prototype.visible=!1,s.jsonID("node",d);class p{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new h(n,n):new p(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&d.isSelectable(n)?new d(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r.p2.empty){if(t==r.p2.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve:e=>new f(e)};function g(e,t,n,r,o,i=!1){if(t.inlineContent)return u.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&d.isSelectable(r))return d.create(e,n-(o<0?r.nodeSize:0))}else{let t=g(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function y(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,l=e.steps[r];(l instanceof o.Pu||l instanceof o.FC)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==i&&(i=r)})),e.setSelection(s.near(e.doc.resolve(i),n)))}class k extends o.wx{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return r.vc.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.vc.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function w(e,t){return t&&e?e.bind(t):e}class v{constructor(e,t,n){this.name=e,this.init=w(t.init,n),this.apply=w(t.apply,n)}}const b=[new v("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new v("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new v("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new v("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class x{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=b.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new v(e.key,e.spec.state,e))}))}}class C{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let 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<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new C(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new k(this)}static create(e){let t=new x(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new C(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new x(this.schema,e.plugins),n=t.fields,r=new C(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new x(e.schema,e.plugins),i=new C(o);return o.fields.forEach((o=>{if("doc"==o.name)i.doc=r.NB.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],l=s.spec.state;if(s.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,r))return void(i[o.name]=l.fromJSON.call(s,e,t[r],i))}i[o.name]=o.init(e,i)}})),i}}function S(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=S(o,t,{})),n[r]=o}return n}class M{constructor(e){this.spec=e,this.props={},e.props&&S(e.props,this,this.props),this.key=e.key?e.key.key:O("plugin")}getState(e){return e[this.key]}}const N=Object.create(null);function O(e){return e in N?e+"$"+ ++N[e]:(N[e]=0,e+"$")}class T{constructor(e="key"){this.key=O(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},6151:(e,t,n)=>{"use strict";n.d(t,{Ax:()=>S,FC:()=>k,Mn:()=>M,Pu:()=>y,WJ:()=>p,dR:()=>O,k9:()=>b,nd:()=>x,nj:()=>N,vs:()=>a,wx:()=>j});var r=n(2665);const o=Math.pow(2,16);function i(e){return 65535&e}class s{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class l{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&l.empty)return l.empty}recover(e){let t=0,n=i(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/o}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[a+i],h=this.ranges[a+l],d=c+u;if(e<=d){let i=c+r+((u?e==c?-1:e==d?1:t:t)<0?0:h);if(n)return i;let l=e==c?2:e==d?1:4;return(t<0?e!=c:e!=d)&&(l|=8),new s(i,l,e==(t<0?c:d)?null:a/3+(e-c)*o)}r+=h-u}return n?e+r:new s(e+r,0,null)}touches(e,t){let n=0,r=i(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let i=this.ranges[t]-(this.inverted?n:0);if(i>e)break;let l=this.ranges[t+o];if(e<=i+l&&t==3*r)return!0;n+=this.ranges[t+s]-l}return!1}forEach(e){let t=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+t],c=this.ranges[r+n];e(s,s+a,l,l+c),o+=c-a}}invert(){return new l(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?l.empty:new l(e<0?[0,-e,0]:[0,0,e])}}l.empty=new l([]);class a{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new a(this.maps,this.mirror,e,t)}copy(){return new a(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new a;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this.maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new s(e,r,null)}}const c=Object.create(null);class u{getMap(){return l.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=c[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in c)throw new RangeError("Duplicate use of step JSON ID "+e);return c[e]=t,t.prototype.jsonID=e,t}}class h{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new h(e,null)}static fail(e){return new h(null,e)}static fromReplace(e,t,n,o){try{return h.ok(e.replace(t,n,o))}catch(e){if(e instanceof r.e4)return h.fail(e.message);throw e}}}function d(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(d(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return r.HY.fromArray(o)}class p extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.p2(d(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),o),t.openStart,t.openEnd);return h.fromReplace(e,this.from,this.to,i)}invert(){return new f(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new p(t.pos,n.pos,this.mark)}merge(e){return e instanceof p&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new p(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new p(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("addMark",p);class f extends u{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.p2(d(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return h.fromReplace(e,this.from,this.to,n)}invert(){return new p(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new f(t.pos,n.pos,this.mark)}merge(e){return e instanceof f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new f(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(t.from,t.to,e.markFromJSON(t.mark))}}u.jsonID("removeMark",f);class m extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return h.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return h.fromReplace(e,this.pos,this.pos+1,new r.p2(r.HY.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new m(this.pos,t.marks[n]);return new m(this.pos,this.mark)}}return new g(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new m(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new m(t.pos,e.markFromJSON(t.mark))}}u.jsonID("addNodeMark",m);class g extends u{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return h.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return h.fromReplace(e,this.pos,this.pos+1,new r.p2(r.HY.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new m(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new g(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new g(t.pos,e.markFromJSON(t.mark))}}u.jsonID("removeNodeMark",g);class y extends u{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&w(e,this.from,this.to)?h.fail("Structure replace would overwrite content"):h.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new l([this.from,this.to-this.from,this.slice.size])}invert(e){return new y(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new y(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof y)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?r.p2.empty:new r.p2(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new y(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?r.p2.empty:new r.p2(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new y(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new y(t.from,t.to,r.p2.fromJSON(e,t.slice),!!t.structure)}}u.jsonID("replace",y);class k extends u{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(w(e,this.from,this.gapFrom)||w(e,this.gapTo,this.to)))return h.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return h.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?h.fromReplace(e,this.from,this.to,n):h.fail("Content does not fit in gap")}getMap(){return new l([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new k(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new k(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new k(t.from,t.to,t.gapFrom,t.gapTo,r.p2.fromJSON(e,t.slice),t.insert,!!t.structure)}}function w(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function v(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function b(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!v(r,o,i))break}return null}function x(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<o;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return i?o.map(C).concat({type:t,attrs:n}).concat(i.map(C)):null}function C(e){return{type:e,attrs:null}}function S(e,t,n=1,r){let o=e.resolve(t),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 e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),l=r&&r[t]||n;if(l!=n&&(s=s.replaceChild(0,l.type.create(l.attrs))),!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))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 M(e,t){let n=e.resolve(t),r=n.index();return o=n.nodeBefore,i=n.nodeAfter,!(!o||!i||o.isLeaf||!o.canAppend(i))&&n.parent.canReplace(r,r+1);var o,i}function N(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);l=e&&s.canReplaceWith(i,i,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function O(e,t,n=t,o=r.p2.empty){if(t==n&&!o.size)return null;let i=e.resolve(t),s=e.resolve(n);return T(i,s,o)?new y(t,n,o):new A(i,s,o).fit()}function T(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}u.jsonID("replaceAround",k);class A{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.HY.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.HY.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let i=this.placed,s=n.depth,l=o.depth;for(;s&&l&&1==i.childCount;)i=i.firstChild.content,s--,l--;let a=new r.p2(i,s,l);return e>-1?new k(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new y(n.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,o=null;n?(o=I(this.unplaced.content,n-1).firstChild,e=o.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let s,{type:l,match:a}=this.frontier[e],c=null;if(1==t&&(i?a.matchType(i.type)||(c=a.fillBefore(r.HY.from(i),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:e,parent:o,inject:c};if(2==t&&i&&(s=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:o,wrap:s};if(o&&a.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=I(e,t);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new r.p2(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=I(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new r.p2(E(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r.p2(E(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,l=n?n.content:s.content,a=s.openStart-e,c=0,u=[],{match:h,type:d}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)u.push(o.child(e));h=h.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let e=l.child(c),t=h.matchType(e.type);if(!t)break;c++,(c>1||0==a||e.content.size)&&(h=t,u.push(F(e.mark(d.allowedMarks(e.marks)),1==c?a:0,c==l.childCount?p:-1)))}let f=c==l.childCount;f||(p=-1),this.placed=D(this.placed,t,r.HY.from(u)),this.frontier[t].match=h,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=l;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?r.p2.empty:new r.p2(E(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r.p2(E(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!R(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=R(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=R(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=D(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=D(this.placed,this.depth,r.HY.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.HY.empty,!0);e.childCount&&(this.placed=D(this.placed,this.frontier.length,e))}}function E(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(E(e.firstChild.content,t-1,n)))}function D(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(D(e.lastChild.content,t-1,n)))}function I(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function F(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,F(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.HY.empty,!0)))),e.copy(o)}function R(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?l:null}function z(e){return e.spec.defining||e.spec.definingForContent}function B(e,t,n,o,i){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(B(r.content,t+1,n,o,r)))}if(t>o){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.HY.empty,!0))}return e}function P(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class L extends u{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return h.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return h.fromReplace(e,this.pos,this.pos+1,new r.p2(r.HY.from(o),0,t.isLeaf?0:1))}getMap(){return l.empty}invert(e){return new L(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new L(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new L(t.pos,t.attr,t.value)}}u.jsonID("attr",L);let $=class extends Error{};$=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},($.prototype=Object.create(Error.prototype)).constructor=$,$.prototype.name="TransformError";class j{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new a}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.p2.empty){let o=O(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new r.p2(r.HY.from(n),0,0))}delete(e,t){return this.replace(e,t,r.p2.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(T(i,s,o))return e.step(new y(t,n,o));let l=P(i,e.doc.resolve(n));0==l[l.length-1]&&l.pop();let a=-(i.depth+1);l.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;l.indexOf(e)>-1?a=e:i.before(e)==t&&l.splice(1,0,-e)}let c=l.indexOf(a),u=[],h=o.openStart;for(let e=o.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==o.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){let t=u[e].type,n=z(t);if(n&&i.node(c).type!=t)h=e;else if(n||!t.isTextblock)break}for(let t=o.openStart;t>=0;t--){let a=(t+h+1)%(o.openStart+1),d=u[a];if(d)for(let t=0;t<l.length;t++){let u=l[(t+c)%l.length],h=!0;u<0&&(h=!1,u=-u);let p=i.node(u-1),f=i.index(u-1);if(p.canReplaceWith(f,f,d.type,d.marks))return e.replace(i.before(u),h?s.after(u):n,new r.p2(B(o.content,0,o.openStart,a),a,o.openEnd))}}let d=e.steps.length;for(let r=l.length-1;r>=0&&(e.replace(t,n,o),!(e.steps.length>d));r--){let e=l[r];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new r.p2(r.HY.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=P(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:i,depth:s}=t,l=o.before(s+1),a=i.after(s+1),c=l,u=a,h=r.HY.empty,d=0;for(let e=s,t=!1;e>n;e--)t||o.index(e)>0?(t=!0,h=r.HY.from(o.node(e).copy(h)),d++):c--;let p=r.HY.empty,f=0;for(let e=s,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=r.HY.from(i.node(e).copy(p)),f++):u++;e.step(new k(c,u,l,a,new r.p2(h.append(p),d,f),h.size-d,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=new y(t-n,t+n,r.p2.empty,!0);e.step(o)}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=r.HY.empty;for(let e=n.length-1;e>=0;e--){if(o.size){let t=n[e].type.contentMatch.matchFragment(o);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.HY.from(n[e].type.create(n[e].attrs,o))}let i=t.start,s=t.end;e.step(new k(i,s,i,s,new r.p2(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(o,i)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(n),o)){e.clearIncompatible(e.mapping.slice(s).map(n,1),o);let l=e.mapping.slice(s),a=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new k(a,c,a+1,c-1,new r.p2(r.HY.from(o.create(i,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o){return function(e,t,n,o,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(o,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new k(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.p2(r.HY.from(l),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new L(e,t,n)),this}addNodeMark(e,t){return this.step(new m(e,t)),this}removeNodeMark(e,t){if(!(t instanceof r.vc)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new g(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let i=e.doc.resolve(t),s=r.HY.empty,l=r.HY.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){s=r.HY.from(i.node(e).copy(s));let t=o&&o[a];l=r.HY.from(t?t.type.create(t.attrs,l):i.node(e).copy(l))}e.step(new y(t,t,new r.p2(s.append(l),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],l=[];e.doc.nodesBetween(t,n,((e,a,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,t),h=Math.min(a+e.nodeSize,n),d=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(d)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=h:s.push(o=new f(c,h,u[e])));i&&i.to==c?i.to=h:l.push(i=new p(c,h,r))}})),s.forEach((t=>e.step(t))),l.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let i=[],s=0;e.doc.nodesBetween(t,n,((e,l)=>{if(!e.isInline)return;s++;let a=null;if(o instanceof r.ZU){let t,n=e.marks;for(;t=o.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(a=[o]):a=e.marks;if(a&&a.length){let r=Math.min(l+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,o=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&o.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(l,t),to:r,step:s})}}})),i.forEach((t=>e.step(new f(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,o=n.contentMatch){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let t=0;t<i.childCount;t++){let a=i.child(t),c=l+a.nodeSize,u=o.matchType(a.type);if(u){o=u;for(let t=0;t<a.marks.length;t++)n.allowsMarkType(a.marks[t].type)||e.step(new f(l,c,a.marks[t]))}else s.push(new y(l,c,r.p2.empty));l=c}if(!o.validEnd){let t=o.fillBefore(r.HY.empty,!0);e.replace(l,l,new r.p2(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}(this,e,t,n),this}}},2780:(e,t,n)=>{"use strict";n.d(t,{EH:()=>$t,p:()=>Bt,tk:()=>ln});var r=n(7191),o=n(2665),i=n(6151);const s=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},l=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let a=null;const c=function(e,t,n){let r=a||(a=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},u=function(e,t,n,r){return n&&(d(e,t,n,r,-1)||d(e,t,n,r,1))},h=/^(img|br|input|textarea|hr)$/i;function d(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:p(e))){let n=e.parentNode;if(!n||1!=n.nodeType||f(e)||h.test(e.nodeName)||"false"==e.contentEditable)return!1;t=s(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?p(e):0}}}function p(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const m=function(e){return e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function g(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const y="undefined"!=typeof navigator?navigator:null,k="undefined"!=typeof document?document:null,w=y&&y.userAgent||"",v=/Edge\/(\d+)/.exec(w),b=/MSIE \d/.exec(w),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w),C=!!(b||x||v),S=b?document.documentMode:x?+x[1]:v?+v[1]:0,M=!C&&/gecko\/(\d+)/i.test(w);M&&(/Firefox\/(\d+)/.exec(w)||[0,0])[1];const N=!C&&/Chrome\/(\d+)/.exec(w),O=!!N,T=N?+N[1]:0,A=!C&&!!y&&/Apple Computer/.test(y.vendor),E=A&&(/Mobile\/\w+/.test(w)||!!y&&y.maxTouchPoints>2),D=E||!!y&&/Mac/.test(y.platform),I=!!y&&/Win/.test(y.platform),F=/Android \d/.test(w),R=!!k&&"webkitFontSmoothing"in k.documentElement.style,z=R?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function B(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function P(e,t){return"number"==typeof e?e:e[t]}function L(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function $(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=l(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,l=n?B(i):L(e),a=0,c=0;if(t.top<l.top+P(r,"top")?c=-(l.top-t.top+P(o,"top")):t.bottom>l.bottom-P(r,"bottom")&&(c=t.bottom-l.bottom+P(o,"bottom")),t.left<l.left+P(r,"left")?a=-(l.left-t.left+P(o,"left")):t.right>l.right-P(r,"right")&&(a=t.right-l.right+P(o,"right")),a||c)if(n)i.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n)break}}function j(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=l(r));return t}function H(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let V=null;function _(e,t){let n,r,o,i,s=2e8,l=0,a=t.top,u=t.top;for(let h=e.firstChild,d=0;h;h=h.nextSibling,d++){let e;if(1==h.nodeType)e=h.getClientRects();else{if(3!=h.nodeType)continue;e=c(h).getClientRects()}for(let c=0;c<e.length;c++){let p=e[c];if(p.top<=a&&p.bottom>=u){a=Math.max(p.bottom,a),u=Math.min(p.top,u);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=h,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==h.nodeType&&e&&(l=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=h,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(l=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=U(r,1);if(n.top!=n.bottom&&W(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:l}:_(n,r)}function W(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function q(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(W(t,o))return q(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function K(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!W(t,n))return null;if(a=q(e.dom,t,n),!a)return null}if(A)for(let e=a;n&&e;e=l(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(M&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!i||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!i&&(i=!0,e.left>r.left||e.top>r.top?o=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(o=t.posAfter)),!t.contentDOM&&o<0)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}n=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=_(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let c=e.docView.nearestDesc(a,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Y(e){return e.top<e.bottom||e.left<e.right}function U(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Y(e))return e}return Array.prototype.find.call(n,Y)||e.getBoundingClientRect()}const J=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function G(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=R||M;if(3==r.nodeType){if(!s||!J.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Z(U(c(r,e,t),i),i<0)}{let e=U(c(r,o,o),n);if(M&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=U(c(r,o-1,o-1),-1);if(t.top==e.top){let n=U(c(r,o,o+1),-1);if(n.top!=e.top)return Z(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return X(e.getBoundingClientRect(),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];if(1==e.nodeType)return X(e.getBoundingClientRect(),!0)}return X(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==p(r))){let e=r.childNodes[o-1],t=3==e.nodeType?c(e,p(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Z(U(t,1),!1)}if(null==i&&o<p(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?c(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Z(U(t,-1),!0)}return Z(U(3==r.nodeType?c(r):r,-n),n>=0)}function Z(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function X(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Q(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const ee=/[\u0590-\u08ac]/;let te=null,ne=null,re=!1;class oe{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof he){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof ie&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?s(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?s(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,l=0;;l++){let n=this.children[l],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=l;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||l==this.children.length-1)){t=a;for(let e=l+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],c=l+a.size;if(o>l&&i<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.getSelection(),c=!1;if((M||A)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType)c=!(!t||"\n"!=e.nodeValue[t-1]);else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(M&&a.focusNode&&a.focusNode!=l.node&&1==a.focusNode.nodeType){let e=a.focusNode.childNodes[a.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&A)&&u(s.node,s.offset,a.anchorNode,a.anchorOffset)&&u(l.node,l.offset,a.focusNode,a.focusOffset))return;let h=!1;if((a.extend||e==t)&&!c){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class ie extends oe{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.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 se extends oe{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class le extends oe{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=o.PW.renderSpec(document,t.type.spec.toDOM(t,n))),new le(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=le.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Se(o,t,i,n)),e>0&&(o=Se(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}}class ae extends oe{constructor(e,t,n,r,o,i,s,l,a){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,s){let l,a=i.nodeViews[t.type.name],c=a&&a(t,i,(()=>l?l.parent?l.parent.posBeforeChild(l):void 0:s),n,r),u=c&&c.dom,h=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else u||({dom:u,contentDOM:h}=o.PW.renderSpec(document,t.type.spec.toDOM(t)));h||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=we(u,n,t),c?l=new de(e,t,n,r,u,h||null,d,c,i,s+1):t.isText?new ue(e,t,n,r,u,d,i):new ae(e,t,n,r,u,h||null,d,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>o.HY.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ve(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new xe(this,s&&s.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.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 e,t=o[s++];for(;s<o.length&&o[s].to==i;)(e||(e=[t])).push(o[s++]);if(e){e.sort(Ce);for(let t=0;t<e.length;t++)n(e[t],c,!!a)}else n(t,c,!!a)}let u,h;if(a)h=-1,u=a,a=null;else{if(!(c<e.childCount))break;h=c,u=e.child(c++)}for(let e=0;e<l.length;e++)l[e].to<=i&&l.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let d=i+u.nodeSize;if(u.isText){let e=d;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<d&&(a=u.cut(e-i),u=u.cut(0,e-i),d=e,h=-1)}r(u,u.isInline&&!u.isLeaf?l.filter((e=>!e.inline)):l.slice(),t.forChild(i,u),h),i=d}}(this.node,this.innerDeco,((t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?o.vc.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)}),((t,o,s,c)=>{let u;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,o,s,c)||l&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,s,u,e)||a.updateNextNode(t,o,s,e,c,r)||a.addNode(t,o,s,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),pe(this.contentDOM,this.children,e),E&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof r.Bs)||n<t||o>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=p(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,r=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;a+=t.text}if(i>=n){let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return-1}(this.node.content,e,n-t,o-t);return r<0?null:{node:s,pos:r,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new se(this,o,t,r);e.input.compositionNodes.push(i),this.children=Se(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ve(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ye(this.dom,this.nodeDOM,ge(this.outerDeco,this.node,t),ge(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}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 ce(e,t,n,r,o){we(r,t,e);let i=new ae(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class ue extends ae{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new ue(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class he extends oe{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class de extends ae{constructor(e,t,n,r,o,i,s,l,a,c){super(e,t,n,r,o,i,s,a,c),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function pe(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==e){for(;l!=r;)r=be(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(s instanceof le){let t=r?r.previousSibling:e.lastChild;pe(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=be(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const fe=function(e){e&&(this.nodeName=e)};fe.prototype=Object.create(null);const me=[new fe];function ge(e,t,n){if(0==e.length)return me;let r=n?me[0]:new fe,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new fe(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new fe(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ye(e,t,n,r){if(n==me&&r==me)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=me[0]),o=t}ke(o,s||me[0],i)}return o}function ke(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function we(e,t,n){return ye(e,e,me,ge(t,n,1!=e.nodeType))}function ve(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function be(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class xe{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof le)){l=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;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=le.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof ae){let a=this.preMatch.matched.get(l);if(null!=a&&a!=o)return!1;let c,u=l.dom,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&ve(t,l.outerDeco));if(!h&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,e,t,n,r,i)))return this.top.children[this.index]=c,c.dirty=2,c.updateChildren(r,i+1),c.dirty=0,this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let s=ae.create(this.top,t,n,r,o,i);if(!s.contentDOM)return null;s.children=e.children,e.children=[];for(let e of s.children)e.parent=s;return s}addNode(e,t,n,r,o){let i=ae.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ie(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof le;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ue)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((A||O)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new he(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ce(e,t){return e.type.side-t.type.side}function Se(e,t,n,r,o){let i=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,u=l+=a.size;c>=n||u<=t?i.push(a):(c<t&&i.push(a.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Me(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),l=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let c,u,h=o.resolve(a);if(m(n)){for(c=h;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&r.qv.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==p(e);r||o;){if(e==n)return!0;let t=s(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==p(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new r.qv(a==e?h:o.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;c=o.resolve(t)}return u||(u=Re(e,c,h,"pointer"==t||e.state.selection.head<h.pos&&!l?1:-1)),u}function Ne(e){return e.editable?e.hasFocus():Be(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Oe(e,t=!1){let n=e.state.selection;if(Ie(e,n),Ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&O){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&u(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,s(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&C&&S<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let o,i,{anchor:s,head:l}=n;!Te||n instanceof r.Bs||(n.$from.parent.inlineContent||(o=Ae(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Ae(e,n.to))),e.docView.setSelection(s,l,e.root,t),Te&&(o&&De(o),i&&De(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Ne(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Te=A||O&&T<63;function Ae(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(A&&o&&"false"==o.contentEditable)return Ee(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Ee(o);if(i)return Ee(i)}}function Ee(e){return e.contentEditable="true",A&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function De(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Ie(e,t){if(t instanceof r.qv){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Fe(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Fe(e)}function Fe(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Re(e,t,n,o){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||r.Bs.between(t,n,o)}function ze(e){return!(e.editable&&!e.hasFocus())&&Be(e)}function Be(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Pe(e,t){let{$anchor:n,$head:o}=e.selection,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&r.Y1.findFrom(s,t)}function Le(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $e(e,t,n){let o=e.state.selection;if(!(o instanceof r.Bs)){if(o instanceof r.qv&&o.node.isInline)return Le(e,new r.Bs(t>0?o.$to:o.$from));{let n=Pe(e.state,t);return!!n&&Le(e,n)}}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Pe(e.state,t);return!!(n&&n instanceof r.qv)&&Le(e,n)}if(!(D&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let l=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(l))&&!n.contentDOM)&&(r.qv.isSelectable(s)?Le(e,new r.qv(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!R&&Le(e,new r.Bs(e.state.doc.resolve(t<0?l:l+s.nodeSize))))}}function je(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function He(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Ve(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,l=!1;for(M&&1==n.nodeType&&r<je(n)&&He(n.childNodes[r])&&(l=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(He(e))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(We(n))break;{let t=n.previousSibling;for(;t&&He(t);)o=n.parentNode,i=s(t),t=t.previousSibling;if(t)n=t,r=je(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}l?qe(e,n,r):o&&qe(e,o,i)}(e):_e(e)}function _e(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,l=je(n);for(;;)if(r<l){if(1!=n.nodeType)break;if(!He(n.childNodes[r]))break;o=n,i=++r}else{if(We(n))break;{let t=n.nextSibling;for(;t&&He(t);)o=t.parentNode,i=s(t)+1,t=t.nextSibling;if(t)n=t,r=0,l=je(n);else{if(n=n.parentNode,n==e.dom)break;r=l=0}}}o&&qe(e,o,i)}function We(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function qe(e,t,n){let r=e.domSelection();if(m(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&Oe(e)}),50)}function Ke(e,t){let n=e.state.doc.resolve(t);if(!O&&!I&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Ye(e,t,n){let o=e.state.selection;if(o instanceof r.Bs&&!o.empty||n.indexOf("s")>-1)return!1;if(D&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Pe(e.state,t);if(n&&n instanceof r.qv)return Le(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,l=o instanceof r.C1?r.Y1.near(n,t):r.Y1.findFrom(n,t);return!!l&&Le(e,l)}return!1}function Ue(e,t){if(!(e.state.selection instanceof r.Bs))return!0;let{$head:n,$anchor:o,empty:i}=e.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function Je(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ge(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let l=e.someProp("clipboardSerializer")||o.PW.fromSchema(e.state.schema),a=st(),c=a.createElement("div");c.appendChild(l.serializeFragment(r,{document:a}));let u,h=c.firstChild,d=0;for(;h&&1==h.nodeType&&(u=ot[h.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=a.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}h=c.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n")}}function Ze(e,t,n,r,i){let s,l,a=i.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||a||!n);if(c){if(e.someProp("transformPastedText",(n=>{t=n(t,a||r,e)})),a)return t?new o.p2(o.HY.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.p2.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,i,r,e)));if(n)l=n;else{let n=i.marks(),{schema:r}=e.state,l=o.PW.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(l.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=st().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&ot[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),R&&function(e){let t=e.querySelectorAll(O?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!l){let t=e.someProp("clipboardParser")||e.someProp("domParser")||o.aw.fromSchema(e.state.schema);l=t.parseSlice(s,{preserveWhitespace:!(!c&&!h),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Xe.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(h)l=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:l}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=o.HY.from(t.create(n[e+1],i)),s++,l++}return new o.p2(i,s,l)}(rt(l,+h[1],+h[2]),h[4]);else if(l=o.p2.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach((e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&et(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=tt(s[s.length-1],r.length));let t=Qe(e,n);s.push(t),i=i.matchType(t.type),r=n}})),s)return o.HY.from(s)}return e}(l.content,i),!0),l.openStart||l.openEnd){let e=0,t=0;for(let t=l.content.firstChild;e<l.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=l.content.lastChild;t<l.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);l=rt(l,e,t)}return e.someProp("transformPasted",(t=>{l=t(l,e)})),l}const Xe=/^(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 Qe(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,o.HY.from(e));return e}function et(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=et(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(o.HY.from(Qe(n,e,i+1))))}}function tt(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,tt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(o.HY.empty,!0);return e.copy(n.append(r))}function nt(e,t,n,r,i,s){let l=t<0?e.firstChild:e.lastChild,a=l.content;return e.childCount>1&&(s=0),i<r-1&&(a=nt(a,t,n,r,i+1,s)),i>=n&&(a=t<0?l.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(o.HY.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function rt(e,t,n){return t<e.openStart&&(e=new o.p2(nt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.p2(nt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const ot={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 it=null;function st(){return it||(it=document.implementation.createHTMLDocument("title"))}const lt={},at={},ct={touchstart:!0,touchmove:!0};class ut{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.compositionID=1,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ht(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function dt(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>pt(e,t))}))}function pt(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function ft(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function mt(e){return{left:e.clientX,top:e.clientY}}function gt(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function yt(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function kt(e,t,n,r){return gt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function wt(e,t,n,o){return gt(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(n=>n(e,t,o)))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(yt(e,r.Bs.create(o,0,o.content.size),"pointer"),!0);let i=o.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),s=i.before(t);if(n.inlineContent)yt(e,r.Bs.create(o,s+1,s+1+n.content.size),"pointer");else{if(!r.qv.isSelectable(n))continue;yt(e,r.qv.create(o,s),"pointer")}return!0}}(e,n,o)}function vt(e){return Ot(e)}at.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Ct(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!F||!O||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!E||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||D&&72==n&&"c"==r)return Ue(e,-1)||Ve(e,-1);if(46==n||D&&68==n&&"c"==r)return Ue(e,1)||Ve(e,1);if(13==n||27==n)return!0;if(37==n||D&&66==n&&"c"==r){let t=37==n?"ltr"==Ke(e,e.state.selection.from)?-1:1:-1;return $e(e,t,r)||Ve(e,t)}if(39==n||D&&70==n&&"c"==r){let t=39==n?"ltr"==Ke(e,e.state.selection.from)?1:-1:1;return $e(e,t,r)||Ve(e,t)}return 38==n||D&&80==n&&"c"==r?Ye(e,-1,r)||Ve(e,-1):40==n||D&&78==n&&"c"==r?function(e){if(!A||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Je(e,n,"true"),setTimeout((()=>Je(e,n,"false")),20)}return!1}(e)||Ye(e,1,r)||_e(e):r==(D?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():ht(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},at.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},at.keypress=(e,t)=>{let n=t;if(Ct(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||D&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof r.Bs&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,o.$from.pos,o.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const bt=D?"metaKey":"ctrlKey";lt.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=vt(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[bt]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(mt(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new xt(e,s,n,!!r)):("doubleClick"==i?kt:wt)(e,s.pos,s.inside,n)?n.preventDefault():ht(e,"pointer"))};class xt{constructor(e,t,n,o){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[bt],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const l=o?null:n.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:c}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.qv&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ht(e,"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((()=>Oe(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(mt(e))),this.updateAllowDefault(e),this.allowDefault||!t?ht(this.view,"pointer"):function(e,t,n,o,i){return gt(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(n=>n(e,t,o)))||(i?function(e,t){if(-1==t)return!1;let n,o,i=e.state.selection;i instanceof r.qv&&(n=i.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(r.qv.isSelectable(t)){o=n&&i.$from.depth>0&&e>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(e);break}}return null!=o&&(yt(e,r.qv.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.qv.isSelectable(o))&&(yt(e,new r.qv(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||O&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(yt(this.view,r.Y1.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):ht(this.view,"pointer")}move(e){this.updateAllowDefault(e),ht(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Ct(e,t){return!!e.composing||!!(A&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}lt.touchstart=e=>{e.input.lastTouch=Date.now(),vt(e),ht(e,"pointer")},lt.touchmove=e=>{e.input.lastTouch=Date.now(),ht(e,"pointer")},lt.contextmenu=e=>vt(e);const St=F?5e3:-1;function Mt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Ot(e)),t))}function Nt(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Ot(e,t=!1){if(!(F&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Nt(e),t||e.docView&&e.docView.dirty){let t=Me(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}at.compositionstart=at.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Ot(e,!0),e.markCursor=null;else if(Ot(e),M&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Mt(e,St)},at.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,Mt(e,20))};const Tt=C&&S<15||E&&z<604;function At(e,t,n,r,i){let s=Ze(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,i,s||o.p2.empty))))return!0;if(!s)return!1;let l=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),a=l?e.state.tr.replaceSelectionWith(l,e.input.shiftKey):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}lt.copy=at.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Tt?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Ge(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,l),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},at.paste=(e,t)=>{let n=t;if(e.composing&&!F)return;let r=Tt?null:n.clipboardData;r&&At(e,r.getData("text/plain"),r.getData("text/html"),e.input.shiftKey,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?At(e,r.value,null,e.input.shiftKey,t):At(e,r.textContent,r.innerHTML,e.input.shiftKey,t)}),50)}(e,n)};class Et{constructor(e,t){this.slice=e,this.move=t}}const Dt=D?"altKey":"ctrlKey";lt.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(mt(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof r.qv?i.to-1:i.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(r.qv.create(e.state.doc,o.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(r.qv.create(e.state.doc,t.posBefore)))}let l=e.state.selection.content(),{dom:a,text:c}=Ge(e,l);n.dataTransfer.clearData(),n.dataTransfer.setData(Tt?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Tt||n.dataTransfer.setData("text/plain",c),e.dragging=new Et(l,!n[Dt])},lt.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},at.dragover=at.dragenter=(e,t)=>t.preventDefault(),at.drop=(e,t)=>{let n=t,s=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let l=e.posAtCoords(mt(n));if(!l)return;let a=e.state.doc.resolve(l.pos),c=s&&s.slice;c?e.someProp("transformPasted",(t=>{c=t(c,e)})):c=Ze(e,n.dataTransfer.getData(Tt?"Text":"text/plain"),Tt?null:n.dataTransfer.getData("text/html"),!1,a);let u=!(!s||n[Dt]);if(e.someProp("handleDrop",(t=>t(e,n,c||o.p2.empty,u))))return void n.preventDefault();if(!c)return;n.preventDefault();let h=c?(0,i.nj)(e.state.doc,a.pos,c):a.pos;null==h&&(h=a.pos);let d=e.state.tr;u&&d.deleteSelection();let p=d.mapping.map(h),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=d.doc;if(f?d.replaceRangeWith(p,p,c.content.firstChild):d.replaceRange(p,p,c),d.doc.eq(m))return;let g=d.doc.resolve(p);if(f&&r.qv.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))d.setSelection(new r.qv(g));else{let t=d.mapping.map(h);d.mapping.maps[d.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),d.setSelection(Re(e,g,d.doc.resolve(t)))}e.focus(),e.dispatch(d.setMeta("uiEvent","drop"))},lt.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Oe(e)}),20))},lt.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},lt.beforeinput=(e,t)=>{if(O&&F&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in at)lt[e]=at[e];function It(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Ft{constructor(e,t){this.toDOM=e,this.spec=t||Lt,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Bt(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ft&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&It(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Rt{constructor(e,t){this.attrs=e,this.spec=t||Lt}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Bt(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Rt&&It(this.attrs,e.attrs)&&It(this.spec,e.spec)}static is(e){return e.type instanceof Rt}destroy(){}}class zt{constructor(e,t){this.attrs=e,this.spec=t||Lt}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Bt(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof zt&&It(this.attrs,e.attrs)&&It(this.spec,e.spec)}destroy(){}}class Bt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Bt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Bt(e,e,new Ft(t,n))}static inline(e,t,n,r){return new Bt(e,t,new Rt(n,r))}static node(e,t,n,r){return new Bt(e,t,new zt(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Rt}}const Pt=[],Lt={};class $t{constructor(e,t){this.local=e.length?e:Pt,this.children=t.length?t:Pt}static create(e,t){return t.length?qt(t,e,0,Lt):jt}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!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]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==jt||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Lt)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let l=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,i,s)=>{let a=s-i-(n-e);for(let s=0;s<l.length;s+=3){let c=l[s+1];if(c<0||e>c+t-r)continue;let u=l[s]+t-r;n>=u?l[s+1]=e<=u?-2:-1:i>=o&&a&&(l[s]+=a,l[s+1]+=a)}r+=a})),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+i),u=c-o;if(u<0||u>=r.content.size){a=!0;continue}let h=n.map(e[t+1]+i,-1)-o,{index:d,offset:p}=r.content.findIndex(u),f=r.maybeChild(d);if(f&&p==u&&p+f.nodeSize==h){let r=l[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=jt?(l[t]=u,l[t+1]=h,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=function(e,t,n,r,o,i,s){function l(e,t){for(let i=0;i<e.local.length;i++){let l=e.local[i].map(r,o,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)l(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&l(e[n+2],t[n]+i+1);return n}(l,e,t,n,o,i,s),c=qt(a,r,0,s);t=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new $t(t.sort(Kt),l)}(this.children,i||[],e,t,n,r,o):i?new $t(i.sort(Kt),Pt):jt}add(e,t){return t.length?this==jt?$t.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,l=i+n;if(s=_t(t,e,l)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,i,i+e.nodeSize,qt(s,e,l+1,Lt)),o+=3}}));let i=Vt(o?Wt(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new $t(i.length?this.local.concat(i).sort(Kt):this.local,r||this.children)}remove(e){return 0==e.length||this==jt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(o,i+1);l!=jt?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $t(r,n):jt}forChild(e,t){if(this==jt)return this;if(t.isLeaf)return $t.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Rt){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 e=new $t(r.sort(Kt),Pt);return n?new Ht([e,n]):e}return n||jt}eq(e){if(this==e)return!0;if(!(e instanceof $t)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Yt(this.localsInner(e))}localsInner(e){if(this==jt)return Pt;if(e.inlineContent||!this.local.some(Rt.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Rt||t.push(this.local[e]);return t}}$t.empty=new $t([],[]),$t.removeOverlap=Yt;const jt=$t.empty;class Ht{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,Lt)));return Ht.from(n)}forChild(e,t){if(t.isLeaf)return $t.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=jt&&(o instanceof Ht?n=n.concat(o.members):n.push(o))}return Ht.from(n)}eq(e){if(!(e instanceof Ht)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Yt(n?t:t.sort(Kt)):Pt}static from(e){switch(e.length){case 0:return jt;case 1:return e[0];default:return new Ht(e.every((e=>e instanceof $t))?e:e.reduce(((e,t)=>e.concat(t instanceof $t?t:t.members)),[]))}}}function Vt(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Bt(o.from+t,o.to+t,o.type))}return n}function _t(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Wt(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function qt(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let l=_t(e,t,s+n);if(l){i=!0;let e=qt(l,t,n+s+1,r);e!=jt&&o.push(s,s+t.nodeSize,e)}}));let s=Vt(i?Wt(e):e,-n).sort(Kt);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new $t(s,o):jt}function Kt(e,t){return e.from-t.from||e.to-t.to}function Yt(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Ut(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Ut(t,o+1,i.copy(r.to,i.to)))}}return t}function Ut(e,t,n){for(;t<e.length&&Kt(n,e[t])>0;)t++;e.splice(t,0,n)}function Jt(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=jt&&t.push(r)})),e.cursorWrapper&&t.push($t.create(e.state.doc,[e.cursorWrapper.deco])),Ht.from(t)}const Gt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Zt=C&&S<=11;class Xt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Qt{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Xt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);C&&S<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Zt&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Gt)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(ze(this.view)){if(this.suppressingSelectionUpdates)return Oe(this.view);if(C&&S<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=l(t))n.add(t);for(let r=e.anchorNode;r;r=l(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ze(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(i=i<0?n.from:Math.min(n.from,i),s=s<0?n.to:Math.max(n.to,s),n.typeOver&&(l=!0))}if(M&&a.length>1){let e=a.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&m(n)&&(c=Me(e))&&c.eq(r.Y1.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Oe(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!en.has(e)&&(en.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=M,tn)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."),tn=!0}}(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Oe(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(C&&S<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?s(r)+1:0,l=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?s(o):e.target.childNodes.length;return{from:l,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let en=new WeakMap,tn=!1;function nn(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(A&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||A&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const rn=/^(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 on(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Re(e,t.resolve(n.anchor),t.resolve(n.head))}function sn(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class ln{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ut,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(dn),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=un(this),cn(this),this.nodeViews=hn(this),this.docView=ce(this.state.doc,an(this),Jt(this),this.dom,this),this.domObserver=new Qt(this,((e,t,n,i)=>function(e,t,n,i,s){if(t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Me(e,t);if(n&&!e.state.selection.eq(n)){if(O&&F&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),e.composing&&r.setMeta("composition",e.input.compositionID),e.dispatch(r)}return}let l=e.state.doc.resolve(t),a=l.sharedDepth(n);t=l.before(a+1),n=e.state.doc.resolve(n).after(a+1);let c,u,h=e.state.selection,d=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:l,from:a,to:c}=e.docView.parseRange(t,n),u=e.domSelectionRange(),h=u.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:u.anchorOffset}],m(u)||r.push({node:u.focusNode,offset:u.focusOffset})),O&&8===e.input.lastKeyCode)for(let e=l;e>s;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){l=e;break}if(!n||n.size)break}let d=e.state.doc,p=e.someProp("domParser")||o.aw.fromSchema(e.state.schema),f=d.resolve(a),g=null,y=p.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:l,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:nn,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),g={anchor:e+a,head:t+a}}return{doc:y,sel:g,from:a,to:c}}(e,t,n),p=e.state.doc,f=p.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,u="end"):(c=e.state.selection.from,u="start"),e.input.lastKeyCode=null;let y=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&e.size<t.size?(i-=r<=i&&r>=s?i-r:0,l=i+(l-s),s=i):l<i&&(i-=r<=i&&r>=l?i-r:0,s=i+(s-l),l=i),{start:i,endA:s,endB:l}}(f.content,d.doc.content,d.from,c,u);if((E&&e.input.lastIOSEnter>Date.now()-225||F)&&s.some((e=>1==e.nodeType&&!rn.test(e.nodeName)))&&(!y||y.endA>=y.endB)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!y){if(!(i&&h instanceof r.Bs&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=on(e,e.state.doc,d.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);e.composing&&n.setMeta("composition",e.input.compositionID),e.dispatch(n)}}return}y={start:h.from,endA:h.to,endB:h.to}}if(O&&e.cursorWrapper&&d.sel&&d.sel.anchor==e.cursorWrapper.deco.from&&d.sel.head==d.sel.anchor){let e=y.endB-y.start;d.sel={anchor:d.sel.anchor+e,head:d.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof r.Bs&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),C&&S<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>d.from&&" "==d.doc.textBetween(y.start-d.from-1,y.start-d.from+1)&&(y.start--,y.endA--,y.endB--);let k,w=d.doc.resolveNoCache(y.start-d.from),v=d.doc.resolveNoCache(y.endB-d.from),b=p.resolve(y.start),x=w.sameParent(v)&&w.parent.inlineContent&&b.end()>=y.endA;if((E&&e.input.lastIOSEnter>Date.now()-225&&(!x||s.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!x&&w.pos<d.doc.content.size&&(k=r.Y1.findFrom(d.doc.resolve(w.pos+1),1,!0))&&k.head==v.pos)&&e.someProp("handleKeyDown",(t=>t(e,g(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>y.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||sn(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(sn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||sn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,y.start,y.endA,w,v)&&e.someProp("handleKeyDown",(t=>t(e,g(8,"Backspace")))))return void(F&&O&&e.domObserver.suppressSelectionUpdates());O&&F&&y.endB==y.start&&(e.input.lastAndroidDelete=Date.now()),F&&!x&&w.start()!=v.start()&&0==v.parentOffset&&w.depth==v.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==y.endA&&(y.endB-=2,v=d.doc.resolveNoCache(y.endB-d.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,g(13,"Enter"))}))}),20));let M,N,T,A=y.start,D=y.endA;if(x)if(w.pos==v.pos)C&&S<=11&&0==w.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Oe(e)),20)),M=e.state.tr.delete(A,D),N=p.resolve(y.start).marksAcross(p.resolve(y.endA));else if(y.endA==y.endB&&(T=function(e,t){let n,r,i,s=e.firstChild.marks,l=t.firstChild.marks,a=s,c=l;for(let e=0;e<l.length;e++)a=l[e].removeFromSet(a);for(let e=0;e<s.length;e++)c=s[e].removeFromSet(c);if(1==a.length&&0==c.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=c.length)return null;r=c[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(i(t.child(e)));if(o.HY.from(u).eq(e))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,y.endA-b.start()))))M=e.state.tr,"add"==T.type?M.addMark(A,D,T.mark):M.removeMark(A,D,T.mark);else if(w.parent.child(w.index()).isText&&w.index()==v.index()-(v.textOffset?0:1)){let t=w.parent.textBetween(w.parentOffset,v.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,A,D,t))))return;M=e.state.tr.insertText(t,A,D)}if(M||(M=e.state.tr.replace(A,D,d.doc.slice(y.start-d.from,y.endB-d.from))),d.sel){let t=on(e,M.doc,d.sel);t&&!(O&&F&&e.composing&&t.empty&&(y.start!=y.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==A||t.head==M.mapping.map(D)-1)||C&&t.empty&&t.head==A)&&M.setSelection(t)}N&&M.ensureMarks(N),e.composing&&M.setMeta("composition",e.input.compositionID),e.dispatch(M.scrollIntoView())}(this,e,t,n,i))),this.domObserver.start(),function(e){for(let t in lt){let n=lt[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ft(e,t)||pt(e,t)||!e.editable&&t.type in at||n(e,t)},ct[t]?{passive:!0}:void 0)}A&&e.dom.addEventListener("input",(()=>null)),dt(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&dt(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dn),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(Nt(this),o=!0),this.state=e;let i=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=hn(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&dt(this),this.editable=un(this),cn(this);let s=Jt(this),l=an(this),a=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(e.doc,l,s);!c&&e.selection.eq(n.selection)||(o=!0);let h="preserve"==a&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.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=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=o-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:j(e.dom)}}(this);if(o){this.domObserver.stop();let t=c&&(C||O)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(n.selection,e.selection);if(c){let n=O?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ce(e.doc,l,s,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return u(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Oe(this,t):(Ie(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==a?this.dom.scrollTop=0:"to selection"==a?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;H(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof r.qv){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&$(this,t.getBoundingClientRect(),e)}else $(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(C){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(V)return e.focus(V);let t=j(e);e.focus(null==V?{get preventScroll(){return V={preventScroll:!0},!0}}:void 0),V||(V=!1,H(t,0))}(this.dom),Oe(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)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 e||document}posAtCoords(e){return K(this,e)}coordsAtPos(e,t=1){return G(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return te==t&&ne==n?re:(te=t,ne=n,re="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Q(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=G(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=c(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];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}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=e.domSelection();return ee.test(r.parent.textContent)&&l.modify?Q(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:h}=e.domSelectionRange(),d=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==h;try{l.collapse(i,s),t&&(t!=i||o!=s)&&l.extend&&l.extend(t,o)}catch(e){}return null!=a&&(l.caretBidiLevel=a),d})):"left"==n||"backward"==n?i:s}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return At(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return At(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Jt(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(e){return function(e,t){pt(e,t)||!lt[t.type]||!e.editable&&t.type in at||lt[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return A&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,o=t.startOffset,i=t.endContainer,s=t.endOffset,l=e.domAtPos(e.state.selection.anchor);return u(l.node,l.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function an(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Bt.node(0,e.state.doc.content.size,t)]}function cn(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Bt.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function un(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function hn(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function dn(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}},7689:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});const r=function(e){if(null==e)return i;if("string"==typeof e)return t=e,o((function(e){return e&&e.type===t}));var t;if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=r(e[n]);return o((function(...e){let n=-1;for(;++n<t.length;)if(t[n].call(this,...e))return!0;return!1}))}(e):function(e){return o((function(t){let n;for(n in e)if(t[n]!==e[n])return!1;return!0}))}(e);if("function"==typeof e)return o(e);throw new Error("Expected function, string, or object as test")};function o(e){return function(t,...n){return Boolean(t&&"object"==typeof t&&"type"in t&&Boolean(e.call(this,t,...n)))}}function i(){return!0}},1104:(e,t,n)=>{"use strict";n.d(t,{BK:()=>o,AM:()=>i,S4:()=>s});var r=n(7689);const o=!1,i="skip",s=function(e,t,n,s){"function"==typeof t&&"function"!=typeof n&&(s=n,n=t,t=null);const l=(0,r.O)(t),a=s?-1:1;!function e(r,c,u){const h=r&&"object"==typeof r?r:{};if("string"==typeof h.type){const e="string"==typeof h.tagName?h.tagName:"string"==typeof h.name?h.name:void 0;Object.defineProperty(d,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return d;function d(){let h,d,p,f=[];if((!t||l(r,c,u[u.length-1]||null))&&(f=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:[e]}(n(r,u)),f[0]===o))return f;if(r.children&&f[0]!==i)for(d=(s?r.children.length:-1)+a,p=u.concat(r);d>-1&&d<r.children.length;){if(h=e(r.children[d],d,p)(),h[0]===o)return h;d="number"==typeof h[1]?h[1]:d+a}return f}}(e,void 0,[])()}},6355:(e,t,n)=>{"use strict";n.d(t,{Vn:()=>o});var r=n(1104);const o=function(e,t,n,o){"function"==typeof t&&"function"!=typeof n&&(o=n,n=t,t=null),(0,r.S4)(e,t,(function(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}),o)}}}]);
|
|
3
|
-
//# sourceMappingURL=369.304c9da8.js.map
|