1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[56361],{9492:(e,t,n)=>{n.d(t,{$m:()=>eY,AB:()=>tL,BQ:()=>eG,CU:()=>tg,Ce:()=>tN,Dd:()=>tY,FF:()=>e_,GG:()=>tH,JJ:()=>tj,J_:()=>eJ,KP:()=>eS,KV:()=>eN,Nx:()=>eM,Nz:()=>tP,OX:()=>tA,Pg:()=>x,QN:()=>eq,T7:()=>eb,Wp:()=>ex,YY:()=>tb,Yj:()=>tW,Zc:()=>tX,_n:()=>ty,bP:()=>tJ,eL:()=>eE,fV:()=>tp,fl:()=>eW,gk:()=>eT,gu:()=>eB,hO:()=>eU,hs:()=>tD,iI:()=>eC,kj:()=>tq,rU:()=>er,tG:()=>tI,xe:()=>ew,zU:()=>ej});var r=n(18407),i=n(31379),o=n(51772),s=n(73656),a=n(14929);n(28306);var l=n(56517),d=Object.defineProperty,c=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})};function u(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var p=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!e,l=e||i.tr,d=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),c}])),run:d};return c}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:u({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},h={};c(h,{blur:()=>m,clearContent:()=>f,clearNodes:()=>g,command:()=>y,createParagraphNear:()=>v,cut:()=>k,deleteCurrentNode:()=>b,deleteNode:()=>w,deleteRange:()=>M,deleteSelection:()=>S,enter:()=>C,exitCode:()=>O,extendMarkRange:()=>j,first:()=>I,focus:()=>B,forEach:()=>_,insertContent:()=>U,insertContentAt:()=>V,joinBackward:()=>J,joinDown:()=>q,joinForward:()=>X,joinItemBackward:()=>Z,joinItemForward:()=>G,joinTextblockBackward:()=>Q,joinTextblockForward:()=>ee,joinUp:()=>Y,keyboardShortcut:()=>en,lift:()=>ei,liftEmptyBlock:()=>eo,liftListItem:()=>es,newlineInCode:()=>ea,resetAttributes:()=>ec,scrollIntoView:()=>eu,selectAll:()=>ep,selectNodeBackward:()=>eh,selectNodeForward:()=>em,selectParentNode:()=>ef,selectTextblockEnd:()=>eg,selectTextblockStart:()=>ey,setContent:()=>ev,setMark:()=>eQ,setMeta:()=>e0,setNode:()=>e1,setNodeSelection:()=>e2,setTextDirection:()=>e3,setTextSelection:()=>e9,sinkListItem:()=>e4,splitBlock:()=>e7,splitListItem:()=>e6,toggleList:()=>tt,toggleMark:()=>tn,toggleNode:()=>tr,toggleWrap:()=>ti,undoInputRule:()=>to,unsetAllMarks:()=>ts,unsetMark:()=>ta,unsetTextDirection:()=>tl,updateAttributes:()=>td,wrapIn:()=>tc,wrapInList:()=>tu});var m=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),f=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),g=()=>({state:e,tr:t,dispatch:n})=>{let{selection:i}=t,{ranges:o}=i;return!n||(o.forEach(({$from:n,$to:i})=>{e.doc.nodesBetween(n.pos,i.pos,(e,n)=>{if(e.type.isText)return;let{doc:i,mapping:o}=t,s=i.resolve(o.map(n)),a=i.resolve(o.map(n+e.nodeSize)),l=s.blockRange(a);if(!l)return;let d=(0,r.jP)(l);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());t.setNodeMarkup(l.start,e)}(d||0===d)&&t.lift(l,d)})}),!0)},y=e=>t=>e(t),v=()=>({state:e,dispatch:t})=>(0,i.Z1)(e,t),k=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,s=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let a=r.mapping.map(t);return r.insert(a,s.content),r.setSelection(new o.U3(r.doc.resolve(Math.max(a-1,0)))),!0},b=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function x(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var w=e=>({tr:t,state:n,dispatch:r})=>{let i=x(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},M=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},E=(e,t,n)=>!e.parent.isInline||"left"===n&&e.pos>
1e.start()||"right"===n&&e.pos<e.end()||!(e=>!!e.content&&/^text(\*|\+)/.test(e.content))(t.nodes[e.parent.type.name].spec)?e.pos:"left"===n?e.start()-1:e.end()+1,S=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:o}=((e,t,n)=>({from:E(e,n,"left"),to:E(t,n,"right")}))(n,r,e.schema);return t&&(e.tr.deleteRange(i,o).scrollIntoView(),t(e.tr)),!0},C=()=>({commands:e})=>e.keyboardShortcut("Enter"),O=()=>({state:e,dispatch:t})=>(0,i.I$)(e,t);function z(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function T(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:z(t[r])?t[r].test(e[r]):t[r]===e[r])}function $(e,t,n={}){return e.find(e=>e.type===t&&T(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function R(e,t,n={}){return!!$(e,t,n)}function A(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!$([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,a=o+r.node.nodeSize;for(;i>0&&R([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&R([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:a}}function N(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var j=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=N(e,r.schema),{doc:a,selection:l}=n,{$from:d,from:c,to:u}=l;if(i){let e=A(d,s,t);if(e&&e.from<=c&&e.to>=u){let t=o.U3.create(a,e.from,e.to);n.setSelection(t)}}return!0},I=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function P(e){return e instanceof o.U3}function L(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function H(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function D(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var B=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};let a=()=>{(D()||H())&&r.dom.focus(),"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!D()&&!H()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(s&&null===e&&!P(n.state.selection))return a(),!0;let l=function(e,t=null){if(!t)return null;let n=o.LN.atStart(e),r=o.LN.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,s=r.to;return"all"===t?o.U3.create(e,L(0,i,s),L(e.content.size,i,s)):o.U3.create(e,L(t,i,s),L(t,i,s))}(i.doc,e)||n.state.selection,d=n.state.selection.eq(l);return s&&(d||i.setSelection(l),d&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},_=(e,t)=>
1n=>e.every((e,r)=>t(e,{...n,index:r})),U=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),W=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&W(r)}return e};function K(e){if("undefined"==typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return W(new window.DOMParser().parseFromString(t,"text/html").body)}function F(e,t,n){if(e instanceof s.bP||e instanceof s.FK)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return s.FK.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),F("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",o=new s.Sj({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?s.S4.fromSchema(o).parseSlice(K(e),n.parseOptions):s.S4.fromSchema(o).parse(K(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=s.S4.fromSchema(t);return n.slice?r.parseSlice(K(e),n.parseOptions).content:r.parse(K(e),n.parseOptions)}return F("",t,n)}var V=(e,t,n)=>({tr:i,dispatch:a,editor:l})=>{var d;if(a){let a,c;n={parseOptions:l.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let u=e=>{l.emit("contentError",{editor:l,error:e,disableCollaboration:()=>{"collaboration"in l.storage&&"object"==typeof l.storage.collaboration&&l.storage.collaboration&&(l.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!l.options.enableContentCheck&&l.options.emitContentError)try{F(t,l.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(e){u(e)}try{a=F(t,l.schema,{parseOptions:p,errorOnInvalidContent:null!=(d=n.errorOnInvalidContent)?d:l.options.enableContentCheck})}catch(e){return u(e),!1}let{from:h,to:m}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},f=!0,g=!0;if((!("type"in a)?a:[a]).forEach(e=>{e.check(),f=!!f&&e.isText&&0===e.marks.length,g=!!g&&e.isBlock}),h===m&&g){let{parent:e}=i.doc.resolve(h);!e.isTextblock||e.type.spec.code||e.childCount||(h-=1,m+=1)}if(f){if(Array.isArray(t))c=t.map(e=>e.text||"").join("");else if(t instanceof s.FK){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),c=e}else c="object"==typeof t&&t&&t.text?t.text:t;i.insertText(c,h,m)}else{c=a;let e=i.doc.resolve(h),t=e.node(),n=0===e.parentOffset,r=t.isText||t.isTextblock,o=t.content.size>0;n&&r&&o&&g&&(h=Math.max(0,h-1)),i.replaceWith(h,m,c)}n.updateSelection&&function(e,t,n){let i=e.steps.length-1;if(i<t)return;let s=e.steps[i];if(!(s instanceof r.Ln||s instanceof r.Wg))return;let a=e.mapping.maps[i],l=0;a.forEach((e,t,n,r)=>{0===l&&(l=r)}),e.setSelection(o.LN.near(e.doc.resolve(l),-1))}(i,i.steps.length-1,0),n.applyInputRules&&i.setMeta("applyInputRules",{from:h,text:c}),n.applyPasteRules&&i.setMeta("applyPasteRules",{from:h,text:c})}return!0},Y=()=>({state:e,dispatch:t})=>(0,i.G2)(e,t),q=()=>({state:e,dispatch:t})=>(0,i.bh)(e,t),J=()=>({state:e,dispatch:t})=>(0,i.Qv)(e,t),X=()=>({state:e,dispatch:t})=>(0,i.eT)(e,t),Z=()=>({state:e,dispatch:t,tr:n})=>{try{let i=(0,r.N0)(e.doc,e.selection.$from.pos,-1);if(null==i)return!1;return n.join(i,2),t&&t(n),!0}catch{return!1}},G=()=>({state:e,dispatch:t,tr:n})=>{try{let i=(0,r.N0)(e.doc,e.selection.$from.pos,1);if(null==i)return!1;return n.join(i,2),t&&t(n),!0}catch{return!1}},Q=()=>({state:e,dispatch:t})=>(0,i.eB)(e,t),ee=()=>({state:e,dispatch:t})=>(0,i._G)(e,t);function et(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var en=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))D()||et()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"
1===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function er(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?x(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,d=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>T(e.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}var ei=(e,t={})=>({state:n,dispatch:r})=>{let o=x(e,n.schema);return!!er(n,o,t)&&(0,i.yY)(n,r)},eo=()=>({state:e,dispatch:t})=>(0,i.iz)(e,t),es=e=>({state:t,dispatch:n})=>{let r=x(e,t.schema);return(0,a.T2)(r)(t,n)},ea=()=>({state:e,dispatch:t})=>(0,i.pC)(e,t);function el(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ed(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ec=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=el("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=x(e,r.schema)),"mark"===a&&(s=N(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,ed(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,s.create(ed(o.attrs,t))))})})}),l},eu=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ep=()=>({tr:e,dispatch:t})=>{if(t){let t=new o.i5(e.doc);e.setSelection(t)}return!0},eh=()=>({state:e,dispatch:t})=>(0,i._e)(e,t),em=()=>({state:e,dispatch:t})=>(0,i.Sd)(e,t),ef=()=>({state:e,dispatch:t})=>(0,i.hy)(e,t),eg=()=>({state:e,dispatch:t})=>(0,i.ec)(e,t),ey=()=>({state:e,dispatch:t})=>(0,i.$f)(e,t),ev=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if("full"!==r.preserveWhitespace){let a=function(e,t,n={},r={}){return F(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function ek(e,t){let n=N(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function eb(e,t){let n=new r.dL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function ex(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ew(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function eM(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function eE(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function eS(e){return t=>eE(t.$from,e)}function eC(e,t,n){return void 0===e.config[t]&&e.parent?eC(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?eC(e.parent,t,n):null}):e.config[t]}function eO(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=eC(e,"addExtensions",t);return n?[e,...eO(n())]:e}).flat(10)}function ez(e,t){let n=s.ZF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function eT(e,t,...n){return"function"==typeof e?t?e.bind(t)(...n):e(...n):e}function e$(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function eR(e){let t=[],{nodeExtensions:n,markExtensions:r}=e$(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];
1return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=eC(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=eC(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function eA(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let a=0;a<s;a+=1){let s=e[a];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function eN(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...eA(n[e]),...eA(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function ej(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>eN(e,t),{})}function eI(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function eP(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function eL(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function eH(e){return e.sort((e,t)=>{let n=eC(e,"priority")||100,r=eC(t,"priority")||100;return n>r?-1:+(n<r)})}function eD(e){var t;let n=eH(eO(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function eB(e,t){let n=el("string"==typeof t?t:t.name,e.schema);if("node"===n){let n=x(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}return"mark"===n?ek(e,t):{}}function e_(e){let{mapping:t,steps:n}=e,r=[];t.maps.forEach((e,i)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(void 0===e||void 0===t)return;o.push({from:e,to:t})}o.forEach(({from:e,to:n})=>{let o=t.slice(i).map(e,-1),s=t.slice(i).map(n),a=t.invert().map(o,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:o,to:s}})})});let i=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(r);return 1===i.length?i:i.filter((e,t)=>!i.filter((e,n)=>n!==t).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function eU(e,t,n){let r=[];
1return e===t?n.resolve(e).marks().forEach(t=>{let i=A(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var eW=(e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]};function eK(e,t){return t.nodes[e]||t.marks[e]||null}function eF(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function eV(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?N(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>T(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>T(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=s}function eY(e,t,n={}){if(!t)return er(e,null,n)||eV(e,null,n);let r=el(t,e.schema);return"node"===r?er(e,t,n):"mark"===r&&eV(e,t,n)}var eq=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=eS(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos},eJ=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos};function eX(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function eZ(e,t){let{nodeExtensions:n}=e$(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=eT(eC(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function eG(e){return e instanceof o.nh}var eQ=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=N(e,r.schema);if(i)if(s){let e=ek(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;
1if(P(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},e0=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),e1=(e,t={})=>({state:n,dispatch:r,chain:o})=>{let s,a=x(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock)?o().command(({commands:e})=>!!(0,i.y_)(a,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>(0,i.y_)(a,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},e2=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=L(e,0,n.content.size),i=o.nh.create(n,r);t.setSelection(i)}return!0},e3=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:a}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},e9=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,s=o.U3.atStart(n).from,a=o.U3.atEnd(n).to,l=L(r,s,a),d=L(i,s,a),c=o.U3.create(n,l,d);t.setSelection(c)}return!0},e4=e=>({state:t,dispatch:n})=>{let r=x(e,t.schema);return(0,a.$B)(r)(t,n)};function e5(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var e7=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:i,editor:s})=>{let{selection:a,doc:l}=t,{$from:d,$to:c}=a,u=eF(s.extensionManager.attributes,d.node().type.name,d.node().attrs);if(a instanceof o.nh&&a.node.isBlock)return!!d.parentOffset&&!!(0,r.zy)(l,d.pos)&&(i&&(e&&e5(n,s.extensionManager.splittableMarks),t.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;let p=c.parentOffset===c.parent.content.size,h=0===d.depth?void 0:ex(d.node(-1).contentMatchAt(d.indexAfter(-1))),m=p&&h?[{type:h,attrs:u}]:void 0,f=(0,r.zy)(t.doc,t.mapping.map(d.pos),1,m);if(!m&&!f&&(0,r.zy)(t.doc,t.mapping.map(d.pos),1,h?[{type:h}]:void 0)&&(f=!0,m=h?[{type:h,attrs:u}]:void 0),i){if(f&&(a instanceof o.U3&&t.deleteSelection(),t.split(t.mapping.map(d.pos),1,m),h&&!p&&!d.parentOffset&&d.parent.type!==h)){let e=t.mapping.map(d.before()),n=t.doc.resolve(e);d.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(d.before()),h)}e&&e5(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return f},e6=(e,t={})=>({tr:n,state:i,dispatch:a,editor:l})=>{var d;let c=x(e,i.schema),{$from:u,$to:p}=i.selection,h=i.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(p))return!1;let m=u.node(-1);if(m.type!==c)return!1;let f=l.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let e=s.FK.empty,r=u.index(-1)?1:u.index(-2)?2:3;for(let t=u.depth-r;t>=u.depth-3;t-=1)e=s.FK.from(u.node(t).copy(e));let i=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,a={...eF(f,u.node().type.name,u.node().attrs),...t},l=(null==(d=c.contentMatch.defaultType)?void 0:d.createAndFill(a))||void 0;e=e.append(s.FK.from(c.createAndFill(null,l)||void 0));let p=u.before(u.depth-(r-1));n.replace(p,u.after(-i),new s.Ji(e,4-r,0));let h=-1;n.doc.nodesBetween(p,n.doc.content.size,(e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)}),h>-1&&n.setSelection(o.U3.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}let g=p.pos===u.end()?m.contentMatchAt(0).defaultType:null,y={...eF(f,m.type.name,m.attrs),...t},v={...eF(f,u.node().type.name,u.node().attrs),...t};n.delete(u.pos,p.pos);let k=g?[{type:c,attrs:y},{type:g,attrs:v}]:[{type:c,attrs:y}];if(!(0,r.zy)(n.doc,u.pos,2))return!1;if(a){let{selection:e,storedMarks:t}=i,{splittableMarks:r}=l.extensionManager,o=t||e.$to.parentOffset&&e.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!o||!a)return!0;let s=o.filter(e=>
1r.includes(e.type.name));n.ensureMarks(s)}return!0},e8=(e,t)=>{let n=eS(e=>e.type===t)(e.selection);if(!n)return!0;let i=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===i)return!0;let o=e.doc.nodeAt(i);return!(n.node.type===(null==o?void 0:o.type)&&(0,r.n9)(e.doc,n.pos))||(e.join(n.pos),!0)},te=(e,t)=>{let n=eS(e=>e.type===t)(e.selection);if(!n)return!0;let i=e.doc.resolve(n.start).after(n.depth);if(void 0===i)return!0;let o=e.doc.nodeAt(i);return!(n.node.type===(null==o?void 0:o.type)&&(0,r.n9)(e.doc,i))||(e.join(i),!0)},tt=(e,t,n,r={})=>({editor:i,tr:s,state:a,dispatch:l,chain:d,commands:c,can:u})=>{let{extensions:p,splittableMarks:h}=i.extensionManager,m=x(e,a.schema),f=x(t,a.schema),{selection:g,storedMarks:y}=a,{$from:v,$to:k}=g,b=v.blockRange(k),w=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;let M=eS(e=>eZ(e.type.name,p))(g),E=0===g.from&&g.to===a.doc.content.size,S=a.doc.content.content,C=1===S.length?S[0]:null,O=E&&C&&eZ(C.type.name,p)?{node:C,pos:0,depth:0}:null,z=null!=M?M:O,T=!!M&&b.depth>=1&&b.depth-M.depth<=1,$=!!O;if((T||$)&&z){if(z.node.type===m)return E&&$?d().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return o.U3.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(eZ(z.node.type.name,p)&&m.validContent(z.node.content))return d().command(()=>(s.setNodeMarkup(z.pos,m),!0)).command(()=>e8(s,m)).command(()=>te(s,m)).run()}return n&&w&&l?d().command(()=>{let e=u().wrapInList(m,r),t=w.filter(e=>h.includes(e.type.name));return s.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(m,r).command(()=>e8(s,m)).command(()=>te(s,m)).run():d().command(()=>!!u().wrapInList(m,r)||c.clearNodes()).wrapInList(m,r).command(()=>e8(s,m)).command(()=>te(s,m)).run()},tn=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=N(e,r.schema);return eV(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},tr=(e,t,n={})=>({state:r,commands:i})=>{let o,s=x(e,r.schema),a=x(t,r.schema),l=er(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),l)?i.setNode(a,o):i.setNode(s,{...o,...n})},ti=(e,t={})=>({state:n,commands:r})=>{let i=x(e,n.schema);return er(n,i,t)?r.lift(i):r.wrapIn(i,t)},to=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},ts=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;
1return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},ta=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=N(e,r.schema),{$from:d,empty:c,ranges:u}=a;if(!i)return!0;if(c&&s){let{from:e,to:t}=a,r=null==(o=d.marks().find(e=>e.type===l))?void 0:o.attrs,i=A(d,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},tl=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},td=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=el("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=x(e,r.schema)),"mark"===a&&(s=N(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,d,c,u,p=e.$from.pos,h=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,h,(e,t)=>{o&&o===e.type&&(l=!0,c=Math.max(t,p),u=Math.min(t+e.nodeSize,h),a=t,d=e)}):r.doc.nodesBetween(p,h,(e,r)=>{r<p&&o&&o===e.type&&(l=!0,c=Math.max(r,p),u=Math.min(r+e.nodeSize,h),a=r,d=e),r>=p&&r<=h&&(o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(l=!0,i)){let i=Math.max(r,p),a=Math.min(r+e.nodeSize,h);n.addMark(i,a,s.create({...o.attrs,...t}))}}))}),d&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&i&&n.addMark(c,u,s.create({...e.attrs,...t}))}))}),l},tc=(e,t={})=>({state:n,dispatch:r})=>{let o=x(e,n.schema);return(0,i.Im)(o,t)(n,r)},tu=(e,t={})=>({state:n,dispatch:r})=>{let i=x(e,n.schema);return(0,a.Sd)(i,t)(n,r)},tp=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function th(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;let d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,h=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+o;return s.forEach(e=>{if(c)return;let t=((e,t)=>{if(z(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;let s=l.state.tr,d=u({state:l.state,transaction:s}),m={from:r-(t[0].length-o.length),to:i}
1,{commands:f,chain:g,can:y}=new p({editor:n,state:d});null!==e.handler({state:d,range:m,match:t,commands:f,chain:g,can:y})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),c=!0)}),c}function tm(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var tf=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...eT(eC(this,"addOptions",{name:this.name}))}}get storage(){return{...eT(eC(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return tm(t)&&tm(n)&&Object.keys(n).forEach(i=>{tm(n[i])&&tm(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},tg=class e extends tf{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},ty=class{constructor(e){this.find=e.find,this.handler=e.handler}},tv=null,tk=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=eD(e),this.schema=function(e,t){var n;let r=eR(e),{nodeExtensions:i,markExtensions:o}=e$(e),a=null==(n=i.find(e=>eC(e,"topNode")))?void 0:n.name,l=Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=eP({...e.reduce((e,t)=>{let r=eC(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:eT(eC(n,"content",o)),marks:eT(eC(n,"marks",o)),group:eT(eC(n,"group",o)),inline:eT(eC(n,"inline",o)),atom:eT(eC(n,"atom",o)),selectable:eT(eC(n,"selectable",o)),draggable:eT(eC(n,"draggable",o)),code:eT(eC(n,"code",o)),whitespace:eT(eC(n,"whitespace",o)),linebreakReplacement:eT(eC(n,"linebreakReplacement",o)),defining:eT(eC(n,"defining",o)),isolating:eT(eC(n,"isolating",o)),attrs:Object.fromEntries(i.map(eL))}),a=eT(eC(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>eI(e,i)));let l=eC(n,"renderHTML",o);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:ej(e,i)}));let d=eC(n,"renderText",o);return d&&(s.toText=d),[n.name,s]})),d=Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=eP({...e.reduce((e,t)=>{let r=eC(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:eT(eC(n,"inclusive",o)),excludes:eT(eC(n,"excludes",o)),group:eT(eC(n,"group",o)),spanning:eT(eC(n,"spanning",o)),code:eT(eC(n,"code",o)),attrs:Object.fromEntries(i.map(eL))}),a=eT(eC(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>eI(e,i)));let l=eC(n,"renderHTML",o);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:ej(e,i)})),[n.name,s]}));return new s.Sj({topNode:a,nodes:l,marks:d})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:eK(t.name,this.schema)},r=eC(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return eH([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:eK(t.name,this.schema)},r=[],i=eC(t,"addKeyboardShortcuts",n),a={};if("mark"===t.type&&eC(t,"exitable",n)&&(a.ArrowRight=()=>tg.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let d=(0,l.w)(a);r.push(d);let c=eC(t,"addInputRules",n);if(eX(t,e.options.enableInputRules)&&c){let t=c();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new o.k_({state:{init:()=>null,apply(e,i,o){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=ez(s.FK.from(e),o.schema));let{from:i}=l,a=i+e.length;th({editor:t,from:i,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,o,s)=>th({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&th({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&th({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let h=eC(t,"addPasteRules",n);if(eX(t,e.options.enablePasteRules)&&h){let t=h();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,a=!1,l=!1,d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:d,can:c}=new p({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var p,h,m,f,g;if((null==(h=null==(p=e.type)?void 0:p.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(f=null==(m=e.content)?void 0:m.size)?f:e.nodeSize)?g:0,v=Math.max(r,t),k=Math.min(i,t+y);v>=k||((e,t,n)=>{if(z(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(v-t,k-t,void 0,""),o.find,s).forEac
1h(e=>{if(void 0===e.index)return;let t=v+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=o.handler({state:n,range:i,match:e,commands:l,chain:d,can:c,pasteEvent:s,dropEvent:a});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:u({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new o.k_({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(tv=n)},r=()=>{tv&&(tv=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(l=i===e.dom.parentElement,t=n,!l){let e=tv;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return d=t,a=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],o="paste"===i.getMeta("uiEvent")&&!a,u="drop"===i.getMeta("uiEvent")&&!l,p=i.getMeta("applyPasteRules"),h=!!p;if(!o&&!u&&!h)return;if(h){let{text:t}=p;"string"==typeof t||(t=ez(s.FK.from(t),r.schema));let{from:n}=p,i=n+t.length;return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:(e=>{var t;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t)})}let m=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&f&&m!==f.b)return c({rule:e,state:r,from:m,to:f,pasteEvt:d})}}))}({editor:e,rules:t});r.push(...n)}}let m=eC(t,"addProseMirrorPlugins",n);if(m){let e=m();r.push(...e)}return r})}get attributes(){return eR(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=e$(this.extensions);return Object.fromEntries(t.filter(e=>!!eC(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:x(t.name,this.schema)},i=eC(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,a,l)=>{let d=ej(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return eH([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eK(n.name,this.schema)},i=eC(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return eH([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eK(n.name,this.schema)},i=eC(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=e$(this.extensions);return Object.fromEntries(t.filter(e=>!!eC(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:N(t.name,this.schema)},i=eC(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let a=ej(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,a=null;if(t.marks.forEach(t=>{if(t!==e)return!1;a=t}),!a)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==a.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>
1[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:eK(e.name,this.schema)};"mark"===e.type&&(null==(t=eT(eC(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=eC(e,"onBeforeCreate",n),i=eC(e,"onCreate",n),o=eC(e,"onUpdate",n),s=eC(e,"onSelectionUpdate",n),a=eC(e,"onTransaction",n),l=eC(e,"onFocus",n),d=eC(e,"onBlur",n),c=eC(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}};tk.resolve=eD,tk.sort=eH,tk.flatten=eO,c({},{ClipboardTextSerializer:()=>tx,Commands:()=>tw,Delete:()=>tM,Drop:()=>tE,Editable:()=>tS,FocusEvents:()=>tO,Keymap:()=>tz,Paste:()=>tT,Tabindex:()=>t$,TextDirection:()=>tR,focusEventsPluginKey:()=>tC});var tb=class e extends tf{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tx=tb.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]));return function(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,d)=>{var c;e.isBlock&&n>r&&(a+=o);let u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:d,range:t})),!1;e.isText&&(a+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,i-n))}),a}(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),tw=tb.create({name:"commands",addCommands:()=>({...h})}),tM=tb.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,i,o;let s=()=>{var n,i,o,s;if(null!=(s=null==(o=null==(i=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:i.filterTransaction)?void 0:o.call(i,e))?s:e.getMeta("y-sync$"))return;let a=eb(e.before,[e,...t]);e_(a).forEach(t=>{a.mapping.mapResult(t.oldRange.from).deletedAfter&&a.mapping.mapResult(t.oldRange.to).deletedBefore&&a.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:a.mapping.map(r),newTo:a.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:a})})});let l=a.mapping;a.steps.forEach((t,n)=>{var i,o;if(t instanceof r.Ys){let r=l.slice(n).map(t.from,-1),s=l.slice(n).map(t.to),d=l.invert().map(r,-1),c=l.invert().map(s),u=r>0&&(null==(i=a.doc.nodeAt(r-1))?void 0:i.marks.some(e=>e.eq(t.mark))),p=null==(o=a.doc.nodeAt(s))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:r,to:s},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:a})}})};null==(o=null==(i=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:i.async)||o?setTimeout(s,0):s()}}),tE=tb.create({name:"drop",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),tS=tb.create({name:"editable",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tC=new o.hs("focusEvents"),tO=tb.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;
1return[new o.k_({key:tC,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),tz=tb.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:s}=n,{pos:a,parent:l}=s,d=s.parent.isTextblock&&a>0?t.doc.resolve(a-1):s,c=d.parent.type.spec.isolating,u=s.pos-s.parentOffset,p=c&&1===d.parent.childCount?u===s.pos:o.LN.atStart(r).from===a;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!p&&(!p||"paragraph"!==s.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return D()||et()?i:r},addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:s,from:a,to:l}=t.selection,d=o.LN.atStart(t.doc).from,c=o.LN.atEnd(t.doc).to;if(s||a!==d||l!==c||!function e(t,{checkChildren:n=!0,ignoreWhitespace:r=!1}={}){var i;if(r){if("hardBreak"===t.type.name)return!0;if(t.isText)return!/\S/.test(null!=(i=t.text)?i:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(n){let i=!0;return t.content.forEach(t=>{!1!==i&&(e(t,{ignoreWhitespace:r,checkChildren:n})||(i=!1))}),i}return!1}(n.doc))return;let h=n.tr,m=u({state:n,transaction:h}),{commands:f}=new p({editor:this.editor,state:m});if(f.clearNodes(),h.steps.length)return h}})]}}),tT=tb.create({name:"paste",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),t$=tb.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),tR=tb.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=e$(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new o.k_({key:new o.hs("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});function tA(e){return new tp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=eT(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],a=r[0];if(s){let r=a.search(/\S/),l=n.from+a.indexOf(s),d=l+s.length;if(eU(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;
1d<n.to&&o.delete(d,n.to),l>n.from&&o.delete(n.from+r,l);let c=n.from+r+s.length;o.addMark(n.from+r,c,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function tN(e){return new tp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=eT(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,a=n.to,l=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,a,l)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:e.undoable})}function tj(e){return new tp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=eT(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function tI(e){return new tp({find:e.find,handler:({state:t,range:n,match:i,chain:o})=>{let s=eT(e.getAttributes,void 0,i)||{},a=t.tr.delete(n.from,n.to),l=a.doc.resolve(n.from).blockRange(),d=l&&(0,r.oM)(l,e.type,s);if(!d)return null;if(a.wrap(l,d),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));a.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,s).run()}let c=a.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&(0,r.n9)(a.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(i,c))&&a.join(n.from-1)},undoable:e.undoable})}var tP=class{constructor(e){var t,n,r,i,o,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(o=e.options)?void 0:o.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.n
1ame,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),o=this.applyConstraints(r,i,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,o=e.includes("right"),s=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return(o?r=this.startWidth+t:s&&(r=this.startWidth-t),a?i=this.startHeight+n:l&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(o?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,o,s;if(!n){let n=Math.max(this.minSize.width,e),o=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(i=this.maxSize)?void 0:i.height)&&(o=Math.min(this.maxSize.height,o)),{width:n,height:o}}let a=e,l=t;return a<this.minSize.width&&(l=(a=this.minSize.width)/this.aspectRatio),l<this.minSize.height&&(a=(l=this.minSize.height)*this.aspectRatio),(null==(o=this.maxSize)?void 0:o.width)&&a>this.maxSize.width&&(l=(a=this.maxSize.width)/this.aspectRatio),(null==(s=this.maxSize)?void 0:s.height)&&l>this.maxSize.height&&(a=(l=this.maxSize.height)*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function tL(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof o.nh){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;
1i-=1}return!1}function tH(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function tD(e,t){let n=e.getAttribute("style");if(!n)return null;let r=n.split(";").map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;e-=1){let t=r[e],n=t.indexOf(":");if(-1!==n&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function tB(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>
1{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function t_(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function tU(e){let{nodeName:t,name:n,parseAttributes:r=tB,serializeAttributes:i=t_,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(o);if(!a)return;let d=r(a[1]||"");if(!s.find(e=>!(e in d)))return{type:t,raw:a[0],attributes:d}}},renderMarkdown:e=>{let t=i((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${l}${n} :::`}}}function tW(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=tB,serializeAttributes:o=t_,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,d=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${d}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;let[c,u=""]=l,p=i(u),h=1,m=c.length,f="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(m);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)h+=1;else if(0==(h-=1)){let o=y.slice(0,i);f=o.trim();let s=e.slice(0,m+i+n[0].length),l=[];if(f)if("block"===a)for((l=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(f);return{type:t,raw:s,attributes:p,content:f,tokens:l}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${d}${r} 2 3${i} 4 5:::`}}}function tK(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function tF(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function tV(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=tK,serializeAttributes:o=tF,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,d=n||t,c=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(a)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=a?RegExp(`\\[${c}\\s*[^\\]]*\\]`):RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=a?RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),s=e.match(o);if(!s)return;let l="",d="";if(a){let[,e]=s;d=e}else{let[,e,t]=s;d=e,l=t||""}let u=i(d.trim());return{type:t,raw:s[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return a?`[${d}${i}]`:`[${d}${i}]${t}[/${d}]`}}}function tY(e,t,n){var r,i,o,s;let a=e.split("\n"),l=[],d="",c=0,u=t.baseIndentSize||2;for(;c<a.length;){let e,p=a[c],h=p.match(t.itemPattern);if(!h)if(l.length>0)break;else{if(""!==p.trim())return;c+=1,d=`${d}${p} 6`;continue}let m=t.extractItemData(h),{indentLevel:f,mainContent:g}=m;d=`${d}${p} 7`;let y=[g];for(c+=1;c<a.length;){let e=a[c];if(""===e.trim()){let t=a.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;
7if(((null==(i=null==(r=a[c+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>f){y.push(e),d=`${d}${e} 8`,c+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>f)y.push(e),d=`${d}${e} 9`,c+=1;else break}let v=y.slice(1);if(v.length>0){let r=v.map(e=>e.slice(f+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let k=t.createToken(m,e);l.push(k)}if(0!==l.length)return{items:l,raw:d}}function tq(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,a=t.renderChildren([o]),l=`${i}${a}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,i;let o=null!=(i=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?i:t.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?` 10 11${n}`:` 12${n}`}}),l}c({},{createAtomBlockMarkdownSpec:()=>tU,createBlockMarkdownSpec:()=>tW,createInlineMarkdownSpec:()=>tV,parseAttributes:()=>tB,parseIndentedBlocks:()=>tY,renderNestedMarkdownContent:()=>tq,serializeAttributes:()=>t_});var tJ=class e extends tf{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};function tX(e){return new ty({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=eT(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,a=r[r.length-1],l=r[0],d=n.to;if(a){let i=l.search(/\S/),c=n.from+l.indexOf(a),u=c+a.length;if(eU(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+i,c),d=n.from+i+a.length,s.addMark(n.from+i,d,e.type.create(o||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.