diff --git a/django_prose_editor/static/django_prose_editor/editor.js b/django_prose_editor/static/django_prose_editor/editor.js index b07aea1..bf940d1 100644 --- a/django_prose_editor/static/django_prose_editor/editor.js +++ b/django_prose_editor/static/django_prose_editor/editor.js @@ -89,16 +89,16 @@ img.ProseMirror-separator { }`;function ud(n,e,t){let r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}var Dn=class extends Zi{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>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.on("contentError",this.options.onContentError),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),this.on("drop",({event:t,slice:r,moved:o})=>this.options.onDrop(t,r,o)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},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=ud(Ym,this.options.injectNonce))}setOptions(e={}){this.options=b(b({},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){let r=as(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(i=>{let s=typeof i=="string"?`${i}$`:i.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;let o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;let o=[...this.options.enableCoreExtensions?[sd,Gc.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),od,ld,ad,dd,id,cd].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Rr(o,this)}createCommandManager(){this.commandManager=new Et({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Dr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=Dr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=fs(t,this.options.autofocus);this.view=new wr(this.options.element,N(b({},this.options.editorProps),{attributes:b({role:"textbox"},(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:ur.create({doc:t,selection:r||void 0})}));let o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||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;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}let t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return $r(this.state,e)}isActive(e,t){let r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return rd(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ln(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` `,textSerializers:r={}}=e||{};return ys(this.state.doc,{blockSeparator:t,textSerializers:b(b({},Br(this.schema)),r)})}get isEmpty(){return Vr(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(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new Pr(t,this)}get $doc(){return this.$pos(0)}};function Ue(n){return new st({find:n.find,handler:({state:e,range:t,match:r})=>{let o=v(n.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=t.from+l.indexOf(s),d=c+s.length;if($n(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;dt.from&&i.delete(t.from+a,c);let f=t.from+a+s.length;i.addMark(t.from+a,f,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function xs(n){return new st({find:n.find,handler:({state:e,range:t,match:r})=>{let o=v(n.getAttributes,void 0,r)||{},{tr:i}=e,s=t.from,l=t.to,a=n.type.create(o);if(r[1]){let c=r[0].lastIndexOf(r[1]),d=s+c;d>l?d=l:l=d+r[1].length;let u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(d,l,a)}else if(r[0]){let c=n.type.isInline?s:s-1;i.insert(c,n.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function Ss(n){return new st({find:n.find,handler:({state:e,range:t,match:r})=>{let o=e.doc.resolve(t.from),i=v(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)}})}function Qm(n){return new st({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}function Ge(n){return new st({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{let i=v(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&Bt(a,n.type,i);if(!c)return null;if(s.wrap(a,c),n.keepMarks&&n.editor){let{selection:u,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||u.$to.parentOffset&&u.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){let u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}let d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Te(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&s.join(t.from-1)}})}var F=class n{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=b(b({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=v(C(this,"addOptions",{name:this.name}))),this.storage=v(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(N(b({},this.config),{addOptions:()=>Bn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=v(C(t,"addOptions",{name:t.name})),t.storage=v(C(t,"addStorage",{name:t.name,options:t.options})),t}};function Xm(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}var is=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options=b({stopEvent:null,ignoreMutation:null},r),this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,o,i,s,l,a;let{view:c}=this.editor,d=e.target,u=d.nodeType===3?(t=d.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(d)||!u)return;let f=0,h=0;if(this.dom!==u){let y=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),E=(o=e.offsetX)!==null&&o!==void 0?o:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,P=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=w.x-y.x+E,h=w.y-y.y+P}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);let p=this.getPos();if(typeof p!="number")return;let m=M.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;let i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!i)return!0;let{isEditable:a}=this.editor,{isDragging:c}=this,d=!!this.node.type.spec.draggable,u=M.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!d&&u&&i&&e.preventDefault(),d&&i&&!c)return e.preventDefault(),!1;if(d&&a&&!c&&m){let g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(c||s||f||h||p||m&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(zn()||Xm())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,b(b({},this.node.attrs),e)),!0)})}deleteNode(){let e=this.getPos();if(typeof e!="number")return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Oe(n){return new Ut({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{let i=v(n.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let d=a.search(/\S/),u=t.from+a.indexOf(l),f=u+l.length;if($n(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;ft.from&&s.delete(t.from+d,u),c=t.from+d+l.length,s.addMark(t.from+d,c,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Zm(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function eg(n){return typeof n=="string"}function tg(n){return new Ut({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:o}){let i=v(n.getAttributes,void 0,e,o),s=v(n.getContent,void 0,i);if(i===!1||i===null)return null;let l={type:n.type.name,attrs:i};s&&(l.content=s),e.input&&t().deleteRange(r).insertContentAt(r.from,l)}})}function ng(n){return new Ut({find:n.find,handler:({state:e,range:t,match:r})=>{let o=n.replace,i=t.from,s=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)}})}var ss=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((o,i)=>{let s=i.getMap().mapResult(o);return s.deleted&&(t=!0),s.pos},e),deleted:t}}};var fd=F.create({name:"doc",topNode:!0,content:"block+"});function hd(n={}){return new B({view(e){return new ws(e,n)}})}var ws=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),u=l?d.bottom:d.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:d.left,right:d.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=o.getBoundingClientRect();i=l.left-o.scrollLeft,s=l.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ar(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var pd=H.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[hd(this.options)]}});var le=class n extends A{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):A.near(r)}content(){return x.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new Cs(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!rg(e)||!og(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!M.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};le.prototype.visible=!1;le.findFrom=le.findGapCursorFrom;A.jsonID("gapcursor",le);var Cs=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return le.valid(t)?new le(t):A.near(t)}};function rg(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function og(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function md(){return new B({props:{decorations:ag,createSelectionBetween(n,e,t){return e.pos==t.pos&&le.valid(t)?new le(t):null},handleClick:sg,handleKeyDown:ig,handleDOMEvents:{beforeinput:lg}}})}var ig=En({ArrowLeft:jr("horiz",-1),ArrowRight:jr("horiz",1),ArrowUp:jr("vert",-1),ArrowDown:jr("vert",1)});function jr(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof T){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=le.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new le(c))),!0):!1}}function sg(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!le.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&M.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new le(r))),!0)}function lg(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof le))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=k.empty;for(let s=r.length-1;s>=0;s--)o=k.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new x(o,0,0));return i.setSelection(T.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ag(n){if(!(n.selection instanceof le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",J.create(n.doc,[te.widget(n.selection.head,e,{key:"gapcursor"})])}var gd=H.create({name:"gapCursor",addProseMirrorPlugins(){return[md()]},extendNodeSchema(n){var e;let t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=v(C(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}});var _r=200,ne=function(){};ne.prototype.append=function(e){return e.length?(e=ne.from(e),!this.length&&e||e.length<_r&&this.leafAppend(e)||this.length<_r&&e.leafPrepend(this)||this.appendInner(e)):this};ne.prototype.prepend=function(e){return e.length?ne.from(e).append(this):this};ne.prototype.appendInner=function(e){return new cg(this,e)};ne.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ne.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ne.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ne.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ne.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};ne.from=function(e){return e instanceof ne?e:e&&e.length?new yd(e):ne.empty};var yd=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=_r)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=_r)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ne);ne.empty=new yd([]);var cg=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ne),Ms=ne;var dg=500,Nt=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Pe(u.map));let h=u.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Pe(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new n(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;dfg&&(l=ug(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new fn;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new Pe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(a+1,h));g&&l++,r.push(new Pe(p,m,g))}else r.push(new Pe(p))},o);let c=[];for(let f=t;fdg&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=s.selection&&s.selection.map(t.slice(r));d&&i++;let u=new Pe(c.invert(),a,d),f,h=o.length-1;(f=o.length&&o[h].merge(u))?o[h]=f:o.push(u)}}else s.map&&r--},this.items.length,0),new n(Ms.from(o.reverse()),i)}};Nt.empty=new Nt(Ms.empty,0);function ug(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}var Pe=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},Le=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},fg=20;function hg(n,e,t,r){let o=t.getMeta(Ot),i;if(o)return o.historyState;t.getMeta(gg)&&(n=new Le(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Ot))return s.getMeta(Ot).redo?new Le(n.done.addTransform(t,void 0,r,Wr(e)),n.undone,bd(t.mapping.maps),n.prevTime,n.prevComposition):new Le(n.done,n.undone.addTransform(t,void 0,r,Wr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!pg(t,n.prevRanges)),c=s?Ts(n.prevRanges,t.mapping):bd(t.mapping.maps);return new Le(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Wr(e)),Nt.empty,c,t.time,l==null?n.prevComposition:l)}else return(i=t.getMeta("rebased"))?new Le(n.done.rebased(t,i),n.undone.rebased(t,i),Ts(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Le(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ts(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function pg(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i=e[i]&&(t=!0)}),t}function bd(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function Ts(n,e){if(!n)return null;let t=[];for(let r=0;r{let o=Ot.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=mg(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Es=Kr(!1,!0),Os=Kr(!0,!0),Cb=Kr(!1,!1),Mb=Kr(!0,!1);var Sd=H.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Es(n,e),redo:()=>({state:n,dispatch:e})=>Os(n,e)}},addProseMirrorPlugins(){return[xd(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var wd=F.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Cd=F.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",R(this.options.HTMLAttributes,n)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Md=F.create({name:"text",group:"inline"});var yg=/^\s*>\s$/,Td=F.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ge({find:yg,type:this.type})]}});var bg=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,kg=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,xg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Sg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ad=Q.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ue({find:bg,type:this.type}),Ue({find:xg,type:this.type})]},addPasteRules(){return[Oe({find:kg,type:this.type}),Oe({find:Sg,type:this.type})]}});var wg="listItem",Ed="textStyle",Od=/^\s*([-+*])\s$/,Nd=F.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:n}){return["ul",R(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(wg,this.editor.getAttributes(Ed)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ge({find:Od,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Od,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ed),editor:this.editor})),[n]}});var vd=F.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,R(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>N(b({},n),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Ss({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Rd=F.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",R(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{let{selection:t}=e,{$from:r,$to:o}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):ks(t)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var a;if(l){let{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(T.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(M.create(s.doc,c.pos)):s.setSelection(T.create(s.doc,c.pos));else{let u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(s.insert(d,u),s.setSelection(T.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xs({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Cg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Mg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Tg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ag=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dd=Q.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ue({find:Cg,type:this.type}),Ue({find:Tg,type:this.type})]},addPasteRules(){return[Oe({find:Mg,type:this.type}),Oe({find:Ag,type:this.type})]}});var Id=F.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",R(this.options.HTMLAttributes,n),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)}}});var Eg="listItem",Pd="textStyle",Ld=/^(\d+)\.\s$/,Bd=F.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let r=n,{start:e}=r,t=yl(r,["start"]);return e===1?["ol",R(this.options.HTMLAttributes,t),0]:["ol",R(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Eg,this.editor.getAttributes(Pd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ge({find:Ld,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Ld,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>b({start:+e[1]},this.editor.getAttributes(Pd)),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}});var Og=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ng=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zd=Q.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ue({find:Og,type:this.type})]},addPasteRules(){return[Oe({find:Ng,type:this.type})]}});var Fd=Q.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var Hd=Q.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var $d=Q.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var Vd=H.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:n=>{let e=n.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}});var vs,Rs;if(typeof WeakMap!="undefined"){let n=new WeakMap;vs=e=>n.get(e),Rs=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;vs=r=>{for(let o=0;o(t==10&&(t=0),n[t++]=r,n[t++]=o)}var W=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-E});break}let P=o+E*e;for(let O=0;Or&&(i+=c.attrs.colspan)}}for(let s=0;s1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Dg(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Pg(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ne(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Qr(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=Yt(e.$head)||Lg(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Lg(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Ds(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Bg(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Ls(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Qd(n,e,t){let r=n.node(-1),o=W.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function vt(n,e,t=1){let r=N(b({},n),{colspan:n.colspan-t});return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Xd(n,e,t=1){let r=N(b({},n),{colspan:n.colspan+t});if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;od!=t.pos-i);a.unshift(t.pos-i);let c=a.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=i+d+1;return new Ht(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Ds(r)&&Ds(o)&&Ls(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Ye.rowSelection(r,o):i&&this.isColSelection()?Ye.colSelection(r,o):new Ye(r,o)}return T.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=W.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a0||g>0){let y=p.attrs;if(m>0&&(y=vt(y,0,m)),g>0&&(y=vt(y,y.colspan-g,g)),h.lefto.bottom){let y=N(b({},p.attrs),{rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)});h.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=W.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom0&&(t=a.resolve(i+o.map[l.left])),s.bottom0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Ye&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=W.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right{e.push(te.node(r,r+t.nodeSize,{class:"selectedCell"}))}),J.create(n.doc,e)}function $g({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(o+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function Vg({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function jg(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof M&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$.rowSelection(l,l)}else if(!t){let l=W.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$.create(o,a+1,c)}}else r instanceof T&&$g(r)?i=T.create(o,r.from):r instanceof T&&Vg(r)&&(i=T.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var _g=new _("fix-tables");function eu(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{o.type.spec.tableRole=="table"&&(t=Wg(n,o,i,t))};return e?e.doc!=n.doc&&eu(e.doc,n.doc,0,r):n.doc.descendants(r),t}function Wg(n,e,t,r){let o=W.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);let p=[];for(let g=0;g0?-1:0;zg(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s0&&o0&&e.map[l-1]==a||o0?-1:0;Jg(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c0&&o0&&u==e.map[d-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,N(b({},f),{rowspan:f.rowspan-1})),c+=f.colspan-1}else if(o0&&t[i]==t[i-1]||r.right0&&t[o]==t[o-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function Gg(n){return(e,t)=>{var r;let o=e.selection,i,s;if(o instanceof $){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=Pg(o.$from),!i)return!1;s=(r=Yt(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l=N(b({},l),{rowspan:1})),l.colspan>1&&(l=N(b({},l),{colspan:1}));let d=Be(e),u=e.tr;for(let h=0;h{s.attrs[n]!==e&&i.setNodeMarkup(l,null,N(b({},s.attrs),{[n]:e}))}):i.setNodeMarkup(o.pos,null,N(b({},o.nodeAfter.attrs),{[n]:e})),r(i)}return!0}}function Yg(n){return function(e,t){if(!Ne(e))return!1;if(t){let r=ae(e.schema),o=Be(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a{let p=h+i.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}var C1=Qt("row",{useDeprecatedLogic:!0}),M1=Qt("column",{useDeprecatedLogic:!0}),du=Qt("cell",{useDeprecatedLogic:!0});function Qg(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Jr(n,e){let t=n.selection;if(!(t instanceof $))return!1;if(e){let r=n.tr,o=ae(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new x(o,0,0))}),r.docChanged&&e(r)}return!0}function Xg(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c=e.length&&e.push(k.empty),t[o]r&&(f=f.type.createChecked(vt(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let h=1;ho&&(u=u.type.create(N(b({},u.attrs),{rowspan:Math.max(1,o-u.attrs.rowspan)}),u.content)),a.push(u)}i.push(k.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function ty(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=ae(l),c,d;if(o>e.width)for(let u=0,f=0;ue.height){let u=[];for(let p=0,m=(e.height-1)*e.width;p=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,k.from(u)),h=[];for(let p=e.height;p{if(!o)return!1;let i=t.selection;if(i instanceof $)return Gr(t,r,A.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=fu(o,n,e);if(s==null)return!1;if(n=="horiz")return Gr(t,r,A.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=Qd(l,n,e),c;return a?c=A.near(a,1):e<0?c=A.near(t.doc.resolve(l.before(-1)),-1):c=A.near(t.doc.resolve(l.after(-1)),1),Gr(t,r,c)}}}function Ur(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof $)s=i;else{let a=fu(o,n,e);if(a==null)return!1;s=new $(t.doc.resolve(a))}let l=Qd(s.$headCell,n,e);return l?Gr(t,r,new $(s.$anchorCell,l)):!1}}function ry(n,e){let t=n.state.doc,r=Yt(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new $(r))),!0):!1}function oy(n,e,t){if(!Ne(n.state))return!1;let r=Xg(t),o=n.state.selection;if(o instanceof $){r||(r={width:1,height:1,rows:[k.from(Is(ae(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=W.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=ey(r,l.right-l.left,l.bottom-l.top),Jd(n.state,n.dispatch,s,l,r),!0}else if(r){let i=Qr(n.state),s=i.start(-1);return Jd(n.state,n.dispatch,s,W.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function iy(n,e){var t;if(e.ctrlKey||e.metaKey)return;let r=qd(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof $)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Yt(n.state.selection.$anchor))!=null&&((t=Ns(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let d=Ns(n,c),u=lt.getState(n.state)==null;if(!d||!Ls(a,d))if(u)d=a;else return;let f=new $(a,d);if(u||!n.state.selection.eq(f)){let h=n.state.tr.setSelection(f);u&&h.setMeta(lt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),lt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(lt,-1))}function l(a){let c=a,d=lt.getState(n.state),u;if(d!=null)u=n.state.doc.resolve(d);else if(qd(n,c.target)!=r&&(u=Ns(n,e),!u))return s();u&&i(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function fu(n,e,t){if(!(n.state.selection instanceof T))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function qd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ns(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Yt(n.state.doc.resolve(t.pos)):null}var sy=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ps(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ps(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ps(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild,d=n.firstChild;if(d){for(let u=0,f=0;unew r(f,t,h)),new ly(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=ge.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{ay(s,l,n,o)},mouseleave:s=>{cy(s)},mousedown:(s,l)=>{dy(s,l,e,t)}},decorations:s=>{let l=ge.getState(s);if(l&&l.activeHandle>-1)return my(s,l.activeHandle)},nodeViews:{}}});return i}var ly=class Yr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(ge);if(r&&r.setHandle!=null)return new Yr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Yr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Ds(e.doc.resolve(o))||(o=-1),new Yr(o,t.dragging)}return t}};function ay(n,e,t,r){let o=ge.getState(n.state);if(o&&!o.dragging){let i=fy(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Ud(n,e,"left",t):a-e.clientX<=t&&(s=Ud(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=W.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}pu(n,s)}}}function cy(n){let e=ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&pu(n,-1)}function dy(n,e,t,r){var o;let i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=ge.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=uy(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(ge,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);let f=ge.getState(n.state);f!=null&&f.dragging&&(hy(n,f.activeHandle,Gd(f.dragging,u,t)),n.dispatch(n.state.tr.setMeta(ge,{setDragging:null})))}function d(u){if(!u.which)return c(u);let f=ge.getState(n.state);if(f&&f.dragging){let h=Gd(f.dragging,u,t);Yd(n,f.activeHandle,h,r)}}return Yd(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function uy(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c{let r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function by(n,e,t,r,o){let i=yy(n),s=[],l=[];for(let c=0;c{let{selection:e}=n.state;if(!ky(e))return!1;let t=0,r=Fr(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},bu=F.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Vs,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let{colgroup:t,tableWidth:r,tableMinWidth:o}=gy(n,this.options.cellMinWidth);return["table",R(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=by(i.schema,n,e,t);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(T.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>nu(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>ru(n,e),deleteColumn:()=>({state:n,dispatch:e})=>ou(n,e),addRowBefore:()=>({state:n,dispatch:e})=>su(n,e),addRowAfter:()=>({state:n,dispatch:e})=>lu(n,e),deleteRow:()=>({state:n,dispatch:e})=>au(n,e),deleteTable:()=>({state:n,dispatch:e})=>uu(n,e),mergeCells:()=>({state:n,dispatch:e})=>zs(n,e),splitCell:()=>({state:n,dispatch:e})=>Fs(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Qt("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Qt("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>du(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>zs(n,e)?!0:Fs(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>cu(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Hs(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Hs(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Bs(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){let r=$.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Xr,"Mod-Backspace":Xr,Delete:Xr,"Mod-Delete":Xr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[hu({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],mu({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){let e={name:n.name,options:n.options,storage:n.storage};return{tableRole:v(C(n,"tableRole",e))}}});var ku=F.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",R(this.options.HTMLAttributes,n),0]}});var xu=F.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",R(this.options.HTMLAttributes,n),0]}});var Su=F.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",R(this.options.HTMLAttributes,n),0]}});var ye=(n,e=null)=>{let t=document.createElement(n);if(e)for(let[r,o]of Object.entries(e))/^data-|^aria-|^role/.test(r)?t.setAttribute(r,o):t[r]=o;return t},js;function Rt(){return js||(js=JSON.parse(document.querySelector("#django-prose-editor-settings").textContent)),js}var xy=([n,e])=>{let t;return e.format==="textarea"?t=``:e.enum?t=``:t=``,`

${t}

`},Zr=n=>e=>{let{messages:t}=Rt();return new Promise(r=>{let o=document.createElement("div");o.innerHTML=` +`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Md=F.create({name:"text",group:"inline"});var yg=/^\s*>\s$/,Td=F.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ge({find:yg,type:this.type})]}});var bg=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,kg=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,xg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Sg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ad=Q.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ue({find:bg,type:this.type}),Ue({find:xg,type:this.type})]},addPasteRules(){return[Oe({find:kg,type:this.type}),Oe({find:Sg,type:this.type})]}});var wg="listItem",Ed="textStyle",Od=/^\s*([-+*])\s$/,Nd=F.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:n}){return["ul",R(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(wg,this.editor.getAttributes(Ed)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ge({find:Od,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Od,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ed),editor:this.editor})),[n]}});var vd=F.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,R(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>N(b({},n),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Ss({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Rd=F.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",R(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{let{selection:t}=e,{$from:r,$to:o}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):ks(t)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var a;if(l){let{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(T.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(M.create(s.doc,c.pos)):s.setSelection(T.create(s.doc,c.pos));else{let u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(s.insert(d,u),s.setSelection(T.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xs({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Cg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Mg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Tg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ag=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dd=Q.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ue({find:Cg,type:this.type}),Ue({find:Tg,type:this.type})]},addPasteRules(){return[Oe({find:Mg,type:this.type}),Oe({find:Ag,type:this.type})]}});var Id=F.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",R(this.options.HTMLAttributes,n),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)}}});var Eg="listItem",Pd="textStyle",Ld=/^(\d+)\.\s$/,Bd=F.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let r=n,{start:e}=r,t=yl(r,["start"]);return e===1?["ol",R(this.options.HTMLAttributes,t),0]:["ol",R(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Eg,this.editor.getAttributes(Pd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ge({find:Ld,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ge({find:Ld,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>b({start:+e[1]},this.editor.getAttributes(Pd)),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}});var Og=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ng=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zd=Q.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ue({find:Og,type:this.type})]},addPasteRules(){return[Oe({find:Ng,type:this.type})]}});var Fd=Q.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var Hd=Q.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var $d=Q.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",R(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var Vd=H.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:n=>{let e=n.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}});var vs,Rs;if(typeof WeakMap!="undefined"){let n=new WeakMap;vs=e=>n.get(e),Rs=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;vs=r=>{for(let o=0;o(t==10&&(t=0),n[t++]=r,n[t++]=o)}var W=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-E});break}let P=o+E*e;for(let O=0;Or&&(i+=c.attrs.colspan)}}for(let s=0;s1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Dg(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Pg(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ne(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Qr(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=Yt(e.$head)||Lg(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Lg(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Ds(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Bg(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Ls(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Qd(n,e,t){let r=n.node(-1),o=W.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function vt(n,e,t=1){let r=N(b({},n),{colspan:n.colspan-t});return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Xd(n,e,t=1){let r=N(b({},n),{colspan:n.colspan+t});if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;od!=t.pos-i);a.unshift(t.pos-i);let c=a.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=i+d+1;return new Ht(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Ds(r)&&Ds(o)&&Ls(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Ye.rowSelection(r,o):i&&this.isColSelection()?Ye.colSelection(r,o):new Ye(r,o)}return T.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=W.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a0||g>0){let y=p.attrs;if(m>0&&(y=vt(y,0,m)),g>0&&(y=vt(y,y.colspan-g,g)),h.lefto.bottom){let y=N(b({},p.attrs),{rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)});h.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=W.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom0&&(t=a.resolve(i+o.map[l.left])),s.bottom0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Ye&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=W.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right{e.push(te.node(r,r+t.nodeSize,{class:"selectedCell"}))}),J.create(n.doc,e)}function $g({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(o+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function Vg({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function jg(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof M&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$.rowSelection(l,l)}else if(!t){let l=W.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$.create(o,a+1,c)}}else r instanceof T&&$g(r)?i=T.create(o,r.from):r instanceof T&&Vg(r)&&(i=T.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var _g=new _("fix-tables");function eu(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{o.type.spec.tableRole=="table"&&(t=Wg(n,o,i,t))};return e?e.doc!=n.doc&&eu(e.doc,n.doc,0,r):n.doc.descendants(r),t}function Wg(n,e,t,r){let o=W.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);let p=[];for(let g=0;g0?-1:0;zg(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s0&&o0&&e.map[l-1]==a||o0?-1:0;Jg(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c0&&o0&&u==e.map[d-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,N(b({},f),{rowspan:f.rowspan-1})),c+=f.colspan-1}else if(o0&&t[i]==t[i-1]||r.right0&&t[o]==t[o-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function Gg(n){return(e,t)=>{var r;let o=e.selection,i,s;if(o instanceof $){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=Pg(o.$from),!i)return!1;s=(r=Yt(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l=N(b({},l),{rowspan:1})),l.colspan>1&&(l=N(b({},l),{colspan:1}));let d=Be(e),u=e.tr;for(let h=0;h{s.attrs[n]!==e&&i.setNodeMarkup(l,null,N(b({},s.attrs),{[n]:e}))}):i.setNodeMarkup(o.pos,null,N(b({},o.nodeAfter.attrs),{[n]:e})),r(i)}return!0}}function Yg(n){return function(e,t){if(!Ne(e))return!1;if(t){let r=ae(e.schema),o=Be(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a{let p=h+i.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}var C1=Qt("row",{useDeprecatedLogic:!0}),M1=Qt("column",{useDeprecatedLogic:!0}),du=Qt("cell",{useDeprecatedLogic:!0});function Qg(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Jr(n,e){let t=n.selection;if(!(t instanceof $))return!1;if(e){let r=n.tr,o=ae(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new x(o,0,0))}),r.docChanged&&e(r)}return!0}function Xg(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c=e.length&&e.push(k.empty),t[o]r&&(f=f.type.createChecked(vt(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let h=1;ho&&(u=u.type.create(N(b({},u.attrs),{rowspan:Math.max(1,o-u.attrs.rowspan)}),u.content)),a.push(u)}i.push(k.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function ty(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=ae(l),c,d;if(o>e.width)for(let u=0,f=0;ue.height){let u=[];for(let p=0,m=(e.height-1)*e.width;p=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,k.from(u)),h=[];for(let p=e.height;p{if(!o)return!1;let i=t.selection;if(i instanceof $)return Gr(t,r,A.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=fu(o,n,e);if(s==null)return!1;if(n=="horiz")return Gr(t,r,A.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=Qd(l,n,e),c;return a?c=A.near(a,1):e<0?c=A.near(t.doc.resolve(l.before(-1)),-1):c=A.near(t.doc.resolve(l.after(-1)),1),Gr(t,r,c)}}}function Ur(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof $)s=i;else{let a=fu(o,n,e);if(a==null)return!1;s=new $(t.doc.resolve(a))}let l=Qd(s.$headCell,n,e);return l?Gr(t,r,new $(s.$anchorCell,l)):!1}}function ry(n,e){let t=n.state.doc,r=Yt(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new $(r))),!0):!1}function oy(n,e,t){if(!Ne(n.state))return!1;let r=Xg(t),o=n.state.selection;if(o instanceof $){r||(r={width:1,height:1,rows:[k.from(Is(ae(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=W.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=ey(r,l.right-l.left,l.bottom-l.top),Jd(n.state,n.dispatch,s,l,r),!0}else if(r){let i=Qr(n.state),s=i.start(-1);return Jd(n.state,n.dispatch,s,W.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function iy(n,e){var t;if(e.ctrlKey||e.metaKey)return;let r=qd(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof $)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Yt(n.state.selection.$anchor))!=null&&((t=Ns(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let d=Ns(n,c),u=lt.getState(n.state)==null;if(!d||!Ls(a,d))if(u)d=a;else return;let f=new $(a,d);if(u||!n.state.selection.eq(f)){let h=n.state.tr.setSelection(f);u&&h.setMeta(lt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),lt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(lt,-1))}function l(a){let c=a,d=lt.getState(n.state),u;if(d!=null)u=n.state.doc.resolve(d);else if(qd(n,c.target)!=r&&(u=Ns(n,e),!u))return s();u&&i(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function fu(n,e,t){if(!(n.state.selection instanceof T))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function qd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ns(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Yt(n.state.doc.resolve(t.pos)):null}var sy=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ps(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ps(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ps(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild,d=n.firstChild;if(d){for(let u=0,f=0;unew r(f,t,h)),new ly(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=ge.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{ay(s,l,n,o)},mouseleave:s=>{cy(s)},mousedown:(s,l)=>{dy(s,l,e,t)}},decorations:s=>{let l=ge.getState(s);if(l&&l.activeHandle>-1)return my(s,l.activeHandle)},nodeViews:{}}});return i}var ly=class Yr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(ge);if(r&&r.setHandle!=null)return new Yr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Yr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Ds(e.doc.resolve(o))||(o=-1),new Yr(o,t.dragging)}return t}};function ay(n,e,t,r){let o=ge.getState(n.state);if(o&&!o.dragging){let i=fy(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Ud(n,e,"left",t):a-e.clientX<=t&&(s=Ud(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=W.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}pu(n,s)}}}function cy(n){let e=ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&pu(n,-1)}function dy(n,e,t,r){var o;let i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=ge.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=uy(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(ge,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);let f=ge.getState(n.state);f!=null&&f.dragging&&(hy(n,f.activeHandle,Gd(f.dragging,u,t)),n.dispatch(n.state.tr.setMeta(ge,{setDragging:null})))}function d(u){if(!u.which)return c(u);let f=ge.getState(n.state);if(f&&f.dragging){let h=Gd(f.dragging,u,t);Yd(n,f.activeHandle,h,r)}}return Yd(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function uy(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c{let r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function by(n,e,t,r,o){let i=yy(n),s=[],l=[];for(let c=0;c{let{selection:e}=n.state;if(!ky(e))return!1;let t=0,r=Fr(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},bu=F.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Vs,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let{colgroup:t,tableWidth:r,tableMinWidth:o}=gy(n,this.options.cellMinWidth);return["table",R(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=by(i.schema,n,e,t);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(T.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>nu(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>ru(n,e),deleteColumn:()=>({state:n,dispatch:e})=>ou(n,e),addRowBefore:()=>({state:n,dispatch:e})=>su(n,e),addRowAfter:()=>({state:n,dispatch:e})=>lu(n,e),deleteRow:()=>({state:n,dispatch:e})=>au(n,e),deleteTable:()=>({state:n,dispatch:e})=>uu(n,e),mergeCells:()=>({state:n,dispatch:e})=>zs(n,e),splitCell:()=>({state:n,dispatch:e})=>Fs(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Qt("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Qt("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>du(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>zs(n,e)?!0:Fs(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>cu(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Hs(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Hs(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Bs(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){let r=$.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Xr,"Mod-Backspace":Xr,Delete:Xr,"Mod-Delete":Xr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[hu({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],mu({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){let e={name:n.name,options:n.options,storage:n.storage};return{tableRole:v(C(n,"tableRole",e))}}});var ku=F.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",R(this.options.HTMLAttributes,n),0]}});var xu=F.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",R(this.options.HTMLAttributes,n),0]}});var Su=F.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",R(this.options.HTMLAttributes,n),0]}});var ye=(n,e=null)=>{let t=document.createElement(n);if(e)for(let[r,o]of Object.entries(e))/^data-|^aria-|^role/.test(r)?t.setAttribute(r,o):t[r]=o;return t},js;function Rt(){return js||(js=JSON.parse(document.querySelector("#django-prose-editor-settings").textContent)),js}var xy=([n,e])=>{let t;return e.format==="textarea"?t=``:e.enum?t=``:t=``,`

${t}

`},Zr=n=>(e,t)=>{let{messages:r}=Rt();return new Promise(o=>{let i=document.createElement("div");i.innerHTML=`
${Object.entries(n).map(xy).join("")} - - + +
- `,document.body.append(o);let i=o.querySelector("dialog"),s=o.querySelector("form");for(let[l,a]of Object.entries(n))s[l].value=e[l]||a.default||"";i.querySelector("button[value=cancel]").addEventListener("click",()=>{i.close()}),i.addEventListener("close",()=>{o.remove(),r(null)}),o.querySelector("button[type=submit]").addEventListener("click",l=>{l.preventDefault(),s.reportValidity()&&(o.remove(),r(Object.fromEntries(Object.keys(n).map(a=>[a,s[a].value]))))}),i.showModal()})},wu=Zr({href:{type:"string",title:Rt().messages.url},title:{type:"string",title:Rt().messages.title}}),Cu=Zr({html:{type:"string",title:"HTML",format:"textarea"}});var Mu=H.create({name:"html",addCommands(){return{editHTML:()=>({editor:n})=>{Cu({html:n.getHTML()}).then(e=>{e&&n.chain().focus().setContent(e.html).run()})}}}});var Sy="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",wy="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",en=(n,e)=>{for(let t in e)n[t]=e[t];return n},qs="numeric",Us="ascii",Gs="alpha",oo="asciinumeric",eo="alphanumeric",Ys="domain",Iu="emoji",Cy="scheme",My="slashscheme",Tu="whitespace";function Ty(n,e){return n in e||(e[n]=[]),e[n]}function Dt(n,e,t){e[qs]&&(e[oo]=!0,e[eo]=!0),e[Us]&&(e[oo]=!0,e[Gs]=!0),e[oo]&&(e[eo]=!0),e[Gs]&&(e[eo]=!0),e[eo]&&(e[Ys]=!0),e[Iu]&&(e[Ys]=!0);for(let r in e){let o=Ty(r,t);o.indexOf(n)<0&&o.push(n)}}function Ay(n,e){let t={};for(let r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function pe(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}pe.groups={};pe.prototype={accepts(){return!!this.t},go(n){let e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,o),Ce=(n,e,t,r,o)=>n.tr(e,t,r,o),Au=(n,e,t,r,o)=>n.ts(e,t,r,o),S=(n,e,t,r,o)=>n.tt(e,t,r,o),Qe="WORD",Qs="UWORD",Wn="LOCALHOST",Xs="TLD",Zs="UTLD",io="SCHEME",Zt="SLASH_SCHEME",el="NUM",Pu="WS",tl="NL",Vn="OPENBRACE",jn="CLOSEBRACE",so="OPENBRACKET",lo="CLOSEBRACKET",ao="OPENPAREN",co="CLOSEPAREN",uo="OPENANGLEBRACKET",fo="CLOSEANGLEBRACKET",ho="FULLWIDTHLEFTPAREN",po="FULLWIDTHRIGHTPAREN",mo="LEFTCORNERBRACKET",go="RIGHTCORNERBRACKET",yo="LEFTWHITECORNERBRACKET",bo="RIGHTWHITECORNERBRACKET",ko="FULLWIDTHLESSTHAN",xo="FULLWIDTHGREATERTHAN",So="AMPERSAND",wo="APOSTROPHE",Co="ASTERISK",ct="AT",Mo="BACKSLASH",To="BACKTICK",Ao="CARET",dt="COLON",nl="COMMA",Eo="DOLLAR",ze="DOT",Oo="EQUALS",rl="EXCLAMATION",Fe="HYPHEN",No="PERCENT",vo="PIPE",Ro="PLUS",Do="POUND",Io="QUERY",ol="QUOTE",Lu="FULLWIDTHMIDDLEDOT",il="SEMI",He="SLASH",_n="TILDE",Po="UNDERSCORE",Bu="EMOJI",Lo="SYM",zu=Object.freeze({__proto__:null,WORD:Qe,UWORD:Qs,LOCALHOST:Wn,TLD:Xs,UTLD:Zs,SCHEME:io,SLASH_SCHEME:Zt,NUM:el,WS:Pu,NL:tl,OPENBRACE:Vn,CLOSEBRACE:jn,OPENBRACKET:so,CLOSEBRACKET:lo,OPENPAREN:ao,CLOSEPAREN:co,OPENANGLEBRACKET:uo,CLOSEANGLEBRACKET:fo,FULLWIDTHLEFTPAREN:ho,FULLWIDTHRIGHTPAREN:po,LEFTCORNERBRACKET:mo,RIGHTCORNERBRACKET:go,LEFTWHITECORNERBRACKET:yo,RIGHTWHITECORNERBRACKET:bo,FULLWIDTHLESSTHAN:ko,FULLWIDTHGREATERTHAN:xo,AMPERSAND:So,APOSTROPHE:wo,ASTERISK:Co,AT:ct,BACKSLASH:Mo,BACKTICK:To,CARET:Ao,COLON:dt,COMMA:nl,DOLLAR:Eo,DOT:ze,EQUALS:Oo,EXCLAMATION:rl,HYPHEN:Fe,PERCENT:No,PIPE:vo,PLUS:Ro,POUND:Do,QUERY:Io,QUOTE:ol,FULLWIDTHMIDDLEDOT:Lu,SEMI:il,SLASH:He,TILDE:_n,UNDERSCORE:Po,EMOJI:Bu,SYM:Lo}),Xt=/[a-z]/,_s=new RegExp("\\p{L}","u"),Ws=new RegExp("\\p{Emoji}","u");var Ks=/\d/,Eu=/\s/;var Ou=` + `,e.view.dom.closest(".prose-editor").append(i);let s=i.querySelector("dialog"),l=i.querySelector("form");for(let[a,c]of Object.entries(n))l[a].value=t[a]||c.default||"";s.querySelector("button[value=cancel]").addEventListener("click",()=>{s.close()}),s.addEventListener("close",()=>{i.remove(),o(null)}),i.querySelector("button[type=submit]").addEventListener("click",a=>{a.preventDefault(),l.reportValidity()&&(i.remove(),o(Object.fromEntries(Object.keys(n).map(c=>[c,l[c].value]))))}),s.showModal()})},wu=Zr({href:{type:"string",title:Rt().messages.url},title:{type:"string",title:Rt().messages.title}}),Cu=Zr({html:{type:"string",title:"HTML",format:"textarea"}});var Mu=H.create({name:"html",addCommands(){return{editHTML:()=>({editor:n})=>{Cu(n,{html:n.getHTML()}).then(e=>{e&&n.chain().focus().setContent(e.html).run()})}}}});var Sy="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",wy="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",en=(n,e)=>{for(let t in e)n[t]=e[t];return n},qs="numeric",Us="ascii",Gs="alpha",oo="asciinumeric",eo="alphanumeric",Ys="domain",Iu="emoji",Cy="scheme",My="slashscheme",Tu="whitespace";function Ty(n,e){return n in e||(e[n]=[]),e[n]}function Dt(n,e,t){e[qs]&&(e[oo]=!0,e[eo]=!0),e[Us]&&(e[oo]=!0,e[Gs]=!0),e[oo]&&(e[eo]=!0),e[Gs]&&(e[eo]=!0),e[eo]&&(e[Ys]=!0),e[Iu]&&(e[Ys]=!0);for(let r in e){let o=Ty(r,t);o.indexOf(n)<0&&o.push(n)}}function Ay(n,e){let t={};for(let r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function pe(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}pe.groups={};pe.prototype={accepts(){return!!this.t},go(n){let e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,o),Ce=(n,e,t,r,o)=>n.tr(e,t,r,o),Au=(n,e,t,r,o)=>n.ts(e,t,r,o),S=(n,e,t,r,o)=>n.tt(e,t,r,o),Qe="WORD",Qs="UWORD",Wn="LOCALHOST",Xs="TLD",Zs="UTLD",io="SCHEME",Zt="SLASH_SCHEME",el="NUM",Pu="WS",tl="NL",Vn="OPENBRACE",jn="CLOSEBRACE",so="OPENBRACKET",lo="CLOSEBRACKET",ao="OPENPAREN",co="CLOSEPAREN",uo="OPENANGLEBRACKET",fo="CLOSEANGLEBRACKET",ho="FULLWIDTHLEFTPAREN",po="FULLWIDTHRIGHTPAREN",mo="LEFTCORNERBRACKET",go="RIGHTCORNERBRACKET",yo="LEFTWHITECORNERBRACKET",bo="RIGHTWHITECORNERBRACKET",ko="FULLWIDTHLESSTHAN",xo="FULLWIDTHGREATERTHAN",So="AMPERSAND",wo="APOSTROPHE",Co="ASTERISK",ct="AT",Mo="BACKSLASH",To="BACKTICK",Ao="CARET",dt="COLON",nl="COMMA",Eo="DOLLAR",ze="DOT",Oo="EQUALS",rl="EXCLAMATION",Fe="HYPHEN",No="PERCENT",vo="PIPE",Ro="PLUS",Do="POUND",Io="QUERY",ol="QUOTE",Lu="FULLWIDTHMIDDLEDOT",il="SEMI",He="SLASH",_n="TILDE",Po="UNDERSCORE",Bu="EMOJI",Lo="SYM",zu=Object.freeze({__proto__:null,WORD:Qe,UWORD:Qs,LOCALHOST:Wn,TLD:Xs,UTLD:Zs,SCHEME:io,SLASH_SCHEME:Zt,NUM:el,WS:Pu,NL:tl,OPENBRACE:Vn,CLOSEBRACE:jn,OPENBRACKET:so,CLOSEBRACKET:lo,OPENPAREN:ao,CLOSEPAREN:co,OPENANGLEBRACKET:uo,CLOSEANGLEBRACKET:fo,FULLWIDTHLEFTPAREN:ho,FULLWIDTHRIGHTPAREN:po,LEFTCORNERBRACKET:mo,RIGHTCORNERBRACKET:go,LEFTWHITECORNERBRACKET:yo,RIGHTWHITECORNERBRACKET:bo,FULLWIDTHLESSTHAN:ko,FULLWIDTHGREATERTHAN:xo,AMPERSAND:So,APOSTROPHE:wo,ASTERISK:Co,AT:ct,BACKSLASH:Mo,BACKTICK:To,CARET:Ao,COLON:dt,COMMA:nl,DOLLAR:Eo,DOT:ze,EQUALS:Oo,EXCLAMATION:rl,HYPHEN:Fe,PERCENT:No,PIPE:vo,PLUS:Ro,POUND:Do,QUERY:Io,QUOTE:ol,FULLWIDTHMIDDLEDOT:Lu,SEMI:il,SLASH:He,TILDE:_n,UNDERSCORE:Po,EMOJI:Bu,SYM:Lo}),Xt=/[a-z]/,_s=new RegExp("\\p{L}","u"),Ws=new RegExp("\\p{Emoji}","u");var Ks=/\d/,Eu=/\s/;var Ou=` `,Ey="\uFE0F",Oy="\u200D",to=null,no=null;function Ny(n=[]){let e={};pe.groups=e;let t=new pe;to==null&&(to=Nu(Sy)),no==null&&(no=Nu(wy)),S(t,"'",wo),S(t,"{",Vn),S(t,"}",jn),S(t,"[",so),S(t,"]",lo),S(t,"(",ao),S(t,")",co),S(t,"<",uo),S(t,">",fo),S(t,"\uFF08",ho),S(t,"\uFF09",po),S(t,"\u300C",mo),S(t,"\u300D",go),S(t,"\u300E",yo),S(t,"\u300F",bo),S(t,"\uFF1C",ko),S(t,"\uFF1E",xo),S(t,"&",So),S(t,"*",Co),S(t,"@",ct),S(t,"`",To),S(t,"^",Ao),S(t,":",dt),S(t,",",nl),S(t,"$",Eo),S(t,".",ze),S(t,"=",Oo),S(t,"!",rl),S(t,"-",Fe),S(t,"%",No),S(t,"|",vo),S(t,"+",Ro),S(t,"#",Do),S(t,"?",Io),S(t,'"',ol),S(t,"/",He),S(t,";",il),S(t,"~",_n),S(t,"_",Po),S(t,"\\",Mo),S(t,"\u30FB",Lu);let r=Ce(t,Ks,el,{[qs]:!0});Ce(r,Ks,r);let o=Ce(t,Xt,Qe,{[Us]:!0});Ce(o,Xt,o);let i=Ce(t,_s,Qs,{[Gs]:!0});Ce(i,Xt),Ce(i,_s,i);let s=Ce(t,Eu,Pu,{[Tu]:!0});S(t,Ou,tl,{[Tu]:!0}),S(s,Ou),Ce(s,Eu,s);let l=Ce(t,Ws,Bu,{[Iu]:!0});Ce(l,Ws,l),S(l,Ey,l);let a=S(l,Oy);Ce(a,Ws,l);let c=[[Xt,o]],d=[[Xt,null],[_s,i]];for(let u=0;uu[0]>f[0]?1:-1);for(let u=0;u=0?p[Ys]=!0:Xt.test(f)?Ks.test(f)?p[oo]=!0:p[Us]=!0:p[qs]=!0,Au(t,f,f,p)}return Au(t,"localhost",Wn,{ascii:!0}),t.jd=new pe(Lo),{start:t,tokens:en({groups:e},zu)}}function Fu(n,e){let t=vy(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,o=[],i=0,s=0;for(;s=0&&(u+=t[s].length,f++),c+=t[s].length,i+=t[s].length,s++;i-=u,s-=f,c-=u,o.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function vy(n){let e=[],t=n.length,r=0;for(;r56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function at(n,e,t,r,o){let i,s=e.length;for(let l=0;l=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+i),10);s>0;s--)t.pop();r+=i}else t.push(n[r]),r++}return e}var Kn={defaultProtocol:"http",events:null,format:vu,formatHref:vu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sl(n,e=null){let t=en({},Kn);n&&(t=en(t,n instanceof sl?n.o:n));let r=t.ignoreTags,o=[];for(let i=0;it?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Kn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){let e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&en(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};function Bo(n,e){class t extends Hu{constructor(o,i){super(o,i),this.t=n}}for(let r in e)t.prototype[r]=e[r];return t.t=n,t}var Ru=Bo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Du=Bo("text"),Ry=Bo("nl"),ro=Bo("url",{isLink:!0,toHref(n=Kn.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){let n=this.tk;return n.length>=2&&n[0].t!==Wn&&n[1].t===dt}});var Me=n=>new pe(n);function Dy({groups:n}){let e=n.domain.concat([So,Co,ct,Mo,To,Ao,Eo,Oo,Fe,el,No,vo,Ro,Do,He,Lo,_n,Po]),t=[wo,dt,nl,ze,rl,Io,ol,il,uo,fo,Vn,jn,lo,so,ao,co,ho,po,mo,go,yo,bo,ko,xo],r=[So,wo,Co,Mo,To,Ao,Eo,Oo,Fe,Vn,jn,No,vo,Ro,Do,Io,He,Lo,_n,Po],o=Me(),i=S(o,_n);D(i,r,i),D(i,n.domain,i);let s=Me(),l=Me(),a=Me();D(o,n.domain,s),D(o,n.scheme,l),D(o,n.slashscheme,a),D(s,r,i),D(s,n.domain,s);let c=S(s,ct);S(i,ct,c),S(l,ct,c),S(a,ct,c);let d=S(i,ze);D(d,r,i),D(d,n.domain,i);let u=Me();D(c,n.domain,u),D(u,n.domain,u);let f=S(u,ze);D(f,n.domain,u);let h=Me(Ru);D(f,n.tld,h),D(f,n.utld,h),S(c,Wn,h);let p=S(u,Fe);D(p,n.domain,u),D(h,n.domain,u),S(h,ze,f),S(h,Fe,p);let m=S(h,dt);D(m,n.numeric,Ru);let g=S(s,Fe),y=S(s,ze);D(g,n.domain,s),D(y,r,i),D(y,n.domain,s);let w=Me(ro);D(y,n.tld,w),D(y,n.utld,w),D(w,n.domain,s),D(w,r,i),S(w,ze,y),S(w,Fe,g),S(w,ct,c);let E=S(w,dt),P=Me(ro);D(E,n.numeric,P);let O=Me(ro),I=Me();D(O,e,O),D(O,t,I),D(I,e,O),D(I,t,I),S(w,He,O),S(P,He,O);let j=S(l,dt),K=S(a,dt),L=S(K,He),be=S(L,He);D(l,n.domain,s),S(l,ze,y),S(l,Fe,g),D(a,n.domain,s),S(a,ze,y),S(a,Fe,g),D(j,n.domain,O),S(j,He,O),D(be,n.domain,O),D(be,e,O),S(be,He,O);let ut=[[Vn,jn],[so,lo],[ao,co],[uo,fo],[ho,po],[mo,go],[yo,bo],[ko,xo]];for(let nn=0;nn=0&&f++,o++,d++;if(f<0)o-=d,o0&&(i.push(Js(Du,e,s)),s=[]),o-=f,d-=f;let h=u.t,p=t.slice(o-d,o);i.push(Js(h,e,p))}}return s.length>0&&i.push(Js(Du,e,s)),i}function Js(n,e,t){let r=t[0].s,o=t[t.length-1].e,i=e.slice(r,o);return new n(i,t)}var Py=typeof console!="undefined"&&console&&console.warn||(()=>{}),Ly="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",V={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $u(){return pe.groups={},V.scanner=null,V.parser=null,V.tokenQueue=[],V.pluginQueue=[],V.customSchemes=[],V.initialized=!1,V}function ll(n,e=!1){if(V.initialized&&Py(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Ly}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);V.customSchemes.push([n,e])}function By(){V.scanner=Ny(V.customSchemes);for(let n=0;n{let o=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=ms(t.doc,[...e]);if(bs(l).forEach(({newRange:c})=>{let d=gs(r.doc,c,h=>h.isTextblock),u,f;if(d.length>1?(u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&f){let h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;let p=h[h.length-1],m=u.pos+f.lastIndexOf(p);if(!p)return!1;let g=zo(p).map(y=>y.toObject(n.defaultProtocol));if(!zy(g))return!1;g.filter(y=>y.isLink).map(y=>N(b({},y),{from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{$n(y.from,y.to,r.doc).some(w=>w.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function Hy(n){return new B({key:new _("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;let a=$r(e.state,n.type.name),c=r.target,d=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,u=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&d?(window.open(d,u),!0):!1}}})}function $y(n){return new B({key:new _("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});let a=al(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}var Vy=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Jn(n,e){let t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(Vy,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Vu=Q.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){ll(n);return}ll(n.scheme,n.optionalSlashes)})},onDestroy(){$u()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Jn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Jn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Jn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",R(this.options.HTMLAttributes,n),0]:["a",R(this.options.HTMLAttributes,N(b({},n),{href:""})),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Oe({find:n=>{let e=[];if(n){let{protocols:t,defaultProtocol:r}=this.options,o=al(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Jn(s,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Fy({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Jn(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Hy({type:this.type})),this.options.linkOnPaste&&n.push($y({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});var ju=Vu.extend({addOptions(){var n;return N(b({},(n=this.parent)==null?void 0:n.call(this)),{openOnClick:!1,HTMLAttributes:{target:null,rel:"noopener noreferrer nofollow",class:null}})},addCommands(){var n;return N(b({},(n=this.parent)==null?void 0:n.call(this)),{addLink:()=>({editor:e})=>{let t=e.getAttributes(this.name);wu(t).then(r=>{if(r){let o=e.chain().focus().extendMarkRange(this.name).unsetMark(this.name);r.definition&&o.setMark(this.name,r),o.run()}})}})},addKeyboardShortcuts(){return{"Mod-k":({editor:n})=>{let e;(e=window.event)&&e.preventDefault(),n.commands.addLink()}}}});var _u=H.create({name:"noSpellCheck",addProseMirrorPlugins(){return[new B({view(n){return new cl(n)}})]}}),cl=class{constructor(e){this.editorView=e,this.editorView.dom.setAttribute("spellcheck","false")}update(){}destroy(){this.editorView.dom.removeAttribute("spellcheck")}};var Wu=H.create({name:"typographic",addProseMirrorPlugins(){return[qu]}});function Ku(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{let t=[];if(n.text)for(let r of n.text.matchAll(/(\u00A0|\u00AD)/g)){let o=e+(r.index||0);t.push(te.inline(o,o+1,{class:jy[r[1]]}))}return t},_y=n=>{let e=[];return n.descendants((t,r)=>{e.push(Ju(t,r))}),J.create(n,e.flat())},qu=new B({state:{init(n,{doc:e}){return _y(e)},apply(n,e,t){let r=e.map(n.mapping,n.doc);return Ku(t.doc,n.doc,0,(o,i)=>{r=r.remove(r.find(i,i+o.content.size)),r=r.add(n.doc,Ju(o,i))}),r}},props:{decorations(n){return qu.getState(n)}}});var qn=(n,e)=>n.extensionManager.extensions.find(t=>t.name===e),Uu=n=>[Jy(n),qy(n),Gy(n),Uy(n),Qy(n),Xy(n),Yy(n),Zy(n)].filter(Boolean),Wy=H.create({name:"menu",addOptions(){return{menuItems:Uu}},addProseMirrorPlugins(){let n=this.editor,e=this.options.menuItems(n);return[new B({view(){let t=new dl(n,e);return n.view.dom.parentNode.insertBefore(t.dom,n.view.dom),t}})]}}),dl=class{constructor(e,t){this.items=t.flat(),this.editor=e,this.dom=ye("div",{className:"prose-menubar"}),t.filter(r=>r.length).forEach(r=>{let o=ye("div",{className:"prose-menubar__group"});this.dom.append(o),r.forEach(({dom:i})=>o.append(i))}),this.update(),this.dom.addEventListener("mousedown",r=>{r.preventDefault(),e.view.focus(),this.items.forEach(({command:o,dom:i})=>{i.contains(r.target)&&o(e)})})}update(){this.items.forEach(({dom:e,enabled:t=()=>!0,active:r=()=>!1,hidden:o=()=>!1})=>{e.classList.toggle("disabled",!t(this.editor)),e.classList.toggle("active",!!r(this.editor)),e.classList.toggle("hidden",!!o(this.editor))})}destroy(){this.dom.remove()}};function tn(n,e=""){return ye("span",{className:"prose-menubar__button",textContent:n,title:e})}function X(n,e){return ye("span",{className:"prose-menubar__button material-icons",textContent:n,title:e})}var Ky=(n,e)=>{let t=ye("span",{className:"prose-menubar__button prose-menubar__button--heading"});return t.append(ye("span",{className:"material-icons",textContent:"title",title:`heading ${e}`}),ye("span",{className:"level",textContent:`${e}`})),{command:r=>{r.chain().focus().toggleHeading({level:e}).run()},dom:t,active(r){return r.isActive("heading",{level:e})}}};function Jy(n){let e=n.schema,t=qn(n,"heading"),o=(t?t.options.levels:[]).map(s=>Ky(n,s)),i;return(i=e.nodes.bulletList)&&o.push({command(s){s.chain().focus().toggleBulletList().run()},dom:X("format_list_bulleted","unordered list"),active(s){return!1}}),(i=e.nodes.orderedList)&&o.push({command(s){s.chain().focus().toggleOrderedList().run()},dom:X("format_list_numbered","ordered list"),active(s){return!1}}),o.length?[...o,{command(s){s.chain().focus().setParagraph().run()},dom:X("notes","paragraph"),active(s){return!1}}]:[]}function qy(n){let e=n.schema,t=[],r;return(r=e.nodes.blockquote)&&t.push({command(o){o.chain().focus().toggleBlockquote().run()},dom:X("format_quote","blockquote"),active(o){return o.isActive("blockquote")}}),(r=e.nodes.horizontalRule)&&t.push({command(o){o.chain().focus().setHorizontalRule().run()},dom:X("horizontal_rule","horizontal rule"),active(o){return!1}}),t}function Uy(n){let e=(t,r)=>t in n.schema.marks?{command(o){o.chain().focus().toggleMark(t).run()},dom:r,active:o=>o.isActive(t)}:null;return[e("bold",X("format_bold","bold")),e("italic",X("format_italic","italic")),e("underline",X("format_underline","underline")),e("strike",X("format_strikethrough","strike")),e("subscript",X("subscript","subscript")),e("superscript",X("superscript","superscript"))].filter(Boolean)}function Gy(n){let e=n.schema.marks.link;return e?[{command(t){t.chain().addLink().focus().run()},enabled(t){return!t.state.selection.empty||t.isActive("link")},dom:X("insert_link","insert link"),active(t){return t.isActive(e)}},{command(t){t.chain().focus().unsetLink().run()},dom:X("link_off","remove link"),hidden(t){return!t.isActive("link")}}]:[]}function Yy(n){return qn(n,"history")?[{command(e){e.commands.undo()},enabled(e){return e.can().undo()},dom:X("undo","undo"),active(){return!1}},{command(e){e.commands.redo()},enabled(e){return e.can().redo()},dom:X("redo","redo"),active(){return!1}}]:null}function Qy(n){let e=t=>({command(r){r.chain().focus().setTextAlign(t).run()},dom:X(`format_align_${t}`,t),active(){return n.isActive({textAlign:t})}});return qn(n,"textAlign")?[e("left"),e("center"),e("right"),e("justify")]:null}function Xy(n){if(!qn(n,"table"))return[];let e=(t,r)=>({command:t,dom:r,hidden(){return!n.isActive("table")}});return[{command(t){t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!1}).run()},dom:X("grid_on","Insert table")},e(t=>{t.chain().focus().addColumnAfter().run()},tn("+Col")),e(t=>{t.chain().focus().deleteColumn().run()},tn("-Col")),e(t=>{t.chain().focus().addRowAfter().run()},tn("+Row")),e(t=>{t.chain().focus().deleteRow().run()},tn("-Row")),e(t=>{t.chain().focus().mergeCells().run()},tn("Merge")),e(t=>{t.chain().focus().splitCell().run()},tn("Split"))]}function Zy(n){return qn(n,"html")?[{command(e){e.commands.editHTML()},dom:X("code","edit HTML")}]:null}function e0(n,e,{shadow:t=!1}={}){let r=ye("div",{className:"prose-editor-wrapper"});n.before(r);let o=ye("div",{className:"prose-editor"});if(t){let s=r.attachShadow({mode:"open"});for(let l of Rt().stylesheets)s.append(ye("link",{rel:"stylesheet",href:l}));s.append(o)}else r.append(o);return new Dn({element:o,editable:!n.hasAttribute("disabled"),extensions:e,content:n.value,onUpdate({editor:s}){n.value=s.getHTML(),n.dispatchEvent(new Event("input",{bubbles:!0}))},onDestroy(){r.remove()}})}function t0(n,e){function t(o){for(let i of o.querySelectorAll(e))i.id.includes("__prefix__")||n(i)}function r(){let o;(o=window.django)&&(o=o.jQuery)&&o(document).on("formset:added",i=>{t(i.target)})}t(document),r()}window.DjangoProseEditor=ul;})(); +3. "-" cannot repeat`);V.customSchemes.push([n,e])}function By(){V.scanner=Ny(V.customSchemes);for(let n=0;n{let o=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=ms(t.doc,[...e]);if(bs(l).forEach(({newRange:c})=>{let d=gs(r.doc,c,h=>h.isTextblock),u,f;if(d.length>1?(u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&f){let h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;let p=h[h.length-1],m=u.pos+f.lastIndexOf(p);if(!p)return!1;let g=zo(p).map(y=>y.toObject(n.defaultProtocol));if(!zy(g))return!1;g.filter(y=>y.isLink).map(y=>N(b({},y),{from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{$n(y.from,y.to,r.doc).some(w=>w.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function Hy(n){return new B({key:new _("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;let a=$r(e.state,n.type.name),c=r.target,d=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,u=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&d?(window.open(d,u),!0):!1}}})}function $y(n){return new B({key:new _("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});let a=al(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}var Vy=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Jn(n,e){let t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(Vy,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Vu=Q.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){ll(n);return}ll(n.scheme,n.optionalSlashes)})},onDestroy(){$u()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Jn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Jn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Jn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",R(this.options.HTMLAttributes,n),0]:["a",R(this.options.HTMLAttributes,N(b({},n),{href:""})),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Oe({find:n=>{let e=[];if(n){let{protocols:t,defaultProtocol:r}=this.options,o=al(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Jn(s,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Fy({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Jn(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Hy({type:this.type})),this.options.linkOnPaste&&n.push($y({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});var ju=Vu.extend({addOptions(){var n;return N(b({},(n=this.parent)==null?void 0:n.call(this)),{openOnClick:!1,HTMLAttributes:{target:null,rel:"noopener noreferrer nofollow",class:null}})},addCommands(){var n;return N(b({},(n=this.parent)==null?void 0:n.call(this)),{addLink:()=>({editor:e})=>{let t=e.getAttributes(this.name);wu(e,t).then(r=>{if(r){let o=e.chain().focus().extendMarkRange(this.name).unsetMark(this.name);r.definition&&o.setMark(this.name,r),o.run()}})}})},addKeyboardShortcuts(){return{"Mod-k":({editor:n})=>{let e;(e=window.event)&&e.preventDefault(),n.commands.addLink()}}}});var _u=H.create({name:"noSpellCheck",addProseMirrorPlugins(){return[new B({view(n){return new cl(n)}})]}}),cl=class{constructor(e){this.editorView=e,this.editorView.dom.setAttribute("spellcheck","false")}update(){}destroy(){this.editorView.dom.removeAttribute("spellcheck")}};var Wu=H.create({name:"typographic",addProseMirrorPlugins(){return[qu]}});function Ku(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s{let t=[];if(n.text)for(let r of n.text.matchAll(/(\u00A0|\u00AD)/g)){let o=e+(r.index||0);t.push(te.inline(o,o+1,{class:jy[r[1]]}))}return t},_y=n=>{let e=[];return n.descendants((t,r)=>{e.push(Ju(t,r))}),J.create(n,e.flat())},qu=new B({state:{init(n,{doc:e}){return _y(e)},apply(n,e,t){let r=e.map(n.mapping,n.doc);return Ku(t.doc,n.doc,0,(o,i)=>{r=r.remove(r.find(i,i+o.content.size)),r=r.add(n.doc,Ju(o,i))}),r}},props:{decorations(n){return qu.getState(n)}}});var qn=(n,e)=>n.extensionManager.extensions.find(t=>t.name===e),Uu=n=>[Jy(n),qy(n),Gy(n),Uy(n),Qy(n),Xy(n),Yy(n),Zy(n)].filter(Boolean),Wy=H.create({name:"menu",addOptions(){return{menuItems:Uu}},addProseMirrorPlugins(){let n=this.editor,e=this.options.menuItems(n);return[new B({view(){let t=new dl(n,e);return n.view.dom.parentNode.insertBefore(t.dom,n.view.dom),t}})]}}),dl=class{constructor(e,t){this.items=t.flat(),this.editor=e,this.dom=ye("div",{className:"prose-menubar"}),t.filter(r=>r.length).forEach(r=>{let o=ye("div",{className:"prose-menubar__group"});this.dom.append(o),r.forEach(({dom:i})=>o.append(i))}),this.update(),this.dom.addEventListener("mousedown",r=>{r.preventDefault(),e.view.focus(),this.items.forEach(({command:o,dom:i})=>{i.contains(r.target)&&o(e)})})}update(){this.items.forEach(({dom:e,enabled:t=()=>!0,active:r=()=>!1,hidden:o=()=>!1})=>{e.classList.toggle("disabled",!t(this.editor)),e.classList.toggle("active",!!r(this.editor)),e.classList.toggle("hidden",!!o(this.editor))})}destroy(){this.dom.remove()}};function tn(n,e=""){return ye("span",{className:"prose-menubar__button",textContent:n,title:e})}function X(n,e){return ye("span",{className:"prose-menubar__button material-icons",textContent:n,title:e})}var Ky=(n,e)=>{let t=ye("span",{className:"prose-menubar__button prose-menubar__button--heading"});return t.append(ye("span",{className:"material-icons",textContent:"title",title:`heading ${e}`}),ye("span",{className:"level",textContent:`${e}`})),{command:r=>{r.chain().focus().toggleHeading({level:e}).run()},dom:t,active(r){return r.isActive("heading",{level:e})}}};function Jy(n){let e=n.schema,t=qn(n,"heading"),o=(t?t.options.levels:[]).map(s=>Ky(n,s)),i;return(i=e.nodes.bulletList)&&o.push({command(s){s.chain().focus().toggleBulletList().run()},dom:X("format_list_bulleted","unordered list"),active(s){return!1}}),(i=e.nodes.orderedList)&&o.push({command(s){s.chain().focus().toggleOrderedList().run()},dom:X("format_list_numbered","ordered list"),active(s){return!1}}),o.length?[...o,{command(s){s.chain().focus().setParagraph().run()},dom:X("notes","paragraph"),active(s){return!1}}]:[]}function qy(n){let e=n.schema,t=[],r;return(r=e.nodes.blockquote)&&t.push({command(o){o.chain().focus().toggleBlockquote().run()},dom:X("format_quote","blockquote"),active(o){return o.isActive("blockquote")}}),(r=e.nodes.horizontalRule)&&t.push({command(o){o.chain().focus().setHorizontalRule().run()},dom:X("horizontal_rule","horizontal rule"),active(o){return!1}}),t}function Uy(n){let e=(t,r)=>t in n.schema.marks?{command(o){o.chain().focus().toggleMark(t).run()},dom:r,active:o=>o.isActive(t)}:null;return[e("bold",X("format_bold","bold")),e("italic",X("format_italic","italic")),e("underline",X("format_underline","underline")),e("strike",X("format_strikethrough","strike")),e("subscript",X("subscript","subscript")),e("superscript",X("superscript","superscript"))].filter(Boolean)}function Gy(n){let e=n.schema.marks.link;return e?[{command(t){t.chain().addLink().focus().run()},enabled(t){return!t.state.selection.empty||t.isActive("link")},dom:X("insert_link","insert link"),active(t){return t.isActive(e)}},{command(t){t.chain().focus().unsetLink().run()},dom:X("link_off","remove link"),hidden(t){return!t.isActive("link")}}]:[]}function Yy(n){return qn(n,"history")?[{command(e){e.commands.undo()},enabled(e){return e.can().undo()},dom:X("undo","undo"),active(){return!1}},{command(e){e.commands.redo()},enabled(e){return e.can().redo()},dom:X("redo","redo"),active(){return!1}}]:null}function Qy(n){let e=t=>({command(r){r.chain().focus().setTextAlign(t).run()},dom:X(`format_align_${t}`,t),active(){return n.isActive({textAlign:t})}});return qn(n,"textAlign")?[e("left"),e("center"),e("right"),e("justify")]:null}function Xy(n){if(!qn(n,"table"))return[];let e=(t,r)=>({command:t,dom:r,hidden(){return!n.isActive("table")}});return[{command(t){t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!1}).run()},dom:X("grid_on","Insert table")},e(t=>{t.chain().focus().addColumnAfter().run()},tn("+Col")),e(t=>{t.chain().focus().deleteColumn().run()},tn("-Col")),e(t=>{t.chain().focus().addRowAfter().run()},tn("+Row")),e(t=>{t.chain().focus().deleteRow().run()},tn("-Row")),e(t=>{t.chain().focus().mergeCells().run()},tn("Merge")),e(t=>{t.chain().focus().splitCell().run()},tn("Split"))]}function Zy(n){return qn(n,"html")?[{command(e){e.commands.editHTML()},dom:X("code","edit HTML")}]:null}function e0(n,e,{shadow:t=!1}={}){let r=ye("div",{className:"prose-editor-wrapper"});n.before(r);let o=ye("div",{className:"prose-editor"});if(t){let s=r.attachShadow({mode:"open"});for(let l of Rt().stylesheets)s.append(ye("link",{rel:"stylesheet",href:l}));s.append(o)}else r.append(o);return new Dn({element:o,editable:!n.hasAttribute("disabled"),extensions:e,content:n.value,onUpdate({editor:s}){n.value=s.getHTML(),n.dispatchEvent(new Event("input",{bubbles:!0}))},onDestroy(){r.remove()}})}function t0(n,e){function t(o){for(let i of o.querySelectorAll(e))i.id.includes("__prefix__")||n(i)}function r(){let o;(o=window.django)&&(o=o.jQuery)&&o(document).on("formset:added",i=>{t(i.target)})}t(document),r()}window.DjangoProseEditor=ul;})(); diff --git a/src/commands.js b/src/commands.js index 7fe1a71..e2e1541 100644 --- a/src/commands.js +++ b/src/commands.js @@ -14,7 +14,7 @@ const formFieldForProperty = ([name, config]) => { return `

${widget}

` } -export const updateAttrsDialog = (properties) => (attrs) => { +export const updateAttrsDialog = (properties) => (editor, attrs) => { const { messages } = settings() return new Promise((resolve) => { const div = document.createElement("div") @@ -27,7 +27,8 @@ export const updateAttrsDialog = (properties) => (attrs) => { ` - document.body.append(div) + + editor.view.dom.closest(".prose-editor").append(div) const dialog = div.querySelector("dialog") const form = div.querySelector("form") diff --git a/src/html.js b/src/html.js index 1b7a194..99a5b96 100644 --- a/src/html.js +++ b/src/html.js @@ -10,7 +10,7 @@ export const HTML = Extension.create({ editHTML: () => ({ editor }) => { - htmlDialog({ html: editor.getHTML() }).then((attrs) => { + htmlDialog(editor, { html: editor.getHTML() }).then((attrs) => { if (attrs) { editor.chain().focus().setContent(attrs.html).run() } diff --git a/src/link.js b/src/link.js index 40425fb..3b1a8b6 100644 --- a/src/link.js +++ b/src/link.js @@ -23,7 +23,7 @@ export const Link = BaseLink.extend({ ({ editor }) => { const attrs = editor.getAttributes(this.name) - linkDialog(attrs).then((attrs) => { + linkDialog(editor, attrs).then((attrs) => { if (attrs) { const cmd = editor .chain()