!function r(o,i,s){function a(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},o[t][0].call(n.exports,function(e){return a(o[t][1][e]||e)},n,n.exports,r,o,i,s)}return i[t].exports}for(var l="function"==typeof require&&require,e=0;e{return[e,(...e)=>{e=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),e}]}))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,r=!0){var{rawCommands:t,editor:n,state:o}=this;const i=n["view"],s=[],a=!!e,l=e||o.tr;const c={...Object.fromEntries(Object.entries(t).map(([e,n])=>{return[e,(...e)=>{var t=this.buildProps(l,r),e=n(...e)(t);return s.push(e),c}]})),run:()=>(a||!r||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){var{rawCommands:t,state:n}=this;const r=e||n.tr,o=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...o,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this;var i=r["view"];const s={tr:e,editor:r,view:i,state:k({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}}function c(e,t,n){return void 0===e.config[t]&&e.parent?c(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?c(e.parent,t,n):null}):e.config[t]}function i(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function $(e){const r=[];var{nodeExtensions:t,markExtensions:n}=i(e),t=[...t,...n];const o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{e=c(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage});e&&e().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,t])=>{r.push({type:n,name:e,attribute:{...o,...t}})})})})}),t.forEach(n=>{var e={name:n.name,options:n.options,storage:n.storage},e=c(n,"addAttributes",e);e&&(e=e(),Object.entries(e).forEach(([e,t])=>{t={...o,...t};"function"==typeof(null==t?void 0:t.default)&&(t.default=t.default()),null!=t&&t.isRequired&&void 0===(null==t?void 0:t.default)&&delete t.default,r.push({type:n.name,name:e,attribute:t})}))}),r}function w(e,t){if("string"!=typeof e)return e;if(t.nodes[e])return t.nodes[e];throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`)}function _(...e){return e.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([e,t])=>{if(o[e])if("class"===e){var n=t?t.split(" "):[];const r=o[e]?o[e].split(" "):[];n=n.filter(e=>!r.includes(e));o[e]=[...r,...n].join(" ")}else o[e]="style"===e?[o[e],t].join("; "):t;else o[e]=t}),o},{})}function u(t,e){return e.filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((e,t)=>_(e,t),{})}function V(e){return"function"==typeof e}function d(e,t=void 0,...n){return V(e)?(t?e.bind(t):e)(...n):e}function H(e={}){return 0===Object.keys(e).length&&e.constructor===Object}function J(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}function q(n,o){return n.style?n:{...n,getAttrs:r=>{var e,t=n.getAttrs?n.getAttrs(r):n.attrs;return!1!==t&&(e=o.reduce((e,t)=>{var n=t.attribute.parseHTML?t.attribute.parseHTML(r):J(r.getAttribute(t.name));return null==n?e:{...e,[t.name]:n}},{}),{...t,...e})}}}function K(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!H(t))&&null!=t))}function W(s,a){const l=$(s);var{nodeExtensions:e,markExtensions:t}=i(s),n=null==(n=e.find(e=>c(e,"topNode")))?void 0:n.name,e=Object.fromEntries(e.map(n=>{const t=l.filter(e=>e.type===n.name),r={name:n.name,options:n.options,storage:n.storage,editor:a};var e=K({...s.reduce((e,t)=>{t=c(t,"extendNodeSchema",r);return{...e,...t?t(n):{}}},{}),content:d(c(n,"content",r)),marks:d(c(n,"marks",r)),group:d(c(n,"group",r)),inline:d(c(n,"inline",r)),atom:d(c(n,"atom",r)),selectable:d(c(n,"selectable",r)),draggable:d(c(n,"draggable",r)),code:d(c(n,"code",r)),defining:d(c(n,"defining",r)),isolating:d(c(n,"isolating",r)),attrs:Object.fromEntries(t.map(e=>{return[e.name,{default:null==(e=null==e?void 0:e.attribute)?void 0:e.default}]}))}),o=d(c(n,"parseHTML",r));o&&(e.parseDOM=o.map(e=>q(e,t)));const i=c(n,"renderHTML",r);i&&(e.toDOM=e=>i({node:e,HTMLAttributes:u(e,t)}));o=c(n,"renderText",r);return o&&(e.toText=o),[n.name,e]})),t=Object.fromEntries(t.map(n=>{const t=l.filter(e=>e.type===n.name),r={name:n.name,options:n.options,storage:n.storage,editor:a};var e=K({...s.reduce((e,t)=>{t=c(t,"extendMarkSchema",r);return{...e,...t?t(n):{}}},{}),inclusive:d(c(n,"inclusive",r)),excludes:d(c(n,"excludes",r)),group:d(c(n,"group",r)),spanning:d(c(n,"spanning",r)),code:d(c(n,"code",r)),attrs:Object.fromEntries(t.map(e=>{return[e.name,{default:null==(e=null==e?void 0:e.attribute)?void 0:e.default}]}))}),o=d(c(n,"parseHTML",r));o&&(e.parseDOM=o.map(e=>q(e,t)));const i=c(n,"renderHTML",r);return i&&(e.toDOM=e=>i({mark:e,HTMLAttributes:u(e,t)})),[n.name,e]}));return new g.Schema({topNode:n,nodes:e,marks:t})}function l(e,t){return t.nodes[e]||t.marks[e]||null}function U(t,e){return Array.isArray(e)?e.some(e=>{return("string"==typeof e?e:e.name)===t.name}):e}const G=(e,t=500)=>{let s="";const a=e.parentOffset;return e.parent.nodesBetween(Math.max(0,a-t),a,(e,t,n,r)=>{var o,i=(null==(i=(o=e.type.spec).toText)?void 0:i.call(o,{node:e,pos:t,parent:n,index:r}))||e.textContent||"%leaf%";s+=i.slice(0,Math.max(0,a-t))}),s};function o(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class n{constructor(e){this.find=e.find,this.handler=e.handler}}const X=(e,t)=>{var n;return o(t)?t.exec(e):(t=t(e))?((n=[t.text]).index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n):null};function Y(e){var t;const{editor:l,from:c,to:u,text:d,rules:n,plugin:p}=e,h=l["view"];if(h.composing)return!1;e=h.state.doc.resolve(c);if(e.parent.type.spec.code||null!=(t=e.nodeBefore||e.nodeAfter)&&t.marks.find(e=>e.type.spec.code))return!1;let f=!1;const m=G(e)+d;return n.forEach(e=>{var t,n,r,o,i,s,a;f||(t=X(m,e.find))&&(n=h.state.tr,r=k({state:h.state,transaction:n}),o={from:c-(t[0].length-d.length),to:u},{commands:i,chain:s,can:a}=new b({editor:l,state:r}),null!==e.handler({state:r,range:o,match:t,commands:i,chain:s,can:a}))&&n.steps.length&&(n.setMeta(p,{transform:n,from:c,to:u,text:d}),h.dispatch(n),f=!0)}),f}function Q(e){const{editor:o,rules:i}=e,s=new v.Plugin({state:{init(){return null},apply(e,t){var n=e.getMeta(s);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput(e,t,n,r){return Y({editor:o,from:t,to:n,text:r,rules:i,plugin:s})},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{var e=t.state.selection["$cursor"];e&&Y({editor:o,from:e.pos,to:e.pos,text:"",rules:i,plugin:s})}),!1)},handleKeyDown(e,t){return"Enter"===t.key&&(t=e.state.selection.$cursor,!!t)&&Y({editor:o,from:t.pos,to:t.pos,text:"\n",rules:i,plugin:s})}},isInputRules:!0});return s}function Z(e){return"number"==typeof e}class r{constructor(e){this.find=e.find,this.handler=e.handler}}const ee=(n,e,t)=>{return o(e)?[...n.matchAll(e)]:(e=e(n,t))?e.map(e=>{var t=[e.text];return t.index=e.index,t.input=n,t.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),t.push(e.replaceWith)),t}):[]};function te(e){const{editor:i,rules:t}=e;let r=null,s=!1,a=!1,l=new ClipboardEvent("paste"),c=new DragEvent("drop");return t.map(o=>new v.Plugin({view(n){const e=e=>{var t;r=null!=(t=n.dom.parentElement)&&t.contains(e.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",e),{destroy(){window.removeEventListener("dragstart",e)}}},props:{handleDOMEvents:{drop:(e,t)=>(a=r===e.dom.parentElement,c=t,!1),paste:(e,t)=>{var n=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,s=!(null==n||!n.includes("data-pm-slice")),!1}}},appendTransaction:(e,t,n)=>{var e=e[0],r="paste"===e.getMeta("uiEvent")&&!s,e="drop"===e.getMeta("uiEvent")&&!a;if(r||e){r=t.doc.content.findDiffStart(n.doc.content),e=t.doc.content.findDiffEnd(n.doc.content);if(Z(r)&&e&&r!==e.b){t=n.tr,n=k({state:n,transaction:t});if(function(e){const{editor:t,state:o,from:i,to:s,rule:a,pasteEvent:l,dropEvent:c}=e,{commands:u,chain:d,can:p}=new b({editor:t,state:o}),h=[];return o.doc.nodesBetween(i,s,(e,t)=>{if(e.isTextblock&&!e.type.spec.code){const r=Math.max(i,t);var n=Math.min(s,t+e.content.size),e=e.textBetween(r-t,n-t,void 0,"");ee(e,a.find,l).forEach(e=>{var t,n;void 0!==e.index&&(n=(t=r+e.index+1)+e[0].length,t={from:o.tr.mapping.map(t),to:o.tr.mapping.map(n)},n=a.handler({state:o,range:t,match:e,commands:u,chain:d,can:p,pasteEvent:l,dropEvent:c}),h.push(n))})}}),h.every(e=>null!==e)}({editor:i,state:n,from:Math.max(r-1,0),to:e.b-1,rule:o,pasteEvent:l,dropEvent:c})&&t.steps.length)return c=new DragEvent("drop"),l=new ClipboardEvent("paste"),t}}}}))}function ne(n){var e=n.filter((e,t)=>n.indexOf(e)!==t);return[...new Set(e)]}class p{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=p.resolve(e),this.schema=W(this.extensions,t),this.extensions.forEach(e=>{this.editor.extensionStorage[e.name]=e.storage;var t={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:l(e.name,this.schema)},n=("mark"!==e.type||null!=(n=d(c(e,"keepOnSplit",t)))&&!n||this.splittableMarks.push(e.name),c(e,"onBeforeCreate",t)),n=(n&&this.editor.on("beforeCreate",n),c(e,"onCreate",t)),n=(n&&this.editor.on("create",n),c(e,"onUpdate",t)),n=(n&&this.editor.on("update",n),c(e,"onSelectionUpdate",t)),n=(n&&this.editor.on("selectionUpdate",n),c(e,"onTransaction",t)),n=(n&&this.editor.on("transaction",n),c(e,"onFocus",t)),n=(n&&this.editor.on("focus",n),c(e,"onBlur",t)),n=(n&&this.editor.on("blur",n),c(e,"onDestroy",t));n&&this.editor.on("destroy",n)})}static resolve(e){var e=p.sort(p.flatten(e)),t=ne(e.map(e=>e.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),e}static flatten(e){return e.map(e=>{var t=c(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{e=c(e,"priority")||100,t=c(t,"priority")||100;return t{t=c(t,"addCommands",{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:l(t.name,this.schema)});return t?{...e,...t()}:e},{})}get plugins(){const i=this["editor"];var e=p.sort([...this.extensions].reverse());const s=[],a=[];e=e.map(e=>{var t={name:e.name,options:e.options,storage:e.storage,editor:i,type:l(e.name,this.schema)},n=[],r=c(e,"addKeyboardShortcuts",t);let o={};"mark"===e.type&&e.config.exitable&&(o.ArrowRight=()=>Be.handleExit({editor:i,mark:e})),r&&(r=Object.fromEntries(Object.entries(r()).map(([e,t])=>[e,()=>t({editor:i})])),o={...o,...r});r=F.keymap(o),n.push(r),r=c(e,"addInputRules",t),U(e,i.options.enableInputRules)&&r&&s.push(...r()),r=c(e,"addPasteRules",t),U(e,i.options.enablePasteRules)&&r&&a.push(...r()),r=c(e,"addProseMirrorPlugins",t);return r&&(t=r(),n.push(...t)),n}).flat();return[Q({editor:i,rules:s}),...te({editor:i,rules:a}),...e]}get attributes(){return $(this.extensions)}get nodeViews(){const l=this["editor"];var e=i(this.extensions)["nodeExtensions"];return Object.fromEntries(e.filter(e=>!!c(e,"addNodeView")).map(i=>{const s=this.attributes.filter(e=>e.type===i.name);var e={name:i.name,options:i.options,storage:i.storage,editor:l,type:w(i.name,this.schema)};const a=c(i,"addNodeView",e);return a?[i.name,(e,t,n,r)=>{var o=u(e,s);return a()({editor:l,node:e,getPos:n,decorations:r,HTMLAttributes:o,extension:i})}]:[]}))}}function a(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function h(t,n){const r={...t};return a(t)&&a(n)&&Object.keys(n).forEach(e=>{a(n[e])&&e in t?r[e]=h(t[e],n[e]):Object.assign(r,{[e]:n[e]})}),r}class f{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&0{var o=null===c||void 0===c?void 0:c[e.type.name];o?(e.isBlock&&!d&&(u+=l,d=!0),n&&(u+=o({node:e,pos:t,parent:n,index:r,range:i}))):e.isText?(u+=null==(o=null==e?void 0:e.text)?void 0:o.slice(Math.max(s,t)-t,a-t),d=!1):e.isBlock&&!d&&(u+=l,d=!0)}),u}function m(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}e=f.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new v.Plugin({key:new v.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{var e=this["editor"],{state:e,schema:t}=e,{doc:e,selection:n}=e,n=n["ranges"];return re(e,{from:Math.min(...n.map(e=>e.$from.pos)),to:Math.max(...n.map(e=>e.$to.pos))},{textSerializers:m(t)})}}})]}});function S(t,n,r={strict:!0}){var e=Object.keys(n);return!e.length||e.every(e=>!r.strict&&o(n[e])?n[e].test(t[e]):n[e]===t[e])}function oe(e,t,n={}){return e.find(e=>e.type===t&&S(e.attrs,n))}function x(i,s,a={}){if(i&&s){let o=i.parent.childAfter(i.parentOffset);if((o=i.parentOffset===o.offset&&0!==o.offset?i.parent.childBefore(i.parentOffset):o).node){var l,c,u,d=oe([...o.node.marks],s,a);if(d){let e=o.index,t=i.start()+o.offset,n=e+1,r=t+o.node.nodeSize;for(oe([...o.node.marks],s,a);0{var n=t.childNodes;for(let e=n.length-1;0<=e;--e){var r=n[e];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):1===r.nodeType&&ae(r)}return t};function C(e){e=`${e}`,e=(new window.DOMParser).parseFromString(e,"text/html").body;return ae(e)}function N(t,n,r){if(r={slice:!0,parseOptions:{},...r},"object"==typeof t&&null!==t)try{return Array.isArray(t)&&0n.nodeFromJSON(e))):n.nodeFromJSON(t)}catch(e){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",e),N("",n,r)}var e;return"string"==typeof t?(e=g.DOMParser.fromSchema(n),r.slice?e.parseSlice(C(t),r.parseOptions).content:e.parse(C(t),r.parseOptions)):N("",n,r)}function le(e,t,n){var r=e.steps.length-1;if(!(r{0===o&&(o=r)}),e.setSelection(v.Selection.near(e.doc.resolve(o),n))}}}function ce(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function A(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?w(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{var n;e.isText||(n=Math.max(r,t),t=Math.min(o,t+e.nodeSize),a.push({node:e,from:n,to:t}))});t=o-r,e=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>S(e.node.attrs,n,{strict:!1}));return i?!!e.length:t<=e.reduce((e,t)=>e+t.to-t.from,0)}function E(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ue(n,e){const r="string"==typeof e?[e]:e;return Object.keys(n).reduce((e,t)=>(r.includes(t)||(e[t]=n[t]),e),{})}function de(e,t,n={}){return N(e,t,{slice:!1,parseOptions:n})}function pe(e,t){const n=M(t,e.schema);var{from:t,to:r,empty:o}=e.selection;const i=[];o?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(t,r,e=>{i.push(...e.marks)});o=i.find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function he(t){for(let e=0;efe(e.$from,t)}function me(e,t){t=g.DOMSerializer.fromSchema(t).serializeFragment(e),e=document.implementation.createHTMLDocument().createElement("div");return e.appendChild(t),e.innerHTML}function P(e,t){return W(p.resolve(e),t)}function ve(e,t){return re(e,{from:0,to:e.content.size},t)}function ge(e,t){const n=w(t,e.schema);var{from:t,to:r}=e.selection;const o=[];e.doc.nodesBetween(t,r,e=>{o.push(e)});e=o.reverse().find(e=>e.type.name===n.name);return e?{...e.attrs}:{}}function ye(e,t){var n=E("string"==typeof t?t:t.name,e.schema);return"node"===n?ge(e,t):"mark"===n?pe(e,t):{}}function ke(e,t=JSON.stringify){const n={};return e.filter(e=>{e=t(e);return!Object.prototype.hasOwnProperty.call(n,e)&&(n[e]=!0)})}function be(n,e,r){const o=[];return n===e?r.resolve(n).marks().forEach(e=>{var t=x(r.resolve(n-1),e.type);t&&o.push({mark:e,...t})}):r.nodesBetween(n,e,(t,n)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&o.push(...t.marks.map(e=>({from:n,to:n+t.nodeSize,mark:e})))}),o}function R(n,r,e){return Object.fromEntries(Object.entries(e).filter(([t])=>{var e=n.find(e=>e.type===r&&e.name===t);return!!e&&e.attribute.keepOnSplit}))}function I(n,e,t={}){var{empty:r,ranges:o}=n.selection;const i=e?M(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>S(e.attrs,t,{strict:!1}));let s=0;const a=[];return o.forEach(({$from:e,$to:t})=>{const o=e.pos,i=t.pos;n.doc.nodesBetween(o,i,(e,t)=>{if(e.isText||e.marks.length){const n=Math.max(o,t),r=Math.min(i,t+e.nodeSize);t=r-n;s+=t,a.push(...e.marks.map(e=>({mark:e,from:n,to:r})))}})}),0!==s&&(e=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>S(e.mark.attrs,t,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),r=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0),(0=s)}function we(e,t,n={}){var r;return t?"node"===(r=E(t,e.schema))?A(e,t,n):"mark"===r&&I(e,t,n):A(e,null,n)||I(e,null,n)}function Se(t,e){var e=i(e)["nodeExtensions"],e=e.find(e=>e.name===t);return!!e&&"string"==typeof(e=d(c(e,"group",{name:e.name,options:e.options,storage:e.storage})))&&e.split(" ").includes("list")}function xe(e){var t=null==(t=e.type.createAndFill())?void 0:t.toJSON(),e=e.toJSON();return JSON.stringify(t)===JSON.stringify(e)}function Me(e,t){var n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();n&&(n=n.filter(e=>null==t?void 0:t.includes(e.type.name)),e.tr.ensureMarks(n))}const Oe=(e,t)=>{var n,r=D(e=>e.type===t)(e.selection);return r&&void 0!==(n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth))&&(n=e.doc.nodeAt(n),r.node.type===(null==n?void 0:n.type))&&y.canJoin(e.doc,r.pos)&&e.join(r.pos),!0},Te=(e,t)=>{var n,r,o=D(e=>e.type===t)(e.selection);return o&&void 0!==(n=e.doc.resolve(o.start).after(o.depth))&&(r=e.doc.nodeAt(n),o.node.type===(null==r?void 0:r.type))&&y.canJoin(e.doc,n)&&e.join(n),!0};var Ce=Object.freeze({__proto__:null,blur:()=>({editor:t,view:n})=>(requestAnimationFrame(()=>{var e;t.isDestroyed||(n.dom.blur(),null!=(e=null===window||void 0===window?void 0:window.getSelection())&&e.removeAllRanges())}),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:n,tr:i,dispatch:e})=>{var t=i["selection"],t=t["ranges"];return e&&t.forEach(({$from:e,$to:t})=>{n.doc.nodesBetween(e.pos,t.pos,(e,t)=>{var n,r,o;!e.type.isText&&({doc:o,mapping:r}=i,n=o.resolve(r.map(t)),o=o.resolve(r.map(t+e.nodeSize)),r=n.blockRange(o))&&(t=y.liftTarget(r),e.type.isTextblock&&(o=n.parent.contentMatchAt(n.index())["defaultType"],i.setNodeMarkup(r.start,o)),!t&&0!==t||i.lift(r,t))})}),!0},command:t=>e=>t(e),createParagraphNear:()=>({state:e,dispatch:t})=>s.createParagraphNear(e,t),cut:(r,o)=>({editor:e,tr:t})=>{var e=e["state"],e=e.doc.slice(r.from,r.to),n=(t.deleteRange(r.from,r.to),t.mapping.map(o));return t.insert(n,e.content),t.setSelection(new v.TextSelection(t.doc.resolve(n-1))),!0},deleteCurrentNode:()=>({tr:t,dispatch:n})=>{var e=t["selection"],r=e.$anchor.node();if(!(0({tr:t,state:e,dispatch:n})=>{var r,o,i=w(a,e.schema),s=t.selection.$anchor;for(let e=s.depth;0({tr:e,dispatch:t})=>{var{from:n,to:r}=o;return t&&e.delete(n,r),!0},deleteSelection:()=>({state:e,dispatch:t})=>s.deleteSelection(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>s.exitCode(e,t),extendMarkRange:(a,l={})=>({tr:e,state:t,dispatch:n})=>{var t=M(a,t.schema),{doc:r,selection:o}=e,{$from:o,from:i,to:s}=o;return n&&(n=x(o,t,l))&&n.from<=i&&n.to>=s&&(o=v.TextSelection.create(r,n.from,n.to),e.setSelection(o)),!0},first:e=>t=>{var n="function"==typeof e?e(t):e;for(let e=0;e({editor:e,view:t,tr:n,dispatch:r})=>{l={scrollIntoView:!0,...l};var o,i,s=()=>{T()&&t.dom.focus(),requestAnimationFrame(()=>{e.isDestroyed||(t.focus(),null!=l&&l.scrollIntoView&&e.commands.scrollIntoView())})};return t.hasFocus()&&null===a||!1===a||(r&&null===a&&!ie(e.state.selection)?s():(o=se(n.doc,a)||e.state.selection,i=e.state.selection.eq(o),r&&(i||n.setSelection(o),i&&n.storedMarks&&n.setStoredMarks(n.storedMarks),s()))),!0},forEach:(e,r)=>n=>e.every((e,t)=>r(e,{...n,index:t})),insertContent:(n,r)=>({tr:e,commands:t})=>t.insertContentAt({from:e.selection.from,to:e.selection.to},n,r),insertContentAt:(a,l,c)=>({tr:o,dispatch:i,editor:s})=>{if(i){c={parseOptions:{},updateSelection:!0,...c};i=N(l,s.schema,{parseOptions:{preserveWhitespace:"full",...c.parseOptions}});if("<>"===i.toString())return!0;let{from:e,to:t}="number"==typeof a?{from:a,to:a}:{from:a.from,to:a.to},n=!0,r=!0;(i.toString().startsWith("<")?i:[i]).forEach(e=>{e.check(),n=!!n&&e.isText&&0===e.marks.length,r=!!r&&e.isBlock}),e===t&&r&&(s=o.doc.resolve(e)["parent"],s.isTextblock)&&!s.type.spec.code&&!s.childCount&&(--e,t+=1),n?Array.isArray(l)?o.insertText(l.map(e=>e.text||"").join(""),e,t):"object"==typeof l&&l&&l.text?o.insertText(l.text,e,t):o.insertText(l,e,t):o.replaceWith(e,t,i),c.updateSelection&&le(o,o.steps.length-1,-1)}return!0},joinUp:()=>({state:e,dispatch:t})=>s.joinUp(e,t),joinDown:()=>({state:e,dispatch:t})=>s.joinDown(e,t),joinBackward:()=>({state:e,dispatch:t})=>s.joinBackward(e,t),joinForward:()=>({state:e,dispatch:t})=>s.joinForward(e,t),joinItemBackward:()=>({tr:e,state:t,dispatch:n})=>{try{var r=y.joinPoint(t.doc,t.selection.$from.pos,-1);return null==r?!1:(e.join(r,2),n&&n(e),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:t,tr:n})=>{try{var r=y.joinPoint(e.doc,e.selection.$from.pos,1);return null==r?!1:(n.join(r,2),t&&t(n),!0)}catch(e){return!1}},joinTextblockBackward:()=>({state:e,dispatch:t})=>s.joinTextblockBackward(e,t),joinTextblockForward:()=>({state:e,dispatch:t})=>s.joinTextblockForward(e,t),keyboardShortcut:a=>({editor:e,view:t,tr:n,dispatch:r})=>{var o=function(e){var t=e.split(/-(?!$)/);let n=t[t.length-1];"Space"===n&&(n=" ");let r,o,i,s;for(let e=0;e!["Alt","Ctrl","Meta","Shift"].includes(e));const s=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0});i=e.captureTransaction(()=>{t.someProp("handleKeyDown",e=>e(t,s))});return null!=i&&i.steps.forEach(e=>{e=e.map(n.mapping);e&&r&&n.maybeStep(e)}),!0},lift:(n,r={})=>({state:e,dispatch:t})=>{return!!A(e,w(n,e.schema),r)&&s.lift(e,t)},liftEmptyBlock:()=>({state:e,dispatch:t})=>s.liftEmptyBlock(e,t),liftListItem:r=>({state:e,dispatch:t})=>{var n=w(r,e.schema);return z.liftListItem(n)(e,t)},newlineInCode:()=>({state:e,dispatch:t})=>s.newlineInCode(e,t),resetAttributes:(s,a)=>({tr:r,state:t,dispatch:e})=>{let o=null,i=null;var n=E("string"==typeof s?s:s.name,t.schema);return!!n&&("node"===n&&(o=w(s,t.schema)),"mark"===n&&(i=M(s,t.schema)),e&&r.selection.ranges.forEach(e=>{t.doc.nodesBetween(e.$from.pos,e.$to.pos,(t,n)=>{o&&o===t.type&&r.setNodeMarkup(n,void 0,ue(t.attrs,a)),i&&t.marks.length&&t.marks.forEach(e=>{i===e.type&&r.addMark(n,n+t.nodeSize,i.create(ue(e.attrs,a)))})})}),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),selectNodeBackward:()=>({state:e,dispatch:t})=>s.selectNodeBackward(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>s.selectNodeForward(e,t),selectParentNode:()=>({state:e,dispatch:t})=>s.selectParentNode(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>s.selectTextblockEnd(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>s.selectTextblockStart(e,t),setContent:(o,i=!1,s={})=>({tr:e,editor:t,dispatch:n})=>{var r=e["doc"],t=de(o,t.schema,s);return n&&e.replaceWith(0,r.content.size,t).setMeta("preventUpdate",!i),!0},setMark:(c,u={})=>({tr:s,state:t,dispatch:e})=>{var n=s["selection"],{empty:n,ranges:r}=n;const a=M(c,t.schema);e&&(n?(e=pe(t,a),s.addStoredMark(a.create({...e,...u}))):r.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;t.doc.nodesBetween(o,i,(e,t)=>{const n=Math.max(t,o),r=Math.min(t+e.nodeSize,i);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&s.addMark(n,r,a.create({...e.attrs,...u}))}):s.addMark(n,r,a.create(u))})}));{var o=t,i=(n=s,a),l,n=n["selection"];let e=null;return(e=ie(n)?n.$cursor:e)?(l=null!=(l=o.storedMarks)?l:e.marks(),!!i.isInSet(l)||!l.some(e=>e.type.excludes(i))):(l=n["ranges"]).some(({$from:e,$to:t})=>{let r=0===e.depth&&o.doc.inlineContent&&o.doc.type.allowsMarkType(i);return o.doc.nodesBetween(e.pos,t.pos,(e,t,n)=>{return!r&&(e.isInline&&(n=!n||n.type.allowsMarkType(i),e=!!i.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(i)),r=n&&e),!r)}),r})}},setMeta:(t,n)=>({tr:e})=>(e.setMeta(t,n),!0),setNode:(o,i={})=>({state:t,dispatch:n,chain:e})=>{const r=w(o,t.schema);return r.isTextblock?e().command(({commands:e})=>{return!!s.setBlockType(r,i)(t)||e.clearNodes()}).command(({state:e})=>s.setBlockType(r,i)(e,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:r=>({tr:e,dispatch:t})=>{var n;return t&&(t=e["doc"],n=O(r,0,t.content.size),t=v.NodeSelection.create(t,n),e.setSelection(t)),!0},setTextSelection:s=>({tr:e,dispatch:t})=>{var n,r,o,i;return t&&(t=e["doc"],{from:i,to:o}="number"==typeof s?{from:s,to:s}:s,r=O(i,i=v.TextSelection.atStart(t).from,n=v.TextSelection.atEnd(t).to),o=O(o,i,n),i=v.TextSelection.create(t,r,o),e.setSelection(i)),!0},sinkListItem:r=>({state:e,dispatch:t})=>{var n=w(r,e.schema);return z.sinkListItem(n)(e,t)},splitBlock:({keepMarks:d=!0}={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var{selection:s,doc:a}=n,{$from:l,$to:c}=s,u=R(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(s instanceof v.NodeSelection&&s.node.isBlock)return!(!l.parentOffset||!y.canSplit(a,l.pos)||(o&&(d&&Me(r,i.extensionManager.splittableMarks),n.split(l.pos).scrollIntoView()),0));if(!l.parent.isBlock)return!1;if(o){a=c.parentOffset===c.parent.content.size,o=(s instanceof v.TextSelection&&n.deleteSelection(),0===l.depth?void 0:he(l.node(-1).contentMatchAt(l.indexAfter(-1))));let e=a&&o?[{type:o,attrs:u}]:void 0,t=y.canSplit(n.doc,n.mapping.map(l.pos),1,e);e||t||!y.canSplit(n.doc,n.mapping.map(l.pos),1,o?[{type:o}]:void 0)||(t=!0,e=o?[{type:o,attrs:u}]:void 0),t&&(n.split(n.mapping.map(l.pos),1,e),!o||a||l.parentOffset||l.parent.type===o||(c=n.mapping.map(l.before()),s=n.doc.resolve(c),l.node(-1).canReplaceWith(s.index(),s.index()+1,o)&&n.setNodeMarkup(n.mapping.map(l.before()),o))),d&&Me(r,i.extensionManager.splittableMarks),n.scrollIntoView()}return!0},splitListItem:m=>({tr:e,state:t,dispatch:n,editor:r})=>{var o=w(m,t.schema),{$from:i,$to:s}=t.selection,a=t.selection.node;if(a&&a.isBlock||i.depth<2||!i.sameParent(s))return!1;a=i.node(-1);if(a.type!==o)return!1;var l=r.extensionManager.attributes;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==o||i.index(-2)!==i.node(-2).childCount-1)return!1;if(n){let t=g.Fragment.empty;var c=i.index(-1)?1:i.index(-2)?2:3;for(let e=i.depth-c;e>=i.depth-3;--e)t=g.Fragment.from(i.node(e).copy(t));var u=i.indexAfter(-1){if(-1f.includes(e.type.name));e.ensureMarks(s)}}return!0},toggleList:(m,v,g,y={})=>({editor:e,tr:n,state:t,dispatch:r,chain:o,commands:i,can:s})=>{const{extensions:a,splittableMarks:l}=e.extensionManager,c=w(m,t.schema);var e=w(v,t.schema),{selection:t,storedMarks:u}=t,{$from:d,$to:p}=t,d=d.blockRange(p);const h=u||t.$to.parentOffset&&t.$from.marks();if(!d)return!1;const f=D(e=>Se(e.type.name,a))(t);if(1<=d.depth&&f&&d.depth-f.depth<=1){if(f.node.type===c)return i.liftListItem(e);if(Se(f.node.type.name,a)&&c.validContent(f.node.content)&&r)return o().command(()=>(n.setNodeMarkup(f.pos,c),!0)).command(()=>Oe(n,c)).command(()=>Te(n,c)).run()}return(g&&h&&r?o().command(()=>{var e=s().wrapInList(c,y),t=h.filter(e=>l.includes(e.type.name));return n.ensureMarks(t),!!e||i.clearNodes()}):o().command(()=>{return!!s().wrapInList(c,y)||i.clearNodes()})).wrapInList(c,y).command(()=>Oe(n,c)).command(()=>Te(n,c)).run()},toggleMark:(o,i={},s={})=>({state:e,commands:t})=>{var{extendEmptyMarkRange:n=!1}=s,r=M(o,e.schema);return I(e,r,i)?t.unsetMark(r,{extendEmptyMarkRange:n}):t.setMark(r,i)},toggleNode:(o,i,s={})=>({state:e,commands:t})=>{var n=w(o,e.schema),r=w(i,e.schema);return A(e,n,s)?t.setNode(r):t.setNode(n,s)},toggleWrap:(r,o={})=>({state:e,commands:t})=>{var n=w(r,e.schema);return A(e,n,o)?t.lift(n):t.wrapIn(n,o)},undoInputRule:()=>({state:n,dispatch:r})=>{var o=n.plugins;for(let t=0;t({tr:t,dispatch:e})=>{var n=t["selection"],{empty:n,ranges:r}=n;return n||e&&r.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),!0},unsetMark:(t,c={})=>({tr:n,state:r,dispatch:o})=>{var{extendEmptyMarkRange:i=!1}=c,s=n["selection"];const a=M(t,r.schema);var{$from:r,empty:l,ranges:e}=s;if(o){if(l&&i){let{from:e,to:t}=s;l=null==(o=r.marks().find(e=>e.type===a))?void 0:o.attrs,i=x(r,a,l);i&&(e=i.from,t=i.to),n.removeMark(e,t,a)}else e.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});n.removeStoredMark(a)}return!0},updateAttributes:(o,c={})=>({tr:a,state:t,dispatch:e})=>{let n=null,l=null;var r=E("string"==typeof o?o:o.name,t.schema);return!!r&&("node"===r&&(n=w(o,t.schema)),"mark"===r&&(l=M(o,t.schema)),e&&a.selection.ranges.forEach(e=>{const i=e.$from.pos,s=e.$to.pos;t.doc.nodesBetween(i,s,(r,o)=>{n&&n===r.type&&a.setNodeMarkup(o,void 0,{...r.attrs,...c}),l&&r.marks.length&&r.marks.forEach(e=>{var t,n;l===e.type&&(t=Math.max(o,i),n=Math.min(o+r.nodeSize,s),a.addMark(t,n,l.create({...e.attrs,...c})))})})}),!0)},wrapIn:(r,o={})=>({state:e,dispatch:t})=>{var n=w(r,e.schema);return s.wrapIn(n,o)(e,t)},wrapInList:(r,o={})=>({state:e,dispatch:t})=>{var n=w(r,e.schema);return z.wrapInList(n,o)(e,t)}}),Ne=f.create({name:"commands",addCommands(){return{...Ce}}}),Ae=f.create({name:"editable",addProseMirrorPlugins(){return[new v.Plugin({key:new v.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ee=f.create({name:"focusEvents",addProseMirrorPlugins(){const n=this["editor"];return[new v.Plugin({key:new v.PluginKey("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;t=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(t),!1},blur:(e,t)=>{n.isFocused=!1;t=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(t),!1}}}})]}}),De=f.create({name:"keymap",addKeyboardShortcuts(){var e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:e})=>{var{selection:t,doc:n}=e,{empty:t,$anchor:r}=t,{pos:o,parent:i}=r,e=r.parent.isTextblock?e.doc.resolve(o-1):r,s=e.parent.type.spec.isolating,a=r.pos-r.parentOffset,s=s&&1===e.parent.childCount?a===r.pos:v.Selection.atStart(n).from===o;return!(!(t&&s&&i.type.isTextblock)||i.textContent.length)&&l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},n={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return T()||ce()?n:r},addProseMirrorPlugins(){return[new v.Plugin({key:new v.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.docChanged)&&!t.doc.eq(n.doc)){var{empty:e,from:r,to:o}=t.selection,i=v.Selection.atStart(t.doc).from,t=v.Selection.atEnd(t.doc).to,r=r===i&&o===t;if(!e&&r)if(0===n.doc.textBetween(0,n.doc.content.size," "," ").length){i=n.tr,o=k({state:n,transaction:i}),t=new b({editor:this.editor,state:o})["commands"];if(t.clearNodes(),i.steps.length)return i}}}})]}}),Pe=f.create({name:"tabindex",addProseMirrorPlugins(){return[new v.Plugin({key:new v.PluginKey("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Re=Object.freeze({__proto__:null,ClipboardTextSerializer:e,Commands:Ne,Editable:Ae,FocusEvents:Ee,Keymap:De,Tabindex:Pe});class B{constructor(e,t){this.resolvedPos=e,this.editor=t}get node(){return this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){this.editor.commands.insertContentAt({from:this.from,to:this.to},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){var e;return 0===this.depth?null:(e=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(e),new B(e,this.editor))}get before(){let e=this.resolvedPos.doc.resolve(this.from-2);return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new B(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+2);return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new B(e,this.editor)}get children(){const n=[];return this.node.content.forEach((e,t)=>{t=this.pos+t+1,t=this.resolvedPos.doc.resolve(t);t.depth!==this.depth&&n.push(new B(t,this.editor))}),n}get firstChild(){return this.children[0]||null}get lastChild(){var e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(0{if(e.node.type.name===o){if(0(null==e?void 0:e.type.name)===t.name)&&((n=n.find(e=>(null==e?void 0:e.type.name)===t.name))&&r.removeStoredMark(n),r.insertText(" ",o.pos),e.view.dispatch(r),!0)}}t.CommandManager=b,t.Editor=class extends class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){e=this.callbacks[e];return e&&e.forEach(e=>e.apply(this,t)),this}off(e,t){var n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Ie(`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 1px !important; height: 1px !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){t=V(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],e=this.state.reconfigure({plugins:t});this.view.updateState(e)}unregisterPlugin(e){if(!this.isDestroyed){const t="string"==typeof e?e+"$":e.key;e=this.state.reconfigure({plugins:this.state.plugins.filter(e=>!e.key.startsWith(t))});this.view.updateState(e)}}createExtensionManager(){var e=[...this.options.enableCoreExtensions?Object.values(Re):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new p(e,this)}createCommandManager(){this.commandManager=new b({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e=de(this.options.content,this.schema,this.options.parseOptions),t=se(e,this.options.autofocus),e=(this.view=new L.EditorView(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:v.EditorState.create({doc:e,selection:t||void 0})}),this.state.reconfigure({plugins:this.extensionManager.plugins}));this.view.updateState(e),this.createNodeViews(),this.prependClass(),this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className="tiptap "+this.view.dom.className}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(e){if(!this.view.isDestroyed){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);var t=this.state.apply(e),n=!this.state.selection.eq(t.selection),t=(this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e}),e.getMeta("focus")),n=e.getMeta("blur");t&&this.emit("focus",{editor:this,event:t.event,transaction:e}),n&&this.emit("blur",{editor:this,event:n.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}}getAttributes(e){return ye(this.state,e)}isActive(e,t){return we(this.state,"string"==typeof e?e:null,"string"==typeof e?t:e)}getJSON(){return this.state.doc.toJSON()}getHTML(){return me(this.state.doc.content,this.schema)}getText(e){var{blockSeparator:e="\n\n",textSerializers:t={}}=e||{};return ve(this.state.doc,{blockSeparator:e,textSerializers:{...m(this.schema),...t}})}get isEmpty(){return xe(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(null!=(e=this.view)&&e.docView)}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){e=this.state.doc.resolve(e);return new B(e,this)}get $doc(){return this.$pos(0)}},t.Extension=f,t.InputRule=n,t.Mark=Be,t.Node=class je{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&0{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0})),o||n||a||l||c||u&&s))))))}ignoreMutation(e){if(!this.dom||!this.contentDOM)return!0;if("function"==typeof this.options.ignoreMutation)return this.options.ignoreMutation({mutation:e});if(this.node.isLeaf||this.node.isAtom)return!0;if("selection"===e.type)return!1;if(this.dom.contains(e.target)&&"childList"===e.type&&(T()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))return!1;return this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{var t=this.getPos();return e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0})}deleteNode(){var e=this.getPos(),t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}},t.PasteRule=r,t.Tracker=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let n=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((e,t)=>{t=t.getMap().mapResult(e);return t.deleted&&(n=!0),t.pos},e),deleted:n}}},t.callOrReturn=d,t.combineTransactionSteps=function(e,t){const n=new y.Transform(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n},t.createChainableState=k,t.createDocument=de,t.createNodeFromContent=N,t.createStyleTag=Ie,t.defaultBlockAt=he,t.deleteProps=ue,t.elementFromString=C,t.escapeForRegEx=function(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},t.extensions=Re,t.findChildren=function(e,n){const r=[];return e.descendants((e,t)=>{n(e)&&r.push({node:e,pos:t})}),r},t.findChildrenInRange=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r},t.findDuplicates=ne,t.findParentNode=D,t.findParentNodeClosestToPos=fe,t.fromString=J,t.generateHTML=function(e,t){return t=P(t),me(g.Node.fromJSON(t,e).content,t)},t.generateJSON=function(e,t){return t=P(t),e=C(e),g.DOMParser.fromSchema(t).parse(e).toJSON()},t.generateText=function(e,t,n){var{blockSeparator:n="\n\n",textSerializers:r={}}=n||{},t=P(t);return ve(g.Node.fromJSON(t,e),{blockSeparator:n,textSerializers:{...m(t),...r}})},t.getAttributes=ye,t.getAttributesFromExtensions=$,t.getChangedRanges=function(e){const{mapping:i,steps:r}=e,s=[];i.maps.forEach((e,o)=>{const n=[];if(e.ranges.length)e.forEach((e,t)=>{n.push({from:e,to:t})});else{var{from:e,to:t}=r[o];if(void 0===e||void 0===t)return;n.push({from:e,to:t})}n.forEach(({from:e,to:t})=>{var e=i.slice(o).map(e,-1),t=i.slice(o).map(t),n=i.invert().map(e,-1),r=i.invert().map(t);s.push({oldRange:{from:n,to:r},newRange:{from:e,to:t}})})});{const o=ke(e=s);return 1===o.length?o:o.filter((t,n)=>{return!o.filter((e,t)=>t!==n).some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to)})}},t.getDebugJSON=function r(e,o=0){const i=e.type===e.type.schema.topNodeType?0:1;var t=o,n=t+e.nodeSize,s=e.marks.map(e=>{var t={type:e.type.name};return Object.keys(e.attrs).length&&(t.attrs={...e.attrs}),t}),a={...e.attrs};const l={type:e.type.name,from:t,to:n};return Object.keys(a).length&&(l.attrs=a),s.length&&(l.marks=s),e.content.childCount&&(l.content=[],e.forEach((e,t)=>{var n;null!=(n=l.content)&&n.push(r(e,o+t+i))})),e.text&&(l.text=e.text),l},t.getExtensionField=c,t.getHTMLFromFragment=me,t.getMarkAttributes=pe,t.getMarkRange=x,t.getMarkType=M,t.getMarksBetween=be,t.getNodeAtPosition=(e,t,n,r=20)=>{var o=e.doc.resolve(n);let i=r,s=null;for(;0{var n,{$from:r,$to:o,$anchor:i}=e.selection;return t?!!(n=D(e=>e.type.name===t)(e.selection))&&(e=e.doc.resolve(n.pos+1),i.pos+1===e.end()):!(o.parentOffset{var{$from:e,$to:t}=e.selection;return!(0{var r=d(l.getAttributes,void 0,n);if(!1===r||null===r)return null;var o=e["tr"],i=n[n.length-1],n=n[0];if(i){var s=n.search(/\S/);const a=t.from+n.indexOf(i);n=a+i.length;if(be(t.from,t.to,e.doc).filter(t=>{return t.mark.type.excluded.find(e=>e===l.type&&e!==t.mark.type)}).filter(e=>e.to>a).length)return null;nt.from&&o.delete(t.from+s,a);e=t.from+s+i.length;o.addMark(t.from+s,e,l.type.create(r||{})),o.removeStoredMark(l.type)}}})},t.markPasteRule=function(l){return new r({find:l.find,handler:({state:e,range:t,match:n,pasteEvent:r})=>{r=d(l.getAttributes,void 0,n,r);if(!1===r||null===r)return null;var o=e["tr"],i=n[n.length-1],n=n[0];t.to;if(i){var s=n.search(/\S/);const a=t.from+n.indexOf(i);n=a+i.length;if(be(t.from,t.to,e.doc).filter(t=>{return t.mark.type.excluded.find(e=>e===l.type&&e!==t.mark.type)}).filter(e=>e.to>a).length)return null;nt.from&&o.delete(t.from+s,a),e=t.from+s+i.length,o.addMark(t.from+s,e,l.type.create(r||{})),o.removeStoredMark(l.type)}}})},t.mergeAttributes=_,t.mergeDeep=h,t.minMax=O,t.nodeInputRule=function(a){return new n({find:a.find,handler:({state:t,range:n,match:r})=>{var e=d(a.getAttributes,void 0,r)||{},t=t["tr"],o=n.from;let i=n.to;n=a.type.create(e);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>i?e=i:i=e+r[1].length;var s=r[0][r[0].length-1];t.insertText(s,o+r[0].length-1),t.replaceWith(e,i,n)}else r[0]&&t.insert(o-1,a.type.create(e)).delete(t.mapping.map(o),t.mapping.map(i));t.scrollIntoView()}})},t.nodePasteRule=function(o){return new r({find:o.find,handler({match:e,chain:t,range:n,pasteEvent:r}){r=d(o.getAttributes,void 0,e,r);if(!1===r||null===r)return null;e.input&&t().deleteRange(n).insertContentAt(n.from,{type:o.type.name,attrs:r})}})},t.objectIncludes=S,t.pasteRulesPlugin=te,t.posToDOMRect=function(e,t,n){var r=e.state.doc.content.size,t=O(t,0,r),n=O(n,0,r),r=e.coordsAtPos(t),t=e.coordsAtPos(n,-1),e=Math.min(r.top,t.top),n=Math.max(r.bottom,t.bottom),o=Math.min(r.left,t.left),r=Math.max(r.right,t.right);const i={top:e,bottom:n,left:o,right:r,width:r-o,height:n-e,x:o,y:e};return{...i,toJSON:()=>i}},t.removeDuplicates=ke,t.resolveFocusPosition=se,t.selectionToInsertionEnd=le,t.splitExtensions=i,t.textInputRule=function(a){return new n({find:a.find,handler:({state:e,range:t,match:n})=>{let r=a.replace,o=t.from;var i,s,t=t.to;n[1]&&(i=n[0].lastIndexOf(n[1]),r+=n[0].slice(i+n[1].length),0<(s=(o+=i)-t))&&(r=n[0].slice(i-s,i)+r,o=t),e.tr.insertText(r,o,t)}})},t.textPasteRule=function(a){return new r({find:a.find,handler:({state:e,range:t,match:n})=>{let r=a.replace,o=t.from;var i,s,t=t.to;n[1]&&(i=n[0].lastIndexOf(n[1]),r+=n[0].slice(i+n[1].length),0<(s=(o+=i)-t))&&(r=n[0].slice(i-s,i)+r,o=t),e.tr.insertText(r,o,t)}})},t.textblockTypeInputRule=function(o){return new n({find:o.find,handler:({state:e,range:t,match:n})=>{var r=e.doc.resolve(t.from),n=d(o.getAttributes,void 0,n)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),o.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,o.type,n)}})},t.wrappingInputRule=function(c){return new n({find:c.find,handler:({state:e,range:t,match:n,chain:r})=>{var o=d(c.getAttributes,void 0,n)||{},i=e.tr.delete(t.from,t.to),s=i.doc.resolve(t.from).blockRange(),a=s&&y.findWrapping(s,c.type,o);if(!a)return null;if(i.wrap(s,a),c.keepMarks&&c.editor){var{selection:s,storedMarks:a}=e;const l=c.editor.extensionManager["splittableMarks"];e=a||s.$to.parentOffset&&s.$from.marks();e&&(a=e.filter(e=>l.includes(e.type.name)),i.ensureMarks(a))}c.keepAttributes&&(s="bulletList"===c.type.name||"orderedList"===c.type.name?"listItem":"taskList",r().updateAttributes(s,o).run());e=i.doc.resolve(t.from-1).nodeBefore;e&&e.type===c.type&&y.canJoin(i.doc,t.from-1)&&(!c.joinPredicate||c.joinPredicate(n,e))&&i.join(t.from-1)}})}},{"@tiptap/pm/commands":24,"@tiptap/pm/keymap":28,"@tiptap/pm/model":29,"@tiptap/pm/schema-list":30,"@tiptap/pm/state":31,"@tiptap/pm/transform":32,"@tiptap/pm/view":33}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/^\s*>\s$/;e=r.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[r.wrappingInputRule({find:o,type:this.type})]}});n.Blockquote=e,n.default=e,n.inputRegex=o},{"@tiptap/core":2}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,i=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,s=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,a=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g;e=r.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[r.markInputRule({find:o,type:this.type}),r.markInputRule({find:s,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:i,type:this.type}),r.markPasteRule({find:a,type:this.type})]}});n.Bold=e,n.default=e,n.starInputRegex=o,n.starPasteRegex=i,n.underscoreInputRegex=s,n.underscorePasteRegex=a},{"@tiptap/core":2}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=r.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),i=r.Mark.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>{return!!e.hasAttribute("style")&&{}}}]},renderHTML({HTMLAttributes:e}){return["span",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{e=r.getMarkAttributes(e,this.type);return!!Object.entries(e).some(([,e])=>!!e)||t.unsetMark(this.name)}}}}),s=/^\s*([-+*])\s$/;e=r.Node.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return this.options.itemTypeName+"+"},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(o.name,this.editor.getAttributes(i.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=r.wrappingInputRule({find:s,type:this.type});return[e=this.options.keepMarks||this.options.keepAttributes?r.wrappingInputRule({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(i.name),editor:this.editor}):e]}});n.BulletList=e,n.default=e,n.inputRegex=s},{"@tiptap/core":2}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/pm/state");const i=/^```([a-z]+)?[\s\n]$/,s=/^~~~([a-z]+)?[\s\n]$/;e=r.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{const t=this.options["languageClassPrefix"];e=[...(null==(e=e.firstElementChild)?void 0:e.classList)||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,""))[0];return e||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",r.mergeAttributes(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{var{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name||!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes()},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;var t,n=e["state"],n=n["selection"];const{$from:r,empty:o}=n;return!(!o||r.parent.type!==this.type||(n=r.parentOffset===r.parent.nodeSize-2,t=r.parent.textContent.endsWith("\n\n"),!n)||!t)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{var t,n,r;return!(!this.options.exitOnArrowDown||(n=e.state,{selection:n,doc:t}=n,{$from:n,empty:r}=n,!r)||n.parent.type!==this.type||n.parentOffset!==n.parent.nodeSize-2||void 0===(r=n.after())||t.nodeAt(r))&&e.commands.exitCode()}}},addInputRules(){return[r.textblockTypeInputRule({find:i,type:this.type,getAttributes:e=>({language:e[1]})}),r.textblockTypeInputRule({find:s,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new o.Plugin({key:new o.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{var n,r;return!!t.clipboardData&&!(this.editor.isActive(this.type.name)||(n=t.clipboardData.getData("text/plain"),t=null==(t=(t=t.clipboardData.getData("vscode-editor-data"))?JSON.parse(t):void 0)?void 0:t.mode,!n)||!t||(r=e.state["tr"],r.replaceSelectionWith(this.type.create({language:t})),r.setSelection(o.TextSelection.near(r.doc.resolve(Math.max(0,r.selection.from-2)))),r.insertText(n.replace(/\r\n?/g,"\n")),r.setMeta("paste",!0),e.dispatch(r),0))}}})]}});n.CodeBlock=e,n.backtickInputRegex=i,n.default=e,n.tildeInputRegex=s},{"@tiptap/core":2,"@tiptap/pm/state":31}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,i=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;e=r.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[r.markInputRule({find:o,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:i,type:this.type})]}});n.Code=e,n.default=e,n.inputRegex=o,n.pasteRegex=i},{"@tiptap/core":2}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});e=e("@tiptap/core").Node.create({name:"doc",topNode:!0,content:"block+"});n.Document=e,n.default=e},{"@tiptap/core":2}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/pm/dropcursor"),e=r.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[o.dropCursor(this.options)]}});n.Dropcursor=e,n.default=e},{"@tiptap/core":2,"@tiptap/pm/dropcursor":25}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/pm/gapcursor"),e=r.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[o.gapCursor()]},extendNodeSchema(e){var t={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(e=r.callOrReturn(r.getExtensionField(e,"allowGapCursor",t)))?e:null}}});n.Gapcursor=e,n.default=e},{"@tiptap/core":2,"@tiptap/pm/gapcursor":26}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),e=r.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",r.mergeAttributes(this.options.HTMLAttributes,e)]},renderText(){return"\n"},addCommands(){return{setHardBreak:()=>({commands:e,chain:i,state:s,editor:a})=>e.first([()=>e.exitCode(),()=>e.command(()=>{var{selection:e,storedMarks:t}=s;if(e.$from.parent.type.spec.isolating)return!1;const n=this.options["keepMarks"],r=a.extensionManager["splittableMarks"],o=t||e.$to.parentOffset&&e.$from.marks();return i().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{return t&&o&&n&&(t=o.filter(e=>r.includes(e.type.name)),e.ensureMarks(t)),!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});n.HardBreak=e,n.default=e},{"@tiptap/core":2}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),e=r.Node.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:"h"+e,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return["h"+(this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]),r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,["Mod-Alt-"+t]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>r.textblockTypeInputRule({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});n.Heading=e,n.default=e},{"@tiptap/core":2}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/,i=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g;e=r.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[r.markInputRule({find:o,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:i,type:this.type})]}});n.Highlight=e,n.default=e,n.inputRegex=o,n.pasteRegex=i},{"@tiptap/core":2}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/pm/history"),e=r.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>o.undo(e,t),redo:()=>({state:e,dispatch:t})=>o.redo(e,t)}},addProseMirrorPlugins(){return[o.history(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});n.History=e,n.default=e},{"@tiptap/core":2,"@tiptap/pm/history":27}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/pm/state"),e=r.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",r.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{t=t.selection.$to,e=e();return 0===t.parentOffset?e.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):e.insertContent({type:this.name}),e.command(({tr:e,dispatch:t})=>{var n;return t&&(t=e.selection["$to"],n=t.end(),t.nodeAfter?t.nodeAfter.isTextblock?e.setSelection(o.TextSelection.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(o.NodeSelection.create(e.doc,t.pos)):e.setSelection(o.TextSelection.create(e.doc,t.pos)):(t=null==(t=t.parent.type.contentMatch.defaultType)?void 0:t.create())&&(e.insert(n,t),e.setSelection(o.TextSelection.create(e.doc,n+1))),e.scrollIntoView()),!0}).run()}}},addInputRules(){return[r.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});n.HorizontalRule=e,n.default=e},{"@tiptap/core":2,"@tiptap/pm/state":31}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;e=r.Node.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",r.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[r.nodeInputRule({find:o,type:this.type,getAttributes:e=>{var[,,e,t,n]=e;return{src:t,alt:e,title:n}}})]}});n.Image=e,n.default=e,n.inputRegex=o},{"@tiptap/core":2}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,i=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,s=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,a=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g;e=r.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r.markInputRule({find:o,type:this.type}),r.markInputRule({find:s,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:i,type:this.type}),r.markPasteRule({find:a,type:this.type})]}});n.Italic=e,n.default=e,n.starInputRegex=o,n.starPasteRegex=i,n.underscoreInputRegex=s,n.underscorePasteRegex=a},{"@tiptap/core":2}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),e=r.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});n.ListItem=e,n.default=e},{"@tiptap/core":2}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=r.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),i=r.Mark.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>{return!!e.hasAttribute("style")&&{}}}]},renderHTML({HTMLAttributes:e}){return["span",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{e=r.getMarkAttributes(e,this.type);return!!Object.entries(e).some(([,e])=>!!e)||t.unsetMark(this.name)}}}}),s=/^(\d+)\.\s$/;e=r.Node.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return this.options.itemTypeName+"+"},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",r.mergeAttributes(this.options.HTMLAttributes,n),0]:["ol",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(o.name,this.editor.getAttributes(i.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=r.wrappingInputRule({find:s,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return[e=this.options.keepMarks||this.options.keepAttributes?r.wrappingInputRule({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(i.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor}):e]}});n.OrderedList=e,n.default=e,n.inputRegex=s},{"@tiptap/core":2}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),e=r.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});n.Paragraph=e,n.default=e},{"@tiptap/core":2}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core");const o=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,i=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g;e=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}]},renderHTML({HTMLAttributes:e}){return["s",r.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){var e={};return r.isMacOS()?e["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():e["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),e},addInputRules(){return[r.markInputRule({find:o,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:i,type:this.type})]}});n.Strike=e,n.default=e,n.inputRegex=o,n.pasteRegex=i},{"@tiptap/core":2}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});e=e("@tiptap/core").Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>e.style.textAlign||this.options.defaultAlignment,renderHTML:e=>e.textAlign===this.options.defaultAlignment?{}:{style:"text-align: "+e.textAlign}}}}]},addCommands(){return{setTextAlign:n=>({commands:t})=>!!this.options.alignments.includes(n)&&this.options.types.every(e=>t.updateAttributes(e,{textAlign:n})),unsetTextAlign:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});n.TextAlign=e,n.default=e},{"@tiptap/core":2}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});e=e("@tiptap/core").Node.create({name:"text",group:"inline"});n.Text=e,n.default=e},{"@tiptap/core":2}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-commands");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-commands":36}],25:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-dropcursor");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-dropcursor":37}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-gapcursor");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-gapcursor":38}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-history");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-history":39}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-keymap");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-keymap":40}],29:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-model");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-model":41}],30:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-schema-list");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-schema-list":42}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-state");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-state":43}],32:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-transform");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-transform":44}],33:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,e=e("prosemirror-view");r=e,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},{"prosemirror-view":45}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@tiptap/core"),o=e("@tiptap/extension-blockquote"),i=e("@tiptap/extension-bold"),s=e("@tiptap/extension-bullet-list"),a=e("@tiptap/extension-code"),l=e("@tiptap/extension-code-block"),c=e("@tiptap/extension-document"),u=e("@tiptap/extension-dropcursor"),d=e("@tiptap/extension-gapcursor"),p=e("@tiptap/extension-hard-break"),h=e("@tiptap/extension-heading"),f=e("@tiptap/extension-history"),m=e("@tiptap/extension-horizontal-rule"),v=e("@tiptap/extension-italic"),g=e("@tiptap/extension-list-item"),y=e("@tiptap/extension-ordered-list"),k=e("@tiptap/extension-paragraph"),b=e("@tiptap/extension-strike"),w=e("@tiptap/extension-text"),e=r.Extension.create({name:"starterKit",addExtensions(){var e,t=[];return!1!==this.options.blockquote&&t.push(o.Blockquote.configure(null==(e=this.options)?void 0:e.blockquote)),!1!==this.options.bold&&t.push(i.Bold.configure(null==(e=this.options)?void 0:e.bold)),!1!==this.options.bulletList&&t.push(s.BulletList.configure(null==(e=this.options)?void 0:e.bulletList)),!1!==this.options.code&&t.push(a.Code.configure(null==(e=this.options)?void 0:e.code)),!1!==this.options.codeBlock&&t.push(l.CodeBlock.configure(null==(e=this.options)?void 0:e.codeBlock)),!1!==this.options.document&&t.push(c.Document.configure(null==(e=this.options)?void 0:e.document)),!1!==this.options.dropcursor&&t.push(u.Dropcursor.configure(null==(e=this.options)?void 0:e.dropcursor)),!1!==this.options.gapcursor&&t.push(d.Gapcursor.configure(null==(e=this.options)?void 0:e.gapcursor)),!1!==this.options.hardBreak&&t.push(p.HardBreak.configure(null==(e=this.options)?void 0:e.hardBreak)),!1!==this.options.heading&&t.push(h.Heading.configure(null==(e=this.options)?void 0:e.heading)),!1!==this.options.history&&t.push(f.History.configure(null==(e=this.options)?void 0:e.history)),!1!==this.options.horizontalRule&&t.push(m.HorizontalRule.configure(null==(e=this.options)?void 0:e.horizontalRule)),!1!==this.options.italic&&t.push(v.Italic.configure(null==(e=this.options)?void 0:e.italic)),!1!==this.options.listItem&&t.push(g.ListItem.configure(null==(e=this.options)?void 0:e.listItem)),!1!==this.options.orderedList&&t.push(y.OrderedList.configure(null==(e=this.options)?void 0:e.orderedList)),!1!==this.options.paragraph&&t.push(k.Paragraph.configure(null==(e=this.options)?void 0:e.paragraph)),!1!==this.options.strike&&t.push(b.Strike.configure(null==(e=this.options)?void 0:e.strike)),!1!==this.options.text&&t.push(w.Text.configure(null==(e=this.options)?void 0:e.text)),t}});n.StarterKit=e,n.default=e},{"@tiptap/core":2,"@tiptap/extension-blockquote":3,"@tiptap/extension-bold":4,"@tiptap/extension-bullet-list":5,"@tiptap/extension-code":7,"@tiptap/extension-code-block":6,"@tiptap/extension-document":8,"@tiptap/extension-dropcursor":9,"@tiptap/extension-gapcursor":10,"@tiptap/extension-hard-break":11,"@tiptap/extension-heading":12,"@tiptap/extension-history":14,"@tiptap/extension-horizontal-rule":15,"@tiptap/extension-italic":17,"@tiptap/extension-list-item":18,"@tiptap/extension-ordered-list":19,"@tiptap/extension-paragraph":20,"@tiptap/extension-strike":21,"@tiptap/extension-text":23}],35:[function(e,t,n){"use strict";function i(e){this.content=e}i.prototype={constructor:i,find:function(e){for(var t=0;t>1}},i.from=function(e){if(e instanceof i)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new i(t)},t.exports=i},{}],36:[function(e,B,t){"use strict";function n(e){return(n="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})(e)}Object.defineProperty(t,"__esModule",{value:!0});function r(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}var b=e("prosemirror-transform"),w=e("prosemirror-model"),S=e("prosemirror-state");function s(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):0=a-o||(n&&((e=e.tr.step(t)).setSelection(S.TextSelection.create(e.doc,o)),n(e.scrollIntoView())),0))}function x(e,t,n){for(var r=2=t.depth)return n&&n(e.tr.lift(h,a).scrollIntoView()),1;if(s&&x(i,"start",!0)&&x(o,"end")){for(var f=o,m=[];m.push(f),!f.isTextblock;)f=f.lastChild;for(var v=i,g=1;!v.isTextblock;v=v.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,v.content)){if(n){for(var y=w.Fragment.empty,k=m.length-1;0<=k;k--)y=w.Fragment.from(m[k].copy(y));n(e.tr.step(new b.ReplaceAroundStep(t.pos-m.length,t.pos+i.nodeSize,t.pos+g,t.pos+i.nodeSize-g,new w.Slice(y,m.length,0),0,!0)).scrollIntoView())}return 1}}}}function T(i){return function(e,t){for(var n=e.selection,r=i<0?n.$from:n.$to,o=r.depth;r.node(o).isInline;){if(!o)return!1;o--}return!!r.node(o).isTextblock&&(t&&t(e.tr.setSelection(S.TextSelection.create(e.doc,i<0?r.start(o):r.end(o)))),!0)}}var e=T(-1),C=T(1);function N(r,o,i){for(var e=0;ee.state.doc.content.size?this.setCursor(null):this.updateOverlay())}},{key:"setCursor",value:function(e){e!=this.cursorPos&&(null==(this.cursorPos=e)?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function(){var e,t,n,r,o=this.editorView.state.doc.resolve(this.cursorPos),i=!o.parent.inlineContent,o=(i&&(r=o.nodeBefore,o=o.nodeAfter,r||o)&&(t=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0)))&&(t=t.getBoundingClientRect(),e=r?t.bottom:t.top,r&&o&&(e=(e+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:t.left,right:t.right,top:e-this.width/2,bottom:e+this.width/2}),e||(e={left:(r=this.editorView.coordsAtPos(this.cursorPos)).left-this.width/2,right:r.left+this.width/2,top:r.top,bottom:r.bottom}),this.editorView.dom.offsetParent);this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i),r=!o||o==document.body&&"static"==getComputedStyle(o).position?(n=-pageXOffset,-pageYOffset):(n=(t=o.getBoundingClientRect()).left-o.scrollLeft,t.top-o.scrollTop),this.element.style.left=e.left-n+"px",this.element.style.top=e.top-r+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}},{key:"scheduleRemoval",value:function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return t.setCursor(null)},e)}},{key:"dragover",value:function(e){var t,n;this.editorView.editable&&(e="function"==typeof(n=(n=(t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}))&&0<=t.inside&&this.editorView.state.doc.nodeAt(t.inside))&&n.type.spec.disableDropCursor)?n(this.editorView,t,e):n,t)&&!e&&(n=t.pos,this.editorView.dragging&&this.editorView.dragging.slice&&null!=(e=i.dropPoint(this.editorView.state.doc,n,this.editorView.dragging.slice))&&(n=e),this.setCursor(n),this.scheduleRemoval(5e3))}},{key:"dragend",value:function(){this.scheduleRemoval(20)}},{key:"drop",value:function(){this.scheduleRemoval(20)}},{key:"dragleave",value:function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}])&&r(e.prototype,s),a&&r(e,a),Object.defineProperty(e,"prototype",{writable:!1});var s,a,l=c;function c(n,e){var t,r=this;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.editorView=n,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(t=e.width)?t:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map(function(t){function e(e){r[t](e)}return n.dom.addEventListener(t,e),{name:t,handler:e}})}n.dropCursor=function(){var t=0=n?r.maps.length-e.mirrorOffset:void 0;r.appendMap(e.map,t)},n,e),r}},{key:"addMaps",value:function(e){return 0==this.eventCount?this:new f(this.items.append(e.map(function(e){return new m(e)})),this.eventCount)}},{key:"rebased",value:function(o,e){if(!this.eventCount)return this;for(var i=[],t=Math.max(0,this.items.length-e),s=o.mapping,a=o.steps.length,l=this.eventCount,c=(this.items.forEach(function(e){e.selection&&l--},t),e),n=(this.items.forEach(function(e){var t,n,r=s.getMirror(--c);null!=r&&(a=Math.min(a,r),t=s.maps[r],e.step?(n=o.steps[r].invert(o.docs[r]),(e=e.selection&&e.selection.map(s.slice(c+1,r)))&&l++,i.push(new m(t,n,e))):i.push(new m(t)))},t),[]),r=e;r=s[n]&&(a=!0)}),a))))),l=l?y(t.prevRanges,e.mapping):g(e.mapping.maps[e.steps.length-1]),new h(t.done.addTransform(e,i?n.selection.getBookmark():void 0,r,S(n)),d.empty,l,e.time,null==o?t.prevComposition:o))}},config:c,props:{handleDOMEvents:{beforeinput:function(e,t){var n=t.inputType,n="historyUndo"==n?O:"historyRedo"==n?T:null;return!!n&&(t.preventDefault(),n(e.state,e.dispatch))}}}})},n.redo=T,n.redoDepth=function(e){return(e=x.getState(e))?e.undone.eventCount:0},n.undo=O,n.undoDepth=function(e){return(e=x.getState(e))?e.done.eventCount:0}},{"prosemirror-state":43,"prosemirror-transform":44,"rope-sequence":46}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("w3c-keyname"),r=e("prosemirror-state"),l="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function s(e){var t,n=Object.create(null);for(t in e)n[function(e){var t,n,r,o,i=e.split(/-(?!$)/);"Space"==(e=i[i.length-1])&&(e=" ");for(var s=0;se.length)&&(t=e.length);for(var n=0,r=new Array(t);nthis.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(e<=o)return o==e||0"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map(function(e){return e.toJSON()}):null}}],[{key:"fromJSON",value:function(e,t){if(!t)return l.empty;if(Array.isArray(t))return new l(t.map(e.nodeFromJSON));throw new RangeError("Invalid input for Fragment.fromJSON")}},{key:"fromArray",value:function(e){if(!e.length)return l.empty;for(var t,n=0,r=0;rthis.type.rank&&((t=t||e.slice(0,r)).push(this),n=!0),t&&t.push(o)}}return t=t||e.slice(),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;te.depth)throw new h("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new h("Inconsistent open depths");return function e(t,n,r,o){var i=t.index(o),s=t.node(o);{var a;return i==n.index(o)&&on?i++:e.textOffset&&(k(e.nodeAfter,r),i++));for(var a=i;ao&&y(e,t,o+1),s=r.depth>o&&y(n,r,o+1),a=[];return b(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(G(i,s),k(w(i,X(e,t,n,r,o+1)),a)):(i&&k(w(i,S(e,t,o+1)),a),b(t,n,o,a),s&&k(w(s,S(n,r,o+1)),a)),b(r,null,o,a),new p(a)}function S(e,t,n){var r=[];return b(null,e,n,r),e.depth>n&&k(w(y(e,t,n+1),S(e,t,n+1)),r),b(t,null,n,r),new p(r)}function Y(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),o=n-1;0<=o;o--)r=t.node(o).copy(p.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}v.empty=new v(p.empty,0,0);n(x,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(e=this.resolveDepth(e))return e==this.depth+1?this.pos:this.path[3*e-1];throw new RangeError("There is no position before the top-level node")}},{key:"after",value:function(e){if(e=this.resolveDepth(e))return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize;throw new RangeError("There is no position after the top-level node")}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e,t,n=this.parent,r=this.index(this.depth);return r==n.childCount?null:(e=this.pos-this.path[this.path.length-1],t=n.child(r),e?n.child(r).cut(e):t)}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,o=0;o=e)return t;return 0}},{key:"blockRange",value:function(){var e=0this.pos?e:this}},{key:"min",value:function(e){return e.pos=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var o=[];return function e(t){o.push(t);for(var n=0;n"+o.indexOf(e.next[r].next);return n}).join("\n")}}],[{key:"parse",value:function(e,t){e=new le(e,t);if(null==e.next)return N.empty;var s,a,r,t=ue(e),t=(e.next&&e.err("Unexpected trailing text"),r=[[]],h(function n(e,r){{if("choice"==e.type)return e.exprs.reduce(function(e,t){return e.concat(n(t,r))},[]);if("seq"!=e.type){var t;if("star"==e.type)return t=d(),p(r,t),h(n(e.expr,t),t),[p(t)];if("plus"==e.type)return t=d(),h(n(e.expr,r),t),h(n(e.expr,t),t),[p(t)];if("opt"==e.type)return[p(r)].concat(n(e.expr,r));if("range"==e.type){for(var o=r,i=0;ie.length&&(61!=s.charCodeAt(e.length)||s.slice(e.length+1)!=t))){if(i.getAttrs){s=i.getAttrs(t);if(!1===s)continue;i.attrs=s||void 0}return i}}}}],[{key:"schemaRules",value:function(n){var o=[];function r(e){for(var t=null==e.priority?50:e.priority,n=0;ni.length)&&(n=o,!(t=i).length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(var s=0;sthis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}},{key:"sync",value:function(e){for(var t=this.open;0<=t;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;0<=t;t--){for(var n=this.nodes[t].content,r=n.length-1;0<=r;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n=r.depth-3;a--)i=v.Fragment.from(r.node(a).copy(i));var l=r.indexAfter(-1)=e.pos?null:new k(t.pos,e.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof k&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new k(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new k(t.from,t.to,e.markFromJSON(t.mark))}}]);var q,y=k;function k(e,t,n){var r;return l(this,k),(r=q.call(this)).from=e,r.to=t,r.mark=n,r}e.jsonID("addMark",y);n(w,e),K=r(w),s(w,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),n=new D.Slice(g(n.content,function(e){return e.mark(t.mark.removeFromSet(e.marks))},e),n.openStart,n.openEnd);return m.fromReplace(e,this.from,this.to,n)}},{key:"invert",value:function(){return new y(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),e=e.mapResult(this.to,-1);return t.deleted&&e.deleted||t.pos>=e.pos?null:new w(t.pos,e.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof w&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new w(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new w(t.from,t.to,e.markFromJSON(t.mark))}}]);var K,b=w;function w(e,t,n){var r;return l(this,w),(r=K.call(this)).from=e,r.to=t,r.mark=n,r}e.jsonID("removeMark",b);n(x,e),W=r(x),s(x,[{key:"apply",value:function(e){var t,n=e.nodeAt(this.pos);return n?(t=n.type.create(n.attrs,null,this.mark.addToSet(n.marks)),m.fromReplace(e,this.pos,this.pos+1,new D.Slice(D.Fragment.from(t),0,n.isLeaf?0:1))):m.fail("No node at mark step's position")}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);if(t){var n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(var r=0;rn.pos?null:new N(t.pos,n.pos,r,e,this.slice,this.insert,this.structure)}},{key:"toJSON",value: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}}],[{key:"fromJSON",value:function(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 N(t.from,t.to,t.gapFrom,t.gapTo,D.Slice.fromJSON(e,t.slice),t.insert,!!t.structure)}}]);var X,C=N;function N(e,t,n,r,o,i){var s,a=6=t.size-e?n+1:0)),0))}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,e=e.openEnd,r=se(t,n);r.childCount<=1&&0n;)this.closeFrontierNode();if(i)for(var s=0;st.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=E(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,o)}return e}},{key:"openFrontierNode",value:function(e){var t=1N));A--){var E=s[A];E<0||(t=o.before(E),n=i.after(E))}}function ce(e,t){for(var n=[],r=Math.min(e.depth,t.depth);0<=r;r--){var o=e.start(r);if(ot.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}n(R,e),ue=r(R),s(R,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return m.fail("No node at attribute step's position");var n,r=Object.create(null);for(n in t.attrs)r[n]=t.attrs[n];r[this.attr]=this.value;var o=t.type.create(r,null,t.marks);return m.fromReplace(e,this.pos,this.pos+1,new D.Slice(D.Fragment.from(o),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return c.empty}},{key:"invert",value:function(e){return new R(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){e=e.mapResult(this.pos,1);return e.deletedAfter?null:new R(e.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new R(t.pos,t.attr,t.value)}}]);var ue,de=R;function R(e,t,n){var r;return l(this,R),(r=ue.call(this)).pos=e,r.attr=t,r.value=n,r}e.jsonID("attr",de);n(I,e),pe=r(I),s(I,[{key:"apply",value:function(e){var t,n=Object.create(null);for(t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;var r=e.type.create(n,e.content,e.marks);return m.ok(r)}},{key:"getMap",value:function(){return c.empty}},{key:"invert",value:function(e){return new I(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new I(t.attr,t.value)}}]);var pe,he,fe=I;function I(e,t){var n;return l(this,I),(n=pe.call(this)).attr=e,n.value=t,n}function B(){return l(this,B),he.apply(this,arguments)}e.jsonID("docAttr",fe),t.TransformError=(n(B,F(Error)),he=r(B),s(B)),t.TransformError=function e(t){t=Error.call(this,t);return t.__proto__=e.prototype,t},t.TransformError.prototype=Object.create(Error.prototype),t.TransformError.prototype.constructor=t.TransformError,t.TransformError.prototype.name="TransformError";s(ve,[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){e=this.maybeStep(e);if(e.failed)throw new t.TransformError(e.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return 0r.end(c)&&o.end(c)-n!=o.depth-c)return e.delete(r.before(c),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){for(var n=this,r=t,o=(t=e).$from,i=t.$to,t=t.depth,e=o.before(t+1),s=i.after(t+1),a=e,l=s,c=D.Fragment.empty,u=0,d=t,p=!1;r=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);np.bottom-m(r,"bottom")&&(f=t.bottom-t.top>p.bottom-p.top?t.top+m(o,"top")-p.top:t.bottom-p.bottom+m(o,"bottom")),t.leftp.right-m(r,"right")&&(h=t.right-p.right+m(o,"right")),(h||f)&&(d?i.defaultView.scrollBy(h,f):(a=u.scrollLeft,l=u.scrollTop,f&&(u.scrollTop+=f),h&&(u.scrollLeft+=h),c=u.scrollLeft-a,u=u.scrollTop-l,t={left:t.left-c,top:t.top-u,right:t.right-c,bottom:t.bottom-u})),d||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function ie(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=q(r));return t}function se(e,t){for(var n=0;n=c){var l=Math.max(f.bottom,l),c=Math.min(f.top,c),m=f.left>t.left?f.left-t.left:f.right=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!o&&f.left<=t.left&&f.right>=t.left&&(o=u,i={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!n&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.bottom)&&(a=d+1)}}if(!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType){for(var v=n,g=r,y=v.nodeValue.length,k=document.createRange(),b=0;b=(w.left+w.right)/2?1:0)}}return{node:v,offset:0}}return!n||s&&1==n.nodeType?{node:e,offset:a}:le(n,r)}function ce(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ue(e,t){var n,r,o,i,s=e.dom.ownerDocument,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(s,t.left,t.top),l=(l&&(n=l.node,a=l.offset),(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top));if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){var s=e.dom.getBoundingClientRect();if(!ce(t,s))return null;if(!(l=function e(t,n,r){var o=t.childNodes.length;if(o&&r.topt.top&&a++,re&&a&&1==n.nodeType&&1==(u=n.childNodes[a-1]).nodeType&&"false"==u.contentEditable&&u.getBoundingClientRect().top>=t.top&&a--,n==e.dom&&a==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?r=e.state.doc.content.size:0!=a&&1==n.nodeType&&"BR"==n.childNodes[a-1].nodeName||(r=function(e,t,n,r){for(var o=-1,i=t,s=!1;i!=e.dom;){var a=e.docView.nearestDesc(i,!0);if(!a)return null;if(1==a.dom.nodeType&&(a.node.isBlock&&a.parent&&!s||!a.contentDOM)){var l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!s&&(s=!0,l.left>r.left||l.top>r.top?o=a.posBefore:(l.right(i.left+i.right)/2?1:-1),r=s.docView.posFromDOM(a,o,t));var u=e.docView.nearestDesc(l,!0);return{pos:r,inside:u?u.posAtStart-u.border:-1}}function de(e){return e.tops.top+1&&("up"==p?n.top-s.top>2*(s.bottom-n.top):s.bottom-n.bottom>2*(n.bottom-s.top)))return!1}}return!0})):(l=e,c=n,!!(d=(r=t).selection.$head).parent.isTextblock&&(n=!(e=d.parentOffset),e=e==d.parent.content.size,u=l.domSelection(),ge.test(d.parent.textContent)&&u.modify?ve(l,r,function(){var e=l.domSelectionRange(),t=e.focusNode,n=e.focusOffset,r=e.anchorNode,e=e.anchorOffset,o=u.caretBidiLevel,i=(u.modify("move",c,"character"),d.depth?l.docView.domAfterPos(d.before()):l.dom),s=l.domSelectionRange(),a=s.focusNode,s=s.focusOffset,i=a&&!i.contains(1==a.nodeType?a:a.parentNode)||t==a&&n==s;try{u.collapse(r,e),t&&(t!=r||n!=e)&&u.extend&&u.extend(t,n)}catch(e){}return null!=o&&(u.caretBidiLevel=o),i}):"left"==c||"backward"==c?n:e)));var l,c,u,d,a,p,r,h}r(Se,[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;tk(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){a=!1;break}if(l.previousSibling)break}if(null==a&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){a=!0;break}if(c.nextSibling)break}}return(null==a?0a&&i.state.selection.tof;)y.push(h[g++]);var N=f+O.nodeSize;if(O.isText){var A=N;gt+this.node.content.size)&&(e=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&0t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=d(e)}else{if(!(1==e.nodeType&&t=n)return a+s;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}}return-1}(this.node.content,n,o-t,r-t))<0?null:{node:e,pos:o,text:n}):{node:e,pos:-1,text:""}:null}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,t=t.text;if(!this.getDesc(n)){for(var o=n;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)}n=new Ce(this,o,n,t);e.input.compositionNodes.push(n),this.children=Qe(this.children,r,r+t.length,e,n)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){var t,n;We(e,this.outerDeco)||(t=1!=this.nodeDOM.nodeType,n=this.dom,this.dom=qe(this.dom,this.nodeDOM,Je(this.outerDeco,this.node,t),Je(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e)}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,t,n,r,o,i){var s,a=o.nodeViews[t.type.name],a=a&&a(t,o,function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:i},n,r),l=a&&a.dom,c=a&&a.contentDOM;if(t.isText)if(l){if(3!=l.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else l=document.createTextNode(t.text);else l||(l=(u=P.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t))).dom,c=u.contentDOM);c||t.isText||"BR"==l.nodeName||(l.hasAttribute("contenteditable")||(l.contentEditable="false"),t.type.spec.draggable&&(l.draggable=!0));var u=l;return l=Ke(l,n,t),a?s=new _e(e,t,n,r,l,c||null,u,a,o,i+1):t.isText?new je(e,t,n,r,l,u,o):new Re(e,t,n,r,l,c||null,u)}}]);var De,Pe=Re;function Re(e,t,n,r,o,i,s,a,l){return u(this,Re),(e=De.call(this,e,[],o,i)).node=t,e.outerDeco=n,e.innerDeco=r,e.nodeDOM=s,e}function Ie(e,t,n,r,o){Ke(r,t,e);e=new Pe(void 0,e,t,n,r,r,r,o,0);return e.contentDOM&&e.updateChildren(o,0),e}t(p,Pe),Be=n(p),r(p,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,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))}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):i(s(p.prototype),"localPosFromDOM",this).call(this,e,t,n)}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,n){e=this.node.cut(e,t),t=document.createTextNode(e.text);return new p(this.parent,e,this.outerDeco,this.innerDeco,t,t,n)}},{key:"markDirty",value:function(e,t){i(s(p.prototype),"markDirty",this).call(this,e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}}]);var Be,je=p;function p(e,t,n,r,o,i,s){return u(this,p),Be.call(this,e,t,n,r,o,null,i,s,0)}t(ze,a),Le=n(ze),r(ze,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}]);var Le,Fe=ze;function ze(){return u(this,ze),Le.apply(this,arguments)}t(h,Pe),$e=n(h),r(h,[{key:"update",value:function(e,t,n,r){var o;return 3!=this.dirty&&(this.spec.update?((o=this.spec.update(e,t,n))&&this.updateInner(e,t,n,r),o):!(!this.contentDOM&&!e.isLeaf)&&i(s(h.prototype),"update",this).call(this,e,t,n,r))}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():i(s(h.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():i(s(h.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):i(s(h.prototype),"setSelection",this).call(this,e,t,n,r)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),i(s(h.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):i(s(h.prototype),"ignoreMutation",this).call(this,e)}}]);var $e,_e=h;function h(e,t,n,r,o,i,s,a,l,c){return u(this,h),(e=$e.call(this,e,t,n,r,o,i,s,l,c)).spec=a,e}var Ve=function(e){e&&(this.nodeName=e)},He=(Ve.prototype=Object.create(null),[new Ve]);function Je(e,t,n){if(0==e.length)return He;for(var r=n?He[0]:new Ve,o=[r],i=0;i>1,i=Math.min(o,e.length);rthis.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index]):(s=Ee.create(this.top,e[o],t,n),this.top.children.splice(this.index,0,s),this.top=s,this.changed=!0),this.index=0,o++}}},{key:"findNodeMatch",value:function(e,t,n,r){var o=-1;if(r>=this.preMatch.index&&(r=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,n))o=this.top.children.indexOf(r,this.index);else for(var i=this.index,s=Math.min(this.top.children.length,i+5);in.start()){var o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>r.top&&ir.top&&or.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function yt(e,t,n){var r=e.state.selection;if(r instanceof b.TextSelection&&!r.empty||-1]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=Et().createElement("div"),t=/<([a-z][^>\s]+)/i.exec(e);(n=t&&Nt[t[1].toLowerCase()])&&(e=n.map(function(e){return"<"+e+">"}).join("")+e+n.map(function(e){return""}).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;os.depth?e(n,r,s.nodeAfter,s.before(t),o,!0):e(n,r,s.node(t),s.before(t),o,!1)}))return{v:!0}}(a))return i.v;return!1}function Ft(e,t,n){e.focused||e.focus();t=e.state.tr.setSelection(t);"pointer"==n&&t.setMeta("pointer",!0),e.dispatch(t)}function zt(t,n,e,r,o){return Lt(t,"handleClickOn",n,e,r)||t.someProp("handleClick",function(e){return e(t,n,r)})||(o?function(e,t){if(-1==t)return;for(var n,r,o=e.state.selection,i=(o instanceof b.NodeSelection&&(n=o.node),e.state.doc.resolve(t)),s=i.depth+1;0i.depth?i.nodeAfter:i.node(s);if(b.NodeSelection.isSelectable(a)){r=n&&0=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Ft(e,b.NodeSelection.create(e.state.doc,r),"pointer"),!0)}(t,e):(o=t,-1!=(e=e)&&!!((i=(e=o.state.doc.resolve(e)).nodeAfter)&&i.isAtom&&b.NodeSelection.isSelectable(i))&&(Ft(o,new b.NodeSelection(e),"pointer"),!0)));var i}function $t(t,n,e,r){return Lt(t,"handleTripleClickOn",n,e,r)||t.someProp("handleTripleClick",function(e){return e(t,n,r)})||function(e,t,n){if(0!=n.button)return;var r=e.state.doc;if(-1==t)return r.inlineContent&&(Ft(e,b.TextSelection.create(r,0,r.content.size),"pointer"),1);for(var o=r.resolve(t),i=o.depth+1;0o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Ft(e,b.TextSelection.create(r,a+1,a+1+s.content.size),"pointer");else{if(!b.NodeSelection.isSelectable(s))continue;Ft(e,b.NodeSelection.create(r,a),"pointer")}return 1}}(t,e,r)}function _t(e){return Gt(e)}g.keydown=function(t,e){var n,r=e;t.input.shiftKey=16==r.keyCode||r.shiftKey,qt(t,r)||(t.input.lastKeyCode=r.keyCode,t.input.lastKeyCodeTime=Date.now(),C&&O&&13==r.keyCode)||(229!=r.keyCode&&t.domObserver.forceFlush(),!te||13!=r.keyCode||r.ctrlKey||r.altKey||r.metaKey?t.someProp("handleKeyDown",function(e){return e(t,r)})||wt(t,r)?r.preventDefault():E(t,"key"):(n=Date.now(),t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(function(){t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",function(e){return e(t,Y(13,"Enter"))}),t.input.lastIOSEnter=0)},200)))},g.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},g.keypress=function(t,e){var n,r,o=e;qt(t,o)||!o.charCode||o.ctrlKey&&!o.altKey||l&&o.metaKey||(t.someProp("handleKeyPress",function(e){return e(t,o)})?o.preventDefault():(n=t.state.selection)instanceof b.TextSelection&&n.$from.sameParent(n.$to)||(r=String.fromCharCode(o.charCode),/[\r\n]/.test(r)||t.someProp("handleTextInput",function(e){return e(t,n.$from.pos,n.$to.pos,r)})||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),o.preventDefault()))};var Vt=l?"metaKey":"ctrlKey",Ht=(v.mousedown=function(e,t){e.input.shiftKey=t.shiftKey;var n,r=_t(e),o=Date.now(),i="singleClick",s=(o-e.input.lastClick.time<500&&(n=e.input.lastClick,s=n.x-t.clientX,n=n.y-t.clientY,s*s+n*n<100)&&!t[Vt]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i},e.posAtCoords(jt(t)));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Ht(e,s,t,!!r)):("doubleClick"==i?function(t,n,e,r){return Lt(t,"handleDoubleClickOn",n,e,r)||t.someProp("handleDoubleClick",function(e){return e(t,n,r)})}:$t)(e,s.pos,s.inside,t)?t.preventDefault():E(e,"pointer"))},r(Jt,[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(function(){return A(e.view)}),this.view.input.mouseDown=null}},{key:"up",value:function(e){var t;this.done(),this.view.dom.contains(e.target)&&(t=this.pos,this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(jt(e))),this.updateAllowDefault(e),this.allowDefault||!t?E(this.view,"pointer"):zt(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||T&&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)?(Ft(this.view,b.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):E(this.view,"pointer"))}},{key:"move",value:function(e){this.updateAllowDefault(e),E(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(4t)&&(this.mightDrag={node:o,pos:t,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(function(){i.view.input.mouseDown==i&&i.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)),E(e,"pointer")}function qt(e,t){return e.composing||T&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500&&(e.input.compositionEndedAt=-2e8)}v.touchstart=function(e){e.input.lastTouch=Date.now(),_t(e),E(e,"pointer")},v.touchmove=function(e){e.input.lastTouch=Date.now(),E(e,"pointer")},v.contextmenu=_t;var Kt=C?5e3:-1;function Wt(e,t){clearTimeout(e.input.composingTimeout),-1=r.from&&o.pos<=(r instanceof b.NodeSelection?r.to-1:r.to)||(i&&i.mightDrag?n=b.NodeSelection.create(e.state.doc,i.mightDrag.pos):t.target&&1==t.target.nodeType&&(o=e.docView.nearestDesc(t.target,!0))&&o.node.type.spec.draggable&&o!=e.docView&&(n=b.NodeSelection.create(e.state.doc,o.posBefore))),r=(n||e.state.selection).content(),o=(i=St(e,r)).dom,i=i.text,t.dataTransfer.clearData(),t.dataTransfer.setData(Xt?"Text":"text/html",o.innerHTML),t.dataTransfer.effectAllowed="copyMove",Xt||t.dataTransfer.setData("text/plain",i),e.dragging=new en(r,!t[tn],n))},v.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)},g.dragover=g.dragenter=function(e,t){return t.preventDefault()},g.drop=function(t,e){var n,r,o,i,s,a,l,c=e,e=t.dragging;t.dragging=null,c.dataTransfer&&(i=t.posAtCoords(jt(c)))&&(i=t.state.doc.resolve(i.pos),(n=e&&e.slice)?t.someProp("transformPasted",function(e){n=e(n,t)}):n=xt(t,Qt(c.dataTransfer),Xt?null:c.dataTransfer.getData("text/html"),!1,i),r=!(!e||c[tn]),t.someProp("handleDrop",function(e){return e(t,c,n||P.Slice.empty,r)})?c.preventDefault():n&&(c.preventDefault(),null==(o=n?J.dropPoint(t.state.doc,i.pos,n):i.pos)&&(o=i.pos),i=t.state.tr,r&&((e=e.node)?e.replace(i):i.deleteSelection()),e=i.mapping.map(o),s=0==n.openStart&&0==n.openEnd&&1==n.content.childCount,a=i.doc,s?i.replaceRangeWith(e,e,n.content.firstChild):i.replaceRange(e,e,n),i.doc.eq(a)||(a=i.doc.resolve(e),s&&b.NodeSelection.isSelectable(n.content.firstChild)&&a.nodeAfter&&a.nodeAfter.sameMarkup(n.content.firstChild)?i.setSelection(new b.NodeSelection(a)):(l=i.mapping.map(o),i.mapping.maps[i.mapping.maps.length-1].forEach(function(e,t,n,r){return l=r}),i.setSelection(at(t,a,i.doc.resolve(l)))),t.focus(),t.dispatch(i.setMeta("uiEvent","drop")))))},v.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&A(e)},20))},v.blur=function(e,t){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},v.beforeinput=function(t,e){var n;O&&C&&"deleteContentBackward"==e.inputType&&(t.domObserver.flushSoon(),n=t.input.domChangeCount,setTimeout(function(){var e;t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",function(e){return e(t,Y(8,"Backspace"))}))||(e=t.state.selection.$cursor)&&0=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a,l=0;le&&(a=this.children[l]+1,this.children[l+2].findInner(e-a,t-a,n,r+a,o))}},{key:"map",value:function(e,t,n){return this==I||0==e.maps.length?this:this.mapInner(e,t,0,0,n||hn)}},{key:"mapInner",value:function(e,t,n,r,o){for(var i,s=0;s=d.content.size){y=!0;continue}var S=u.map(l[k+1]+h,-1)-p,x=d.content.findIndex(w),M=x.index,x=x.offset,M=d.maybeChild(M);M&&x==w&&x+M.nodeSize==S?(x=m[k+2].mapInner(u,M,b+1,l[k]+h+1,f))!=I?(m[k]=w,m[k+1]=S,m[k+2]=x):(m[k+1]=-2,y=!0):y=!0}if(y){var O=yn(function(e,t,s,a,l,n,c){for(var r=0;rl&&i.to=e){this.children[o]==e&&(n=this.children[o+2]);break}for(var i=e+1,s=i+t.content.size,a=0;ai&&u.type instanceof sn&&(l=Math.max(i,u.from)-i)<(c=Math.min(s,u.to)-i)&&(r=r||[]).push(u.copy(l,c))}return r?(t=new R(r.sort(kn),pn),n?new fn([t,n]):t):n||I}},{key:"eq",value:function(e){if(this!=e){if(!(e instanceof R)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;tn&&r.toDate.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)e.target.nodeValue.length})?n.flushSoon():n.flush()}),Mn&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}var An=new WeakMap,En=!1;function Dn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(T&&/^(ul|ol)$/i.test(e.parentNode.nodeName))return(t=document.createElement("div")).appendChild(document.createElement("li")),{skip:t};if(e.parentNode.lastChild==e||T&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var Pn=/^(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 Rn(t,e,n,r,o){var i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(e<(t.input.compositionPendingChanges=0)){var s=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,a=Ze(t,s);if(a&&!t.state.selection.eq(a)){if(O&&C&&13===t.input.lastKeyCode&&Date.now()-100Date.now()-225||C)&&o.some(function(e){return 1==e.nodeType&&!Pn.test(e.nodeName)})&&(!n||n.endA>=n.endB)&&t.someProp("handleKeyDown",function(e){return e(t,Y(13,"Enter"))}))t.input.lastIOSEnter=0;else{if(!n){if(!(r&&s instanceof b.TextSelection&&!s.empty&&s.$head.sameParent(s.$anchor))||t.composing||a.sel&&a.sel.anchor!=a.sel.head)return void(a.sel&&(c=In(t,t.state.doc,a.sel))&&!c.eq(t.state.selection)&&(l=t.state.tr.setSelection(c),i&&l.setMeta("composition",i),t.dispatch(l)));n={start:s.from,endA:s.to,endB:s.to}}O&&t.cursorWrapper&&a.sel&&a.sel.anchor==t.cursorWrapper.deco.from&&a.sel.head==a.sel.anchor&&(r=n.endB-n.start,a.sel={anchor:a.sel.anchor+r,head:a.sel.anchor+r}),t.input.domChangeCount++,t.state.selection.fromt.state.selection.from&&n.start<=t.state.selection.from+2&&t.state.selection.from>=a.from?n.start=t.state.selection.from:n.endA=t.state.selection.to-2&&t.state.selection.to<=a.to&&(n.endB+=t.state.selection.to-n.endA,n.endA=t.state.selection.to)),w&&x<=11&&n.endB==n.start+1&&n.endA==n.start&&n.start>a.from&&"  "==a.doc.textBetween(n.start-a.from-1,n.start-a.from+1)&&(n.start--,n.endA--,n.endB--);var c=a.doc.resolveNoCache(n.start-a.from),l=a.doc.resolveNoCache(n.endB-a.from),s=e.resolve(n.start),r=c.sameParent(l)&&c.parent.inlineContent&&s.end()>=n.endA;if((te&&t.input.lastIOSEnter>Date.now()-225&&(!r||o.some(function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))||!r&&c.posn.start&&(o=e,v=n.start,u=n.endA,p=l,!(!(d=c).parent.isTextblock||u-v<=p.pos-d.pos||Bn(d,!0,!1)u||Bn(h,!0,!1)t.content.size?null:at(e,t.resolve(n.anchor),t.resolve(n.head))}function Bn(e,t,n){for(var r=e.depth,o=t?e.end():e.pos;0o.scrollToSelection?"to selection":"preserve":"reset",c=i||!this.docView.matchesNode(e.doc,a,l),u=(!c&&e.selection.eq(o.selection)||(s=!0),"preserve"==t&&s&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s=o-20){t=a,n=l.top;break}}}return{refDOM:t,refTop:n,stack:ie(e.dom)}}(this));s&&(this.domObserver.stop(),s=c&&(w||O)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(s=o.selection,n=e.selection,r=Math.min(s.$anchor.sharedDepth(s.head),n.$anchor.sharedDepth(n.head)),s.$anchor.start(r)!=n.$anchor.start(r)),(s=c&&(n=O?this.trackWrites=this.domSelectionRange().focusNode:null,!i&&this.docView.update(e.doc,a,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Ie(e.doc,a,l,this.dom,this)),n)&&!this.trackWrites?!0:s)||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(c=(r=this).docView.domFromPos(r.state.selection.anchor,0),r=r.domSelectionRange(),y(c.node,c.offset,r.anchorNode,r.anchorOffset)))?A(this,s):(it(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()),this.updatePluginViews(o),null!=(i=this.dragging)&&i.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==t?this.dom.scrollTop=0:"to selection"==t?this.scrollToSelection():u&&(l=(a=u).refDOM,c=u.refTop,a=u.stack,l=l?l.getBoundingClientRect().top:0,se(a,0==l?0:l-c))}},{key:"scrollToSelection",value:function(){var e,t=this,n=this.domSelectionRange().focusNode;this.someProp("handleScrollToSelection",function(e){return e(t)})||(this.state.selection instanceof b.NodeSelection?1==(e=this.docView.domAfterPos(this.state.selection.from)).nodeType&&oe(this,e.getBoundingClientRect(),n):oe(this,this.coordsAtPos(this.state.selection.head,1),n))}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t=this.length))return this.getInner(e)},r.prototype.forEach=function(e,t,n){(t=void 0===t?0:t)<=(n=void 0===n?this.length:n)?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},r.prototype.map=function(n,e,t){void 0===t&&(t=this.length);var r=[];return this.forEach(function(e,t){return r.push(n(e,t))},e=void 0===e?0:e,t),r},r.from=function(e){return e instanceof r?e:e&&e.length?new o(e):r.empty};var o=function(t){function n(e){t.call(this),this.values=e}t&&(n.__proto__=t);var e={length:{configurable:!0},depth:{configurable:!0}};return((n.prototype=Object.create(t&&t.prototype)).constructor=n).prototype.flatten=function(){return this.values},n.prototype.sliceInner=function(e,t){return 0==e&&t==this.length?this:new n(this.values.slice(e,t))},n.prototype.getInner=function(e){return this.values[e]},n.prototype.forEachInner=function(e,t,n,r){for(var o=t;o=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(r));t.exports=r},{}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});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&&/Mac/.test(navigator.platform),s="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)r[48+a]=r[96+a]=String(a);for(a=1;a<=24;a++)r[a+111]="F"+a;for(var l,a=65;a<=90;a++)r[a]=String.fromCharCode(a+32),o[a]=String.fromCharCode(a);for(l in r)o.hasOwnProperty(l)||(o[l]=r[l]);n.base=r,n.keyName=function(e){return e="Down"==(e="Right"==(e="Up"==(e="Left"==(e="Del"==(e="Esc"==(e=!(i&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||s&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified")?"Escape":e)?"Delete":e)?"ArrowLeft":e)?"ArrowUp":e)?"ArrowRight":e)?"ArrowDown":e},n.shift=o},{}]},{},[1]);