s&&n.splice(o+1,0,new c(s,u.to))):u.to>s?n[o--]=new c(s,u.to):n.splice(o--,1))}return r}function H(e,t){var n,r=[],o=Object(i.a)(e);try{var a=function(){var e=n.value,i=e.pos,o=e.mount,a=e.frag,s=i+(o.overlay?o.overlay[0].from:0),u=s+o.tree.length,l=Math.max(a.from,s),f=Math.min(a.to,u);if(o.overlay)for(var h=o.overlay.map((function(e){return new c(e.from+i,e.to+i)})),d=function(e,t,n,r){for(var i=0,o=0,a=!1,s=!1,u=-1e9,l=[];;){var f=i==e.length?1e9:a?e[i].to:e[i].from,h=o==t.length?1e9:s?t[o].to:t[o].from;if(a!=s){var d=Math.max(u,n),p=Math.min(f,h,r);dm&&r.push(new F(m,v,o.tree,-s,a.from>=m,a.to<=v)),g)break;m=d[p].to}else r.push(new F(l,f,o.tree,-s,a.from>=s,a.to<=u))};for(o.s();!(n=o.n()).done;)a()}catch(s){o.e(s)}finally{o.f()}return r}},function(e,t,n){"use strict";function r(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(50);function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&Object(r.a)(e,t)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(32),i=n(83),o=n(84);function a(e){var t=Object(i.a)();return function(){var n,i=Object(r.a)(e);if(t){var a=Object(r.a)(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Object(o.a)(this,n)}}},function(e,t,n){"use strict";e.exports=n(139)},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(6);function i(e,t,n,i){var o=i?i-1:Number.POSITIVE_INFINITY,a=0;return function(i){if(Object(r.j)(i))return e.enter(n),s(i);return t(i)};function s(i){return Object(r.j)(i)&&a++]+)>/g,(function(e,t){return"$"+o[t]})))}if("function"==typeof i){var s=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=a()(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,s)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},c.apply(this,arguments)}var l,f,h,d,p,m,g,v,y,b,w,k,O,x,_,D,S,C=n(11),E=n(17),j=n(0),T=n(12),A=n(5),M=n(25),F=n(78),P=n(9),N=n(56),R=n(24),I=n(79),B=n(41),L=n(69),z=n(54),$={}.hasOwnProperty;function Q(e){var t,n,r,i,o=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return t=e,r=function(e){var t=q(e.identifier);t&&!$.call(o,t)&&(o[t]=e)},"function"===typeof(n="definition")&&"function"!==typeof r&&(i=r,r=n,n=null),Object(z.a)(t,n,(function(e,t){var n=t[t.length-1];return r(e,n?n.children.indexOf(e):null,n)}),i),function(e){var t=q(e);return t&&$.call(o,t)?o[t]:null}}function q(e){return String(e||"").toUpperCase()}function W(){return function(e){var t=Q(e);Object(B.a)(e,(function(e,n,r){if("definition"===e.type&&null!==r&&"number"===typeof n)return r.children.splice(n,1),[L.b,n];if("imageReference"===e.type||"linkReference"===e.type){var i=t(e.identifier);if(i&&null!==r&&"number"===typeof n){var o="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children};return r.children[n]=o,[L.b,n]}}}))}}var V=Object.defineProperty,U=Object.defineProperties,H=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,Z=function(e,t,n){return t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},K=function(e,t){for(var n in t||(t={}))X.call(t,n)&&Z(e,n,t[n]);if(Y){var r,i=Object(j.a)(Y(t));try{for(i.s();!(r=i.n()).done;){n=r.value;G.call(t,n)&&Z(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},J=function(e,t){return U(e,H(t))},ee={HardBreak:"HardBreak",Blockquote:"Blockquote",BulletList:"BulletList",OrderedList:"OrderedList",CodeFence:"CodeFence",H1:"H1",H2:"H2",H3:"H3",H4:"H4",H5:"H5",H6:"H6",Text:"Text",CodeInline:"CodeInline",Em:"Em",Bold:"Bold",NextListItem:"NextListItem",SinkListItem:"SinkListItem",LiftListItem:"LiftListItem"},te="code_inline",ne=Object(A.i)("ToggleInlineCode"),re=Object(T.d)((function(e){var t=e.getStyle((function(e,t){var n=e.palette,r=e.size,i=e.font;return(0,t.css)(l||(l=Object(E.a)(["\n background-color: ",";\n color: ",";\n border-radius: ",";\n font-weight: 500;\n font-family: ",";\n padding: 0 0.2rem;\n "])),n("neutral"),n("background"),r.radius,i.code)}));return{id:te,schema:function(){return{priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:function(n){return["code",{class:e.getClassName(n.attrs,"code-inline",t)}]},parseMarkdown:{match:function(e){return"inlineCode"===e.type},runner:function(e,t,n){e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:function(e){return e.type.name===te},runner:function(e,t,n){e.withMark(t,"inlineCode",n.text||"")}}}},inputRules:function(e){return[Object(M.h)(/(?:^|[^`])(`([^`]+)`)$/,e)]},commands:function(e){return[Object(A.h)(ne,(function(){return Object(F.e)(e)}))]},shortcuts:Object(C.a)({},ee.CodeInline,Object(T.g)(ne,"Mod-e"))}})),ie="em",oe=Object(A.i)("ToggleItalic"),ae=Object(T.d)((function(e){return{id:ie,schema:function(){return{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:function(e){return"italic"===e}}],toDOM:function(t){return["em",{class:e.getClassName(t.attrs,ie)}]},parseMarkdown:{match:function(e){return"emphasis"===e.type},runner:function(e,t,n){e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:function(e){return e.type.name===ie},runner:function(e,t){e.withMark(t,"emphasis")}}}},inputRules:function(e){return[Object(M.h)(/(?:^|[^_])(_([^_]+)_)$/,e),Object(M.h)(/(?:^|[^*])(\*([^*]+)\*)$/,e)]},commands:function(e){return[Object(A.h)(oe,(function(){return Object(F.e)(e)}))]},shortcuts:Object(C.a)({},ee.Em,Object(T.g)(oe,"Mod-i"))}})),se=Object(A.i)("ToggleLink"),ue=Object(A.i)("ModifyLink"),ce="link",le=Object(T.d)((function(e){var t=e.getStyle((function(e,t){var n=t.css,r=e.palette("line");return n(f||(f=Object(E.a)(["\n color: ",";\n cursor: pointer;\n transition: all 0.4s ease-in-out;\n font-weight: 500;\n &:hover {\n background-color: ",";\n box-shadow: 0 0.2rem ",", 0 -0.2rem ",";\n }\n "])),e.palette("secondary"),r,r,r)}));return{id:ce,schema:function(){return{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(e){if(!(e instanceof HTMLElement))throw new Error;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:function(n){return["a",J(K({},n.attrs),{class:e.getClassName(n.attrs,ce,t)})]},parseMarkdown:{match:function(e){return"link"===e.type},runner:function(e,t,n){var r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:function(e){return e.type.name===ce},runner:function(e,t){e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}},commands:function(e){return[Object(A.h)(se,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Object(F.e)(e,{href:t})})),Object(A.h)(ue,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(n,r){if(!r)return!1;var i,o=n.schema.marks,a=-1,s=n.selection;if(n.doc.nodesBetween(s.from,s.to,(function(e,t){if(o.link.isInSet(e.marks))return i=e,a=t,!1})),!i)return!1;var u=i.marks.find((function(t){return t.type===e}));if(!u)return!1;var c=a,l=a+i.nodeSize,f=n.tr,h=o.link.create(J(K({},u.attrs),{href:t}));return r(f.removeMark(c,l,u).addMark(c,l,h).setSelection(new P.h(f.selection.$anchor)).scrollIntoView()),!0}}))]},inputRules:function(e,t){return[new N.a(c(/\[(.*?)\]\((.*?)(?=\u201C|\))"?((?:(?!")[\s\S])+)?"?\)/,{text:1,href:2,title:3}),(function(n,r,o,a){var s=Object(i.a)(r,4),u=s[0],c=s[1],l=void 0===c?"":c,f=s[2],h=s[3],d=n.tr;if(u){var p=l||"link";d.replaceWith(o,a,t.get(A.u).text(p)).addMark(o,p.length+o,e.create({title:h,href:f}))}return d}))]}}})),fe="strong",he=Object(A.i)("ToggleBold"),de=Object(T.d)((function(e){var t=e.getStyle((function(e,t){return(0,t.css)(h||(h=Object(E.a)(["\n font-weight: 600;\n "])))}));return{id:fe,schema:function(){return{parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-style",getAttrs:function(e){return"bold"===e}}],toDOM:function(n){return["strong",{class:e.getClassName(n.attrs,fe,t)}]},parseMarkdown:{match:function(e){return"strong"===e.type},runner:function(e,t,n){e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:function(e){return e.type.name===fe},runner:function(e,t){e.withMark(t,"strong")}}}},inputRules:function(e){return[Object(M.h)(/(?:__)([^_]+)(?:__)$/,e),Object(M.h)(/(?:\*\*)([^*]+)(?:\*\*)$/,e)]},commands:function(e){return[Object(A.h)(he,(function(){return Object(F.e)(e)}))]},shortcuts:Object(C.a)({},ee.Bold,Object(T.g)(he,"Mod-b"))}})),pe=[re(),ae(),de(),le()],me="blockquote",ge=Object(A.i)("WrapInBlockquote"),ve=Object(T.e)((function(e){var t=e.getStyle((function(e,t){return(0,t.css)(d||(d=Object(E.a)(["\n padding-left: 1.875rem;\n line-height: 1.75rem;\n border-left: 4px solid ",";\n * {\n font-size: 1rem;\n line-height: 1.5rem;\n }\n "])),e.palette("primary"))}));return{id:me,schema:function(){return{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:function(n){return["blockquote",{class:e.getClassName(n.attrs,me,t)},0]},parseMarkdown:{match:function(e){return e.type===me},runner:function(e,t,n){e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:function(e){return e.type.name===me},runner:function(e,t){e.openNode("blockquote").next(t.content).closeNode()}}}},inputRules:function(e){return[Object(N.d)(/^\s*>\s$/,e)]},commands:function(e){return[Object(A.h)(ge,(function(){return Object(F.f)(e)}))]},shortcuts:Object(C.a)({},ee.Blockquote,Object(T.g)(ge,"Mod-Shift-b"))}})),ye=Object(A.i)("WrapInBulletList"),be=Object(T.e)((function(e){var t="bullet_list";return{id:t,schema:function(){return{content:"listItem+",group:"block",parseDOM:[{tag:"ul"}],toDOM:function(t){return["ul",{class:e.getClassName(t.attrs,"bullet-list")},0]},parseMarkdown:{match:function(e){var t=e.type,n=e.ordered;return"list"===t&&!n},runner:function(e,t,n){e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:function(e){return e.type.name===t},runner:function(e,t){e.openNode("list",void 0,{ordered:!1}).next(t.content).closeNode()}}}},inputRules:function(e){return[Object(N.d)(/^\s*([-+*])\s$/,e)]},commands:function(e){return[Object(A.h)(ye,(function(){return Object(F.f)(e)}))]},shortcuts:Object(C.a)({},ee.BulletList,Object(T.g)(ye,"Mod-Alt-8"))}})),we=["","javascript","typescript","bash","sql","json","html","css","c","cpp","java","ruby","python","go","rust","markdown"],ke=c(/^```([a-z]*)?[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]$/,{language:1}),Oe=c(/^~~~([a-z]*)?[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]$/,{language:1}),xe=Object(A.i)("TurnIntoCodeFence"),_e="fence",De=Object(T.e)((function(e,t){var n=e.getStyle((function(e,t){var n=e.palette,r=e.mixin,i=e.size,o=e.font,a=t.css,s=r.shadow,u=r.scrollbar,c=r.border,l=i.lineWidth,f=i.radius;return a(p||(p=Object(E.a)(["\n background-color: ",";\n color: ",";\n font-size: 0.85rem;\n padding: 1.2rem 0.4rem 1.4rem;\n border-radius: ",";\n font-family: ",";\n\n * {\n margin: 0;\n }\n\n .code-fence_select-wrapper {\n position: relative;\n }\n\n .code-fence_value {\n width: 10.25rem;\n box-sizing: border-box;\n border-radius: ",";\n margin: 0 1.2rem 1.2rem;\n ",";\n ",";\n cursor: pointer;\n background-color: ",";\n position: relative;\n display: flex;\n color: ",";\n letter-spacing: 0.5px;\n height: 2.625rem;\n align-items: center;\n\n & > .icon {\n width: 2.625rem;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n color: ",";\n border-left: "," solid ",";\n\n text-align: center;\n transition: all 0.2s ease-in-out;\n &:hover {\n background: ",";\n color: ",";\n }\n }\n\n > span:first-child {\n padding-left: 1rem;\n flex: 1;\n font-weight: 500;\n }\n }\n\n .code-fence_select-option {\n list-style: none;\n line-height: 2rem;\n padding-left: 1rem;\n cursor: pointer;\n :hover {\n background: ",";\n color: ",";\n }\n }\n\n .code-fence_select {\n &[data-fold='true'] {\n display: none;\n }\n\n font-weight: 500;\n position: absolute;\n z-index: 1;\n top: 2.625rem;\n box-sizing: border-box;\n left: 1.2rem;\n padding: 0.5rem 0;\n max-height: 16.75rem;\n width: 10.25rem;\n ",";\n ",";\n background-color: ",";\n border-top: none;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n\n ","\n }\n\n code {\n line-height: 1.5;\n font-family: ",";\n }\n\n pre {\n font-family: ",";\n margin: 0 1.2rem !important;\n white-space: pre;\n overflow: auto;\n ",";\n }\n "])),n("background"),n("neutral"),f,o.typography,i.radius,c(),s(),n("surface"),n("neutral",.87),n("solid",.87),l,n("line"),n("background"),n("primary"),n("secondary",.12),n("primary"),c(),s(),n("surface"),u("y"),o.code,o.code,u("x"))}));return{id:_e,schema:function(){return{content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""},fold:{default:!0}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(e){if(!(e instanceof HTMLElement))throw new Error("Parse DOM error.");return{language:e.dataset.language}}}],toDOM:function(t){return["pre",{"data-language":t.attrs.language,class:e.getClassName(t.attrs,"code-fence",n)},["code",{spellCheck:"false"},0]]},parseMarkdown:{match:function(e){return"code"===e.type},runner:function(e,t,n){var r=t.lang,i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:function(e){return e.type.name===_e},runner:function(e,t){var n;e.addNode("code",void 0,(null==(n=t.content.firstChild)?void 0:n.text)||"",{lang:t.attrs.language})}}}},inputRules:function(e){return[Object(N.c)(ke,e,(function(e){var t=Object(i.a)(e,2),n=t[0],r=t[1];if(n)return{language:r}})),Object(N.c)(Oe,e,(function(e){var t=Object(i.a)(e,2),n=t[0],r=t[1];if(n)return{language:r}}))]},commands:function(e){return[Object(A.h)(xe,(function(){return Object(F.d)(e)}))]},shortcuts:Object(C.a)({},ee.CodeFence,Object(T.g)(xe,"Mod-Alt-c")),view:function(r){return function(i,o,a){var s=document.createElement("div"),u=document.createElement("div"),c=document.createElement("ul"),l=document.createElement("pre"),f=document.createElement("code"),h=document.createElement("div");h.className="code-fence_value";var d=document.createElement("span");h.appendChild(d),o.editable&&h.appendChild(r.get(A.x).slots.icon("downArrow")),c.className="code-fence_select",c.addEventListener("mousedown",(function(e){if(e.preventDefault(),e.stopPropagation(),o.editable){var t=e.target;if(t instanceof HTMLLIElement){var n=o.state.tr;o.dispatch(n.setNodeMarkup(a(),void 0,{fold:!0,language:t.dataset.value}))}}})),h.addEventListener("mousedown",(function(e){if(e.preventDefault(),e.stopPropagation(),o.editable){var t=o.state.tr;o.dispatch(t.setNodeMarkup(a(),void 0,{fold:!1,language:s.dataset.language}))}})),document.addEventListener("mousedown",(function(){if(o.editable&&"true"!==c.dataset.fold){var e=o.state.tr;o.dispatch(e.setNodeMarkup(a(),void 0,{fold:!0,language:s.dataset.language}))}})),((null==t?void 0:t.languageList)||we).forEach((function(e){var t=document.createElement("li");t.className="code-fence_select-option",t.innerText=e||"--",c.appendChild(t),t.setAttribute("data-value",e)})),f.spellcheck=!1,u.className="code-fence_select-wrapper",u.contentEditable="false",u.append(h),u.append(c),l.append(f);var p=document.createElement("div");return f.append(p),p.style.whiteSpace="inherit",s.append(u,l),s.setAttribute("class",e.getClassName(i.attrs,"code-fence",n)),s.setAttribute("data-language",i.attrs.language),d.innerText=i.attrs.language||"--",c.setAttribute("data-fold",i.attrs.fold?"true":"false"),{dom:s,contentDOM:p,update:function(e){if(e.type.name!==_e)return!1;var t=e.attrs.language;return s.dataset.language=t,d.innerText=t||"--",c.setAttribute("data-fold",e.attrs.fold?"true":"false"),!0}}}}}})),Se=Object(T.e)((function(){return{id:"doc",schema:function(){return{content:"block+",parseMarkdown:{match:function(e){return"root"===e.type},runner:function(e,t,n){e.injectRoot(t,n)}},toMarkdown:{match:function(e){return"doc"===e.type.name},runner:function(e,t){e.openNode("root"),e.next(t.content)}}}}}})),Ce=Object(A.i)("InsertHardbreak"),Ee=Object(T.e)((function(e){return{id:"hardbreak",schema:function(){return{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:function(t){return["br",{class:e.getClassName(t.attrs,"hardbreak")}]},parseMarkdown:{match:function(e){return"break"===e.type},runner:function(e,t,n){e.addNode(n)}},toMarkdown:{match:function(e){return"hardbreak"===e.type.name},runner:function(e){e.addNode("break")}}}},commands:function(e){return[Object(A.h)(Ce,(function(){return function(t,n){return null==n||n(t.tr.setMeta("hardbreak",!0).replaceSelectionWith(e.create()).scrollIntoView()),!0}}))]},shortcuts:Object(C.a)({},ee.HardBreak,Object(T.g)(Ce,"Shift-Enter")),prosePlugins:function(e){return[new P.d({key:new P.e("MILKDOWN_PLUGIN_HARDBREAK_MARKS"),appendTransaction:function(t,n,r){if(t.length){var o=Object(i.a)(t,1)[0];if(o){var a=Object(i.a)(o.steps,1)[0];if(o.getMeta("hardbreak")){if(!(a instanceof R.d))return;var s=a.from;return r.tr.setNodeMarkup(s,e,void 0,[])}if(a instanceof R.a){var u=r.tr,c=a.from,l=a.to;return r.doc.nodesBetween(c,l,(function(t,n){t.type===e&&(u=u.setNodeMarkup(n,e,void 0,[]))})),u}}}}})]}}})),je=Array(6).fill(0).map((function(e,t){return t+1})),Te=Object(A.i)("TurnIntoHeading"),Ae=new P.e("MILKDOWN_PLUGIN_ID"),Me=Object(T.e)((function(e){var t,n="heading";return{id:n,schema:function(){return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:""},level:{default:1}},parseDOM:je.map((function(e){return{tag:"h".concat(e),getAttrs:function(t){if(!(t instanceof HTMLElement))throw new Error;return{level:e,id:t.id}}}})),toDOM:function(t){return["h".concat(t.attrs.level),{id:t.attrs.id||t.textContent.split(" ").join("-").toLocaleLowerCase(),class:e.getClassName(t.attrs,"heading h".concat(t.attrs.level),(n=t.attrs.level,e.getStyle((function(e,t){var r=t.css,i={1:r(m||(m=Object(E.a)(["\n font-size: 3rem;\n line-height: 3.5rem;\n "]))),2:r(g||(g=Object(E.a)(["\n font-size: 2.5rem;\n line-height: 3rem;\n "]))),3:r(v||(v=Object(E.a)(["\n font-size: 2.125rem;\n line-height: 2.25rem;\n "]))),4:r(y||(y=Object(E.a)(["\n font-size: 1.75rem;\n line-height: 2rem;\n "]))),5:r(b||(b=Object(E.a)(["\n font-size: 1.5rem;\n line-height: 1.5rem;\n "]))),6:r(w||(w=Object(E.a)(["\n font-size: 1.25rem;\n line-height: 1.25rem;\n "])))};return r(k||(k=Object(E.a)(["\n ","\n margin: 2.5rem 0 !important;\n font-weight: 400;\n "])),i[n]||"")}))))},0];var n},parseMarkdown:{match:function(e){return e.type===n},runner:function(e,t,n){var r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:function(e){return e.type.name===n},runner:function(e,t){e.openNode("heading",void 0,{depth:t.attrs.level}),e.next(t.content),e.closeNode()}}}},inputRules:function(e){return je.map((function(t){return Object(N.c)(new RegExp("^(#{1,".concat(t,"})\\s$")),e,(function(){return{level:t}}))}))},commands:function(e){return[Object(A.h)(Te,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return Object(F.d)(e,{level:t})}))]},shortcuts:(t={},Object(C.a)(t,ee.H1,Object(T.g)(Te,"Mod-Alt-1",1)),Object(C.a)(t,ee.H2,Object(T.g)(Te,"Mod-Alt-2",2)),Object(C.a)(t,ee.H3,Object(T.g)(Te,"Mod-Alt-3",3)),Object(C.a)(t,ee.H4,Object(T.g)(Te,"Mod-Alt-4",4)),Object(C.a)(t,ee.H5,Object(T.g)(Te,"Mod-Alt-5",5)),Object(C.a)(t,ee.H6,Object(T.g)(Te,"Mod-Alt-6",6)),t),prosePlugins:function(e,t){var n=!1,r=function(t,r){var i=t.tr;t.doc.descendants((function(t,r){if(t.type===e&&!n){if(0===t.textContent.trim().length)return;var o=t.attrs,a=function(e){return e.textContent.replace(/(?:[!-\/:-@\[-`\{-~\xA1-\xA9\xAB\xAC\xAE-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u037E\u0384\u0385\u0387\u03F6\u0482\u055A-\u055F\u0589\u058A\u058D-\u058F\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0606-\u060F\u061B\u061D-\u061F\u066A-\u066D\u06D4\u06DE\u06E9\u06FD\u06FE\u0700-\u070D\u07F6-\u07F9\u07FE\u07FF\u0830-\u083E\u085E\u0888\u0964\u0965\u0970\u09F2\u09F3\u09FA\u09FB\u09FD\u0A76\u0AF0\u0AF1\u0B70\u0BF3-\u0BFA\u0C77\u0C7F\u0C84\u0D4F\u0D79\u0DF4\u0E3F\u0E4F\u0E5A\u0E5B\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F85\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u104A-\u104F\u109E\u109F\u10FB\u1360-\u1368\u1390-\u1399\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DB\u1800-\u180A\u1940\u1944\u1945\u19DE-\u19FF\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B6A\u1B74-\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2010-\u2027\u2030-\u205E\u207A-\u207E\u208A-\u208E\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2775\u2794-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u303F\u309B\u309C\u30A0\u30FB\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAA77-\uAA79\uAADE\uAADF\uAAF0\uAAF1\uAB5B\uAB6A\uAB6B\uABEB\uFB29\uFBB2-\uFBC2\uFD3E-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD00-\uDD02\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDC77\uDC78\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEC8\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3F]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFD5-\uDFF1\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3F\uDF44\uDF45]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F[\uDC9C\uDC9F]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE8B]|\uD838[\uDD4F\uDEFF]|\uD83A[\uDD5E\uDD5F]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA])/g,"").replace(/\s/g,"").trim()}(t);o.id!==a&&i.setMeta(Ae,!0).setNodeMarkup(r,void 0,J(K({},o),{id:a}))}})),r(i)};return[new P.d({key:Ae,props:{handleDOMEvents:{compositionstart:function(){return n=!0,!1},compositionend:function(){n=!1;var e=t.get(A.k);return setTimeout((function(){r(e.state,(function(t){return e.dispatch(t)}))}),0),!1}}},appendTransaction:function(e,t,n){var i=null;return e.every((function(e){return!e.getMeta(Ae)}))&&e.some((function(e){return e.docChanged}))&&r(n,(function(e){i=e})),i}})]}}})),Fe="hr",Pe=Object(A.i)("InsertHr"),Ne=Object(T.e)((function(e){var t=e.getStyle((function(e,t){return(0,t.css)(O||(O=Object(E.a)(["\n height: ",";\n background-color: ",";\n border-width: 0;\n "])),e.size.lineWidth,e.palette("line"))}));return{id:Fe,schema:function(){return{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(n){return["hr",{class:e.getClassName(n.attrs,Fe,t)}]},parseMarkdown:{match:function(e){return"thematicBreak"===e.type},runner:function(e,t,n){e.addNode(n)}},toMarkdown:{match:function(e){return e.type.name===Fe},runner:function(e){e.addNode("thematicBreak")}}}},inputRules:function(e){return[new N.a(/^(?:---|___\s|\*\*\*\s)$/,(function(t,n,r,i){var o=t.tr;return n[0]&&o.replaceWith(r-1,i,e.create()),o}))]},commands:function(e,t){return[Object(A.h)(Pe,(function(){return function(n,r){if(!r)return!0;var i=n.tr,o=n.selection.from,a=e.create();if(!a)return!0;var s=i.replaceSelectionWith(a).insert(o,t.get(A.u).node("paragraph")),u=P.f.findFrom(s.doc.resolve(o),1,!0);return!u||(r(s.setSelection(u).scrollIntoView()),!0)}}))]}}})),Re=Object(A.i)("ModifyImage"),Ie=Object(A.i)("InsertImage"),Be="image",Le=Object(T.e)((function(e,t){var n,r,o=K({loading:"Loading...",empty:"Add an Image",failed:"Image loads failed"},null!=(n=null==t?void 0:t.placeholder)?n:{}),a=null!=(r=null==t?void 0:t.isBlock)&&r,s=e.getStyle((function(e,t){return(0,t.css)(x||(x=Object(E.a)(["\n display: inline-block;\n position: relative;\n text-align: center;\n font-size: 0;\n vertical-align: text-bottom;\n line-height: 1;\n\n ","\n\n &.ProseMirror-selectednode::after {\n content: '';\n background: ",";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n img {\n max-width: 100%;\n height: auto;\n object-fit: contain;\n margin: 0 2px;\n }\n .icon,\n .placeholder {\n display: none;\n }\n\n &.system {\n width: 100%;\n padding: 0 2rem;\n\n img {\n width: 0;\n height: 0;\n display: none;\n }\n\n .icon,\n .placeholder {\n display: inline;\n }\n\n box-sizing: border-box;\n height: 3rem;\n background-color: ",";\n border-radius: ",";\n display: inline-flex;\n gap: 2rem;\n justify-content: flex-start;\n align-items: center;\n .placeholder {\n margin: 0;\n line-height: 1;\n &::before {\n content: '';\n font-size: 0.875rem;\n color: ",";\n }\n }\n }\n\n &.loading {\n .placeholder {\n &::before {\n content: '","';\n }\n }\n }\n\n &.empty {\n .placeholder {\n &::before {\n content: '","';\n }\n }\n }\n\n &.failed {\n .placeholder {\n &::before {\n content: '","';\n }\n }\n }\n "])),a?"\n width: 100%;\n margin: 0 auto;\n ":"",e.palette("secondary",.38),e.palette("background"),e.size.radius,e.palette("neutral",.6),o.loading,o.empty,o.failed)})),u=e.getStyle((function(e,t){return(0,t.css)(_||(_=Object(E.a)(["\n display: inline-block;\n margin: 0 auto;\n object-fit: contain;\n width: 100%;\n position: relative;\n height: auto;\n text-align: center;\n "])))}));return{id:"image",schema:function(){return{inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:""},alt:{default:null},title:{default:null},failed:{default:!1},loading:{default:!0},width:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:function(e){if(!(e instanceof HTMLElement))throw new Error;return{failed:e.classList.contains("failed"),loading:e.classList.contains("loading"),src:e.getAttribute("src")||"",alt:e.getAttribute("alt"),title:e.getAttribute("title")||e.getAttribute("alt"),width:e.getAttribute("width")}}}],toDOM:function(t){return["img",J(K({},t.attrs),{class:e.getClassName(t.attrs,Be,t.attrs.failed?"failed":"",t.attrs.loading?"loading":"",u)})]},parseMarkdown:{match:function(e){return e.type===Be},runner:function(e,t,n){var r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:function(e){return e.type.name===Be},runner:function(e,t){e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}},commands:function(e){return[Object(A.h)(Ie,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(n,r){if(!r)return!0;var i=n.tr,o=e.create({src:t});return!o||(r(i.replaceSelectionWith(o).scrollIntoView()),!0)}})),Object(A.h)(Re,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(n,r){var i=Object(M.g)(n.selection,e);if(!i)return!1;var o=n.tr;return null==r||r(o.setNodeMarkup(i.pos,void 0,J(K({},i.node.attrs),{loading:!0,src:t})).scrollIntoView()),!0}}))]},inputRules:function(e){return[new N.a(c(/!\[(.*?)\]\((.*?)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?="|\))"?((?:(?!")[\s\S])+)?"?\)/,{alt:1,filename:2,title:3}),(function(t,n,r,o){var a=Object(i.a)(n,4),s=a[0],u=a[1],c=a[2],l=void 0===c?"":c,f=a[3],h=t.tr;return s&&h.replaceWith(r,o,e.create({src:l,alt:u,title:f})),h}))]},view:function(t){return function(n,r,i){var o=n.type,a=t.get(A.x).slots.icon,u=document.createElement("span");u.className=e.getClassName(n.attrs,Be,s);var c=document.createElement("img");u.append(c);var l=a("image"),f=document.createElement("span");f.classList.add("placeholder"),u.append(l,f);var h=function(e){var t=a(e);u.replaceChild(t,l),l=t},d=function(e){u.classList.add("system","loading"),h("loading");var t=document.createElement("img");t.src=e,t.onerror=function(){var t=i();if(t){var a=r.state.tr.setNodeMarkup(t,o,J(K({},n.attrs),{src:e,loading:!1,failed:!0}));r.dispatch(a)}},t.onload=function(){var a=r.state.tr,s=i();if(s){var u=a.setNodeMarkup(s,o,J(K({},n.attrs),{width:t.width,src:e,loading:!1,failed:!1}));r.dispatch(u)}}},p=n.attrs,m=p.src,g=p.loading,v=p.title,y=p.alt,b=p.width;return c.src=m,c.title=v||y,c.alt=y,b&&(c.width=b),0===m.length?(u.classList.add("system","empty"),h("image")):g&&d(m),{dom:u,update:function(e){if(e.type.name!==Be)return!1;var t=e.attrs,n=t.src,r=t.alt,i=t.title,o=t.loading,a=t.failed,s=t.width;return c.src=n,c.alt=r,c.title=i||r,s&&(c.width=s),o?(d(n),!0):a?(u.classList.remove("loading","empty"),u.classList.add("system","failed"),h("brokenImage"),!0):n.length>0?(u.classList.remove("system","empty","loading"),!0):(u.classList.add("system","empty"),h("image"),!0)},selectNode:function(){u.classList.add("ProseMirror-selectednode")},deselectNode:function(){u.classList.remove("ProseMirror-selectednode")}}}}}})),ze="list_item",$e=Object(A.i)("SplitListItem"),Qe=Object(A.i)("SinkListItem"),qe=Object(A.i)("LiftListItem"),We=Object(T.e)((function(e){var t,n=e.getStyle((function(e,t){return(0,t.css)(D||(D=Object(E.a)(["\n &,\n & > * {\n margin: 0.5rem 0;\n }\n\n &,\n li {\n &::marker {\n color: ",";\n }\n }\n "])),e.palette("primary"))}));return{id:ze,schema:function(){return{group:"listItem",content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:function(t){return["li",{class:e.getClassName(t.attrs,"list-item",n)},0]},parseMarkdown:{match:function(e){var t=e.type,n=e.checked;return"listItem"===t&&null===n},runner:function(e,t,n){e.openNode(n),e.next(t.children),e.closeNode()}},toMarkdown:{match:function(e){return e.type.name===ze},runner:function(e,t){e.openNode("listItem"),e.next(t.content),e.closeNode()}}}},inputRules:function(e){return[Object(N.d)(/^\s*([-+*])\s$/,e)]},commands:function(e){return[Object(A.h)($e,(function(){return Object(I.c)(e)})),Object(A.h)(Qe,(function(){return Object(I.b)(e)})),Object(A.h)(qe,(function(){return Object(I.a)(e)}))]},shortcuts:(t={},Object(C.a)(t,ee.NextListItem,Object(T.g)($e,"Enter")),Object(C.a)(t,ee.SinkListItem,Object(T.g)(Qe,"Mod-]")),Object(C.a)(t,ee.LiftListItem,Object(T.g)(qe,"Mod-[")),t)}})),Ve=Object(A.i)("WrapInOrderedList"),Ue="ordered_list",He=Object(T.e)((function(e){return{id:Ue,schema:function(){return{content:"listItem+",group:"block",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:function(e){if(!(e instanceof HTMLElement))throw new Error;return{order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:function(t){return["ol",J(K({},1===t.attrs.order?{}:t.attrs.order),{class:e.getClassName(t.attrs,"ordered-list")}),0]},parseMarkdown:{match:function(e){var t=e.type,n=e.ordered;return"list"===t&&!!n},runner:function(e,t,n){e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:function(e){return e.type.name===Ue},runner:function(e,t){e.openNode("list",void 0,{ordered:!0,start:1}),e.next(t.content),e.closeNode()}}}},inputRules:function(e){return[Object(N.d)(/^(\d+)\.\s$/,e,(function(e){return{order:Number(e[1])}}),(function(e,t){return t.childCount+t.attrs.order===Number(e[1])}))]},commands:function(e){return[Object(A.h)(Ve,(function(){return Object(F.f)(e)}))]},shortcuts:Object(C.a)({},ee.OrderedList,Object(T.g)(Ve,"Mod-Alt-7"))}})),Ye=Object(A.i)("TurnIntoText"),Xe="paragraph",Ge=Object(T.e)((function(e){var t=e.getStyle((function(e,t){return(0,t.css)(S||(S=Object(E.a)(["\n font-size: 1rem;\n line-height: 1.5;\n letter-spacing: 0.5px;\n "])))}));return{id:Xe,schema:function(){return{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:function(n){return["p",{class:e.getClassName(n.attrs,Xe,t)},0]},parseMarkdown:{match:function(e){return"paragraph"===e.type},runner:function(e,t,n){e.openNode(n),t.children?e.next(t.children):e.addText(t.value),e.closeNode()}},toMarkdown:{match:function(e){return"paragraph"===e.type.name},runner:function(e,t){e.openNode("paragraph"),e.next(t.content),e.closeNode()}}}},commands:function(e){return[Object(A.h)(Ye,(function(){return Object(F.d)(e)}))]},shortcuts:Object(C.a)({},ee.Text,Object(T.g)(Ye,"Mod-Alt-0"))}})),Ze=Object(T.e)((function(){return{id:"text",schema:function(){return{group:"inline",parseMarkdown:{match:function(e){return"text"===e.type},runner:function(e,t){e.addText(t.value)}},toMarkdown:{match:function(e){return"text"===e.type.name},runner:function(e,t){e.addNode("text",void 0,t.text)}}}}}})),Ke=[Se(),Ge(),Ee(),ve(),De(),be(),He(),We(),Me(),Ne(),Le(),Ze()];var Je=function(){return function(e){var t;t=function(e){return function(e){return"html"===e.type}(e)?[]:[e]},function e(n,r,i){if(function(e){return!!e.children}(n)){for(var o=[],a=0,s=n.children.length;ae)break;var l=this.ranges[u+o],f=this.ranges[u+s],h=c+l;if(e<=h){var d=c+r+((l?e==c?-1:e==h?1:t:t)<0?0:f);if(n)return d;var p=e==(t<0?c:h)?null:u/3+(e-c)*i;return new a(d,t<0?e!=c:e!=h,p)}r+=f-l}return n?e+r:new a(e+r)},s.prototype.touches=function(e,t){for(var n=0,r=o(t),i=this.inverted?2:1,a=this.inverted?1:2,s=0;se)break;var c=this.ranges[s+i];if(e<=u+c&&s==3*r)return!0;n+=this.ranges[s+a]-c}return!1},s.prototype.forEach=function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:null)}},u.prototype.invert=function(){var e=new u;return e.appendMappingInverted(this),e},u.prototype.map=function(e,t){if(void 0===t&&(t=1),this.mirror)return this._map(e,t,!0);for(var n=this.from;ni&&s0},l.prototype.addStep=function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t},Object.defineProperties(l.prototype,f);var d=Object.create(null),p=function(){};p.prototype.apply=function(e){return h()},p.prototype.getMap=function(){return s.empty},p.prototype.invert=function(e){return h()},p.prototype.map=function(e){return h()},p.prototype.merge=function(e){return null},p.prototype.toJSON=function(){return h()},p.fromJSON=function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=d[t.stepType];if(!n)throw new RangeError("No step type "+t.stepType+" defined");return n.fromJSON(e,t)},p.jsonID=function(e,t){if(e in d)throw new RangeError("Duplicate use of step JSON ID "+e);return d[e]=t,t.prototype.jsonID=e,t};var m=function(e,t){this.doc=e,this.failed=t};m.ok=function(e){return new m(e,null)},m.fail=function(e){return new m(null,e)},m.fromReplace=function(e,t,n,i){try{return m.ok(e.replace(t,n,i))}catch(o){if(o instanceof r.h)return m.fail(o.message);throw o}};var g=function(e){function t(t,n,r,i){e.call(this),this.from=t,this.to=n,this.slice=r,this.structure=!!i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){return this.structure&&y(e,this.from,this.to)?m.fail("Structure replace would overwrite content"):m.fromReplace(e,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new s([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice)},t.prototype.merge=function(e){if(!(e instanceof t)||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;var n=this.slice.size+e.slice.size==0?r.j.empty:new r.j(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var i=this.slice.size+e.slice.size==0?r.j.empty:new r.j(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),i,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,r.j.fromJSON(e,n.slice),!!n.structure)},t}(p);p.jsonID("replace",g);var v=function(e){function t(t,n,r,i,o,a,s){e.call(this),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=!!s}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){if(this.structure&&(y(e,this.from,this.gapFrom)||y(e,this.gapTo,this.to)))return m.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return m.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?m.fromReplace(e,this.from,this.to,n):m.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new s([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return n.deleted&&r.deleted||ir.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var 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},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,r.j.fromJSON(e,n.slice),n.insert,!!n.structure)},t}(p);function y(e,t,n){for(var r=e.resolve(t),i=n-t,o=r.depth;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0)for(var a=r.node(o).maybeChild(r.indexAfter(o));i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}return!1}function b(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function w(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),i=e.$from.index(n),o=e.$to.indexAfter(n);if(no;s--,u--){var c=i.node(s),l=i.index(s);if(c.type.spec.isolating)return!1;var f=c.content.cutByIndex(l,c.childCount),h=r&&r[u]||c;if(h!=c&&(f=f.replaceChild(0,h.type.create(h.attrs))),!c.canReplace(l+1,c.childCount)||!h.type.validContent(f))return!1}var d=i.indexAfter(o),p=r&&r[0];return i.node(o).canReplaceWith(d,d,p?p.type:i.node(o+1).type)}function _(e,t){var n=e.resolve(t),r=n.index();return D(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function D(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}function S(e,t,n){void 0===n&&(n=-1);for(var r=e.resolve(t),i=r.depth;;i--){var o=void 0,a=void 0,s=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),s++,a=r.node(i).maybeChild(s)):(o=r.node(i).maybeChild(s-1),a=r.node(i+1)),o&&!o.isTextblock&&D(o,a)&&r.node(i).canReplace(s,s+1))return t;if(0==i)break;t=n<0?r.before(i):r.after(i)}}function C(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,o=0;o=0;s--){var u=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(u>0?1:0),l=r.node(s),f=!1;if(1==a)f=l.canReplace(c,c,i);else{var h=l.contentMatchAt(c).findWrapping(i.firstChild.type);f=h&&l.canReplaceWith(c,c,h[0])}if(f)return 0==u?r.pos:u<0?r.before(s+1):r.after(s+1)}return null}function E(e,t,n){for(var i=[],o=0;ot;h--)d||n.index(h)>0?(d=!0,l=r.c.from(n.node(h).copy(l)),f++):u--;for(var p=r.c.empty,m=0,g=o,y=!1;g>t;g--)y||i.after(g+1)=0;i--)n=r.c.from(t[i].type.create(t[i].attrs,n));var o=e.start,a=e.end;return this.step(new v(o,a,o,a,new r.j(n,0,0),t.length,!0))},l.prototype.setBlockType=function(e,t,n,i){var o=this;if(void 0===t&&(t=e),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var a=this.steps.length;return this.doc.nodesBetween(e,t,(function(e,t){if(e.isTextblock&&!e.hasMarkup(n,i)&&function(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(o.doc,o.mapping.slice(a).map(t),n)){o.clearIncompatible(o.mapping.slice(a).map(t,1),n);var s=o.mapping.slice(a),u=s.map(t,1),c=s.map(t+e.nodeSize,1);return o.step(new v(u,c,u+1,c-1,new r.j(r.c.from(n.create(i,null,e.marks)),0,0),1,!0)),!1}})),this},l.prototype.setNodeMarkup=function(e,t,n,i){var o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var a=t.create(n,null,i||o.marks);if(o.isLeaf)return this.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new v(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new r.j(r.c.from(a),0,0),1,!0))},l.prototype.split=function(e,t,n){void 0===t&&(t=1);for(var i=this.doc.resolve(e),o=r.c.empty,a=r.c.empty,s=i.depth,u=i.depth-t,c=t-1;s>u;s--,c--){o=r.c.from(i.node(s).copy(o));var l=n&&n[c];a=r.c.from(l?l.type.create(l.attrs,a):i.node(s).copy(a))}return this.step(new g(e,e,new r.j(o.append(a),t,t),!0))},l.prototype.join=function(e,t){void 0===t&&(t=1);var n=new g(e-t,e+t,r.j.empty,!0);return this.step(n)};var j=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),i=e.resolve(this.from),o=i.node(i.sharedDepth(this.to)),a=new r.j(E(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),o),n.openStart,n.openEnd);return m.fromReplace(e,this.from,this.to,a)},t.prototype.invert=function(){return new T(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(p);p.jsonID("addMark",j);var T=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),i=new r.j(E(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))})),n.openStart,n.openEnd);return m.fromReplace(e,this.from,this.to,i)},t.prototype.invert=function(){return new j(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(p);function A(e,t,n,i){if(void 0===n&&(n=t),void 0===i&&(i=r.j.empty),t==n&&!i.size)return null;var o=e.resolve(t),a=e.resolve(n);return M(o,a,i)?new g(t,n,i):new F(o,a,i).fit()}function M(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}p.jsonID("removeMark",T),l.prototype.addMark=function(e,t,n){var r=this,i=[],o=[],a=null,s=null;return this.doc.nodesBetween(e,t,(function(r,u,c){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&c.type.allowsMarkType(n.type)){for(var f=Math.max(u,e),h=Math.min(u+r.nodeSize,t),d=n.addToSet(l),p=0;p=0;d--)this.step(o[d]);return this},l.prototype.replace=function(e,t,n){void 0===t&&(t=e),void 0===n&&(n=r.j.empty);var i=A(this.doc,e,t,n);return i&&this.step(i),this},l.prototype.replaceWith=function(e,t,n){return this.replace(e,t,new r.j(r.c.from(n),0,0))},l.prototype.delete=function(e,t){return this.replace(e,t,r.j.empty)},l.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};var F=function(e,t,n){this.$to=t,this.$from=e,this.unplaced=n,this.frontier=[];for(var i=0;i<=e.depth;i++){var o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}this.placed=r.c.empty;for(var a=e.depth;a>0;a--)this.placed=r.c.from(e.node(a).copy(this.placed))},P={depth:{configurable:!0}};function N(e,t,n){return 0==t?e.cutByIndex(n):e.replaceChild(0,e.firstChild.copy(N(e.firstChild.content,t-1,n)))}function R(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(R(e.lastChild.content,t-1,n)))}function I(e,t){for(var n=0;n1&&(i=i.replaceChild(0,B(i.firstChild,t-1,1==i.childCount?n-1:0))),t>0&&(i=e.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(e.type.contentMatch.matchFragment(i).fillBefore(r.c.empty,!0)))),e.copy(i)}function L(e,t,n,r,i){var o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;var s=r.fillBefore(o.content,!0,a);return s&&!function(e,t,n){for(var r=n;ri){var s=o.contentMatchAt(0),u=s.fillBefore(e).append(e);e=u.append(s.matchFragment(u).fillBefore(r.c.empty,!0))}return e}function $(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(it.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}P.depth.get=function(){return this.frontier.length-1},F.prototype.fit=function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,o=this.close(t<0?this.$to:i.doc.resolve(t));if(!o)return null;for(var a=this.placed,s=i.depth,u=o.depth;s&&u&&1==a.childCount;)a=a.firstChild.content,s--,u--;var c=new r.j(a,s,u);return t>-1?new v(i.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||i.pos!=this.$to.pos?new g(i.pos,o.pos,c):void 0},F.prototype.findFittable=function(){for(var e=1;e<=2;e++)for(var t=this.unplaced.openStart;t>=0;t--)for(var n=void 0,i=(t?(n=I(this.unplaced.content,t-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var a=this.frontier[o],s=a.type,u=a.match,c=void 0,l=void 0;if(1==e&&(i?u.matchType(i.type)||(l=u.fillBefore(r.c.from(i),!1)):s.compatibleContent(n.type)))return{sliceDepth:t,frontierDepth:o,parent:n,inject:l};if(2==e&&i&&(c=u.findWrapping(i.type)))return{sliceDepth:t,frontierDepth:o,parent:n,wrap:c};if(n&&u.matchType(n.type))break}},F.prototype.openMore=function(){var e=this.unplaced,t=e.content,n=e.openStart,i=e.openEnd,o=I(t,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new r.j(t,n+1,Math.max(i,o.size+n>=t.size-i?n+1:0)),!0)},F.prototype.dropNode=function(){var e=this.unplaced,t=e.content,n=e.openStart,i=e.openEnd,o=I(t,n);if(o.childCount<=1&&n>0){var a=t.size-n<=n+o.size;this.unplaced=new r.j(N(t,n-1,1),n-1,a?n-1:i)}else this.unplaced=new r.j(N(t,n,1),n,i)},F.prototype.placeNodes=function(e){for(var t=e.sliceDepth,n=e.frontierDepth,i=e.parent,o=e.inject,a=e.wrap;this.depth>n;)this.closeFrontierNode();if(a)for(var s=0;s1||0==l||y.content.size)&&(p=b,h.push(B(y.mark(m.allowedMarks(y.marks)),1==f?l:0,f==c.childCount?v:-1)))}var w=f==c.childCount;w||(v=-1),this.placed=R(this.placed,n,r.c.from(h)),this.frontier[n].match=p,w&&v<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var k=0,O=c;k1&&r==this.$to.end(--n);)++r;return r},F.prototype.findCloseLevel=function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,o=t=0;s--){var u=this.frontier[s],c=u.match,l=L(e,s,u.type,c,!0);if(!l||l.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}},F.prototype.close=function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=R(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e},F.prototype.openFrontierNode=function(e,t,n){var i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=R(this.placed,this.depth,r.c.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})},F.prototype.closeFrontierNode=function(){var e=this.frontier.pop().match.fillBefore(r.c.empty,!0);e.childCount&&(this.placed=R(this.placed,this.frontier.length,e))},Object.defineProperties(F.prototype,P),l.prototype.replaceRange=function(e,t,n){if(!n.size)return this.deleteRange(e,t);var i=this.doc.resolve(e),o=this.doc.resolve(t);if(M(i,o,n))return this.step(new g(e,t,n));var a=$(i,this.doc.resolve(t));0==a[a.length-1]&&a.pop();var s=-(i.depth+1);a.unshift(s);for(var u=i.depth,c=i.pos-1;u>0;u--,c--){var l=i.node(u).type.spec;if(l.defining||l.isolating)break;a.indexOf(u)>-1?s=u:i.before(u)==c&&a.splice(1,0,-u)}for(var f=a.indexOf(s),h=[],d=n.openStart,p=n.content,m=0;;m++){var v=p.firstChild;if(h.push(v),m==n.openStart)break;p=v.content}d>0&&h[d-1].type.spec.defining&&i.node(f).type!=h[d-1].type?d-=1:d>=2&&h[d-1].isTextblock&&h[d-2].type.spec.defining&&i.node(f).type!=h[d-2].type&&(d-=2);for(var y=n.openStart;y>=0;y--){var b=(y+d+1)%(n.openStart+1),w=h[b];if(w)for(var k=0;k=0&&(this.replace(e,t,n),!(this.steps.length>S));C--){var E=a[C];E<0||(e=i.before(E),t=o.after(E))}return this},l.prototype.replaceRangeWith=function(e,t,n){if(!n.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var i=function(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var i=r.depth-1;i>=0;i--){var o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s0&&(s||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return this.delete(n.before(a),r.after(a))}for(var u=1;u<=n.depth&&u<=r.depth;u++)if(e-n.start(u)==n.depth-u&&t>n.end(u)&&r.end(u)-t!=r.depth-u)return this.delete(n.before(u),t);return this.delete(e,t)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return d})),n.d(t,"d",(function(){return c})),n.d(t,"e",(function(){return p})),n.d(t,"f",(function(){return m})),n.d(t,"g",(function(){return g})),n.d(t,"h",(function(){return l}));var r=n(22),i=n(10),o=(n(78),n(67),n(68),n(44),n(56)),a=(n(40),n(7),n(79),n(9));n(80),n(24),n(38),n(33);function s(e,t,n,r,i,o){if(e.composing)return!1;var a=e.state,s=a.doc.resolve(t);if(s.parent.type.spec.code)return!1;for(var u=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,void 0,"\ufffc")+r,c=0;cd}));if(v.length)return null;g