devi-rich-editor
Version:
Reusable Rich Text Editor built with TipTap and React.
34 lines (31 loc) • 537 kB
JavaScript
(function(Ct,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],I):(Ct=typeof globalThis<"u"?globalThis:Ct||self,I(Ct.DeviRichEditor={},Ct.React,Ct.ReactDOM))})(this,function(Ct,I,Fm){"use strict";var bo={exports:{}},mr={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Tc;function Vm(){if(Tc)return mr;Tc=1;var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(l,a,c){var u,f={},d=null,h=null;c!==void 0&&(d=""+c),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(h=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:e,type:l,key:d,ref:h,props:f,_owner:i.current}}return mr.Fragment=t,mr.jsx=o,mr.jsxs=o,mr}var gr={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ec;function Hm(){return Ec||(Ec=1,process.env.NODE_ENV!=="production"&&function(){var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function g(y){if(y===null||typeof y!="object")return null;var k=p&&y[p]||y[m];return typeof k=="function"?k:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(y){{for(var k=arguments.length,O=new Array(k>1?k-1:0),v=1;v<k;v++)O[v-1]=arguments[v];T("error",y,O)}}function T(y,k,O){{var v=b.ReactDebugCurrentFrame,J=v.getStackAddendum();J!==""&&(k+="%s",O=O.concat([J]));var G=O.map(function(_){return String(_)});G.unshift("Warning: "+k),Function.prototype.apply.call(console[y],console,G)}}var w=!1,M=!1,A=!1,$=!1,W=!1,R;R=Symbol.for("react.module.reference");function le(y){return!!(typeof y=="string"||typeof y=="function"||y===r||y===s||W||y===i||y===c||y===u||$||y===h||w||M||A||typeof y=="object"&&y!==null&&(y.$$typeof===d||y.$$typeof===f||y.$$typeof===o||y.$$typeof===l||y.$$typeof===a||y.$$typeof===R||y.getModuleId!==void 0))}function Ke(y,k,O){var v=y.displayName;if(v)return v;var J=k.displayName||k.name||"";return J!==""?O+"("+J+")":O}function Fe(y){return y.displayName||"Context"}function Se(y){if(y==null)return null;if(typeof y.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case r:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case l:var k=y;return Fe(k)+".Consumer";case o:var O=y;return Fe(O._context)+".Provider";case a:return Ke(y,y.render,"ForwardRef");case f:var v=y.displayName||null;return v!==null?v:Se(y.type)||"Memo";case d:{var J=y,G=J._payload,_=J._init;try{return Se(_(G))}catch{return null}}}return null}var De=Object.assign,nt=0,qe,rt,fm,dm,hm,pm,mm;function gm(){}gm.__reactDisabledLog=!0;function JT(){{if(nt===0){qe=console.log,rt=console.info,fm=console.warn,dm=console.error,hm=console.group,pm=console.groupCollapsed,mm=console.groupEnd;var y={configurable:!0,enumerable:!0,value:gm,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}nt++}}function UT(){{if(nt--,nt===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:De({},y,{value:qe}),info:De({},y,{value:rt}),warn:De({},y,{value:fm}),error:De({},y,{value:dm}),group:De({},y,{value:hm}),groupCollapsed:De({},y,{value:pm}),groupEnd:De({},y,{value:mm})})}nt<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var rc=b.ReactCurrentDispatcher,ic;function ho(y,k,O){{if(ic===void 0)try{throw Error()}catch(J){var v=J.stack.trim().match(/\n( *(at )?)/);ic=v&&v[1]||""}return`
`+ic+y}}var sc=!1,po;{var GT=typeof WeakMap=="function"?WeakMap:Map;po=new GT}function ym(y,k){if(!y||sc)return"";{var O=po.get(y);if(O!==void 0)return O}var v;sc=!0;var J=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var G;G=rc.current,rc.current=null,JT();try{if(k){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(Ve){v=Ve}Reflect.construct(y,[],_)}else{try{_.call()}catch(Ve){v=Ve}y.call(_.prototype)}}else{try{throw Error()}catch(Ve){v=Ve}y()}}catch(Ve){if(Ve&&v&&typeof Ve.stack=="string"){for(var V=Ve.stack.split(`
`),Re=v.stack.split(`
`),ie=V.length-1,ae=Re.length-1;ie>=1&&ae>=0&&V[ie]!==Re[ae];)ae--;for(;ie>=1&&ae>=0;ie--,ae--)if(V[ie]!==Re[ae]){if(ie!==1||ae!==1)do if(ie--,ae--,ae<0||V[ie]!==Re[ae]){var it=`
`+V[ie].replace(" at new "," at ");return y.displayName&&it.includes("<anonymous>")&&(it=it.replace("<anonymous>",y.displayName)),typeof y=="function"&&po.set(y,it),it}while(ie>=1&&ae>=0);break}}}finally{sc=!1,rc.current=G,UT(),Error.prepareStackTrace=J}var cr=y?y.displayName||y.name:"",Ln=cr?ho(cr):"";return typeof y=="function"&&po.set(y,Ln),Ln}function YT(y,k,O){return ym(y,!1)}function XT(y){var k=y.prototype;return!!(k&&k.isReactComponent)}function mo(y,k,O){if(y==null)return"";if(typeof y=="function")return ym(y,XT(y));if(typeof y=="string")return ho(y);switch(y){case c:return ho("Suspense");case u:return ho("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case a:return YT(y.render);case f:return mo(y.type,k,O);case d:{var v=y,J=v._payload,G=v._init;try{return mo(G(J),k,O)}catch{}}}return""}var di=Object.prototype.hasOwnProperty,bm={},Sm=b.ReactDebugCurrentFrame;function go(y){if(y){var k=y._owner,O=mo(y.type,y._source,k?k.type:null);Sm.setExtraStackFrame(O)}else Sm.setExtraStackFrame(null)}function QT(y,k,O,v,J){{var G=Function.call.bind(di);for(var _ in y)if(G(y,_)){var V=void 0;try{if(typeof y[_]!="function"){var Re=Error((v||"React class")+": "+O+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}V=y[_](k,_,v,O,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ie){V=ie}V&&!(V instanceof Error)&&(go(J),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",O,_,typeof V),go(null)),V instanceof Error&&!(V.message in bm)&&(bm[V.message]=!0,go(J),S("Failed %s type: %s",O,V.message),go(null))}}}var ZT=Array.isArray;function oc(y){return ZT(y)}function eE(y){{var k=typeof Symbol=="function"&&Symbol.toStringTag,O=k&&y[Symbol.toStringTag]||y.constructor.name||"Object";return O}}function tE(y){try{return km(y),!1}catch{return!0}}function km(y){return""+y}function xm(y){if(tE(y))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",eE(y)),km(y)}var hi=b.ReactCurrentOwner,nE={key:!0,ref:!0,__self:!0,__source:!0},Cm,Tm,lc;lc={};function rE(y){if(di.call(y,"ref")){var k=Object.getOwnPropertyDescriptor(y,"ref").get;if(k&&k.isReactWarning)return!1}return y.ref!==void 0}function iE(y){if(di.call(y,"key")){var k=Object.getOwnPropertyDescriptor(y,"key").get;if(k&&k.isReactWarning)return!1}return y.key!==void 0}function sE(y,k){if(typeof y.ref=="string"&&hi.current&&k&&hi.current.stateNode!==k){var O=Se(hi.current.type);lc[O]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Se(hi.current.type),y.ref),lc[O]=!0)}}function oE(y,k){{var O=function(){Cm||(Cm=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};O.isReactWarning=!0,Object.defineProperty(y,"key",{get:O,configurable:!0})}}function lE(y,k){{var O=function(){Tm||(Tm=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};O.isReactWarning=!0,Object.defineProperty(y,"ref",{get:O,configurable:!0})}}var aE=function(y,k,O,v,J,G,_){var V={$$typeof:e,type:y,key:k,ref:O,props:_,_owner:G};return V._store={},Object.defineProperty(V._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(V,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(V,"_source",{configurable:!1,enumerable:!1,writable:!1,value:J}),Object.freeze&&(Object.freeze(V.props),Object.freeze(V)),V};function cE(y,k,O,v,J){{var G,_={},V=null,Re=null;O!==void 0&&(xm(O),V=""+O),iE(k)&&(xm(k.key),V=""+k.key),rE(k)&&(Re=k.ref,sE(k,J));for(G in k)di.call(k,G)&&!nE.hasOwnProperty(G)&&(_[G]=k[G]);if(y&&y.defaultProps){var ie=y.defaultProps;for(G in ie)_[G]===void 0&&(_[G]=ie[G])}if(V||Re){var ae=typeof y=="function"?y.displayName||y.name||"Unknown":y;V&&oE(_,ae),Re&&lE(_,ae)}return aE(y,V,Re,J,v,hi.current,_)}}var ac=b.ReactCurrentOwner,Em=b.ReactDebugCurrentFrame;function ar(y){if(y){var k=y._owner,O=mo(y.type,y._source,k?k.type:null);Em.setExtraStackFrame(O)}else Em.setExtraStackFrame(null)}var cc;cc=!1;function uc(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function Mm(){{if(ac.current){var y=Se(ac.current.type);if(y)return`
Check the render method of \``+y+"`."}return""}}function uE(y){{if(y!==void 0){var k=y.fileName.replace(/^.*[\\\/]/,""),O=y.lineNumber;return`
Check your code at `+k+":"+O+"."}return""}}var Om={};function fE(y){{var k=Mm();if(!k){var O=typeof y=="string"?y:y.displayName||y.name;O&&(k=`
Check the top-level render call using <`+O+">.")}return k}}function wm(y,k){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var O=fE(k);if(Om[O])return;Om[O]=!0;var v="";y&&y._owner&&y._owner!==ac.current&&(v=" It was passed a child from "+Se(y._owner.type)+"."),ar(y),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',O,v),ar(null)}}function Am(y,k){{if(typeof y!="object")return;if(oc(y))for(var O=0;O<y.length;O++){var v=y[O];uc(v)&&wm(v,k)}else if(uc(y))y._store&&(y._store.validated=!0);else if(y){var J=g(y);if(typeof J=="function"&&J!==y.entries)for(var G=J.call(y),_;!(_=G.next()).done;)uc(_.value)&&wm(_.value,k)}}}function dE(y){{var k=y.type;if(k==null||typeof k=="string")return;var O;if(typeof k=="function")O=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===a||k.$$typeof===f))O=k.propTypes;else return;if(O){var v=Se(k);QT(O,y.props,"prop",v,y)}else if(k.PropTypes!==void 0&&!cc){cc=!0;var J=Se(k);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",J||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hE(y){{for(var k=Object.keys(y.props),O=0;O<k.length;O++){var v=k[O];if(v!=="children"&&v!=="key"){ar(y),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),ar(null);break}}y.ref!==null&&(ar(y),S("Invalid attribute `ref` supplied to `React.Fragment`."),ar(null))}}var Nm={};function Dm(y,k,O,v,J,G){{var _=le(y);if(!_){var V="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(V+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Re=uE(J);Re?V+=Re:V+=Mm();var ie;y===null?ie="null":oc(y)?ie="array":y!==void 0&&y.$$typeof===e?(ie="<"+(Se(y.type)||"Unknown")+" />",V=" Did you accidentally export a JSX literal instead of a component?"):ie=typeof y,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ie,V)}var ae=cE(y,k,O,J,G);if(ae==null)return ae;if(_){var it=k.children;if(it!==void 0)if(v)if(oc(it)){for(var cr=0;cr<it.length;cr++)Am(it[cr],y);Object.freeze&&Object.freeze(it)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Am(it,y)}if(di.call(k,"key")){var Ln=Se(y),Ve=Object.keys(k).filter(function(SE){return SE!=="key"}),fc=Ve.length>0?"{key: someKey, "+Ve.join(": ..., ")+": ...}":"{key: someKey}";if(!Nm[Ln+fc]){var bE=Ve.length>0?"{"+Ve.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,fc,Ln,bE,Ln),Nm[Ln+fc]=!0}}return y===r?hE(ae):dE(ae),ae}}function pE(y,k,O){return Dm(y,k,O,!0)}function mE(y,k,O){return Dm(y,k,O,!1)}var gE=mE,yE=pE;gr.Fragment=r,gr.jsx=gE,gr.jsxs=yE}()),gr}process.env.NODE_ENV==="production"?bo.exports=Vm():bo.exports=Hm();var P=bo.exports;function me(n){this.content=n}me.prototype={constructor:me,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new me(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new me(t)},addToStart:function(n,e){return new me([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new me(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new me(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=me.from(n),n.size?new me(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=me.from(n),n.size?new me(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=me.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},me.from=function(n){if(n instanceof me)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new me(e)};function Mc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Mc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Oc(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Oc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}let L=class ve{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!r):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ve(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new ve(r,i)}cutByIndex(e,t){return e==t?ve.empty:e==0&&t==this.content.length?this:new ve(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new ve(i,s)}addToStart(e){return new ve([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ve(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Mc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Oc(this,e,t,r)}findIndex(e,t=-1){if(e==0)return yi(0,e);if(e==this.size)return yi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?yi(r+1,o):yi(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return ve.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new ve(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ve.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new ve(t||e,r)}static from(e){if(!e)return ve.empty;if(e instanceof ve)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ve([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};L.empty=new L([],0);const So={index:0,offset:0};function yi(n,e){return So.index=n,So.offset=e,So}function bi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!bi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!bi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ue=class dc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&bi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return dc.none;if(e instanceof dc)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};ue.none=[];let ko=class extends Error{},q=class ur{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ac(this.content,e+this.openStart,t);return r&&new ur(r,this.openStart,this.openEnd)}removeBetween(e,t){return new ur(wc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ur.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ur(L.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new ur(e,r,i)}};q.empty=new q(L.empty,0,0);function wc(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(wc(s.content,e-i-1,t-i-1)))}function Ac(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ac(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function jm(n,e,t){if(t.openStart>n.depth)throw new ko("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ko("Inconsistent open depths");return Nc(n,e,t,0)}function Nc(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Nc(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return on(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Wm(t,n);return on(s,Rc(n,o,l,e,r))}else return on(s,Si(n,e,r))}function Dc(n,e){if(!e.type.compatibleContent(n.type))throw new ko("Cannot join "+e.type.name+" onto "+n.type.name)}function xo(n,e,t){let r=n.node(t);return Dc(r,e.node(t)),r}function sn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yr(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(sn(n.nodeAfter,r),s++));for(let l=s;l<o;l++)sn(i.child(l),r);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,r)}function on(n,e){return n.type.checkContent(e),n.copy(e)}function Rc(n,e,t,r,i){let s=n.depth>i&&xo(n,e,i+1),o=r.depth>i&&xo(t,r,i+1),l=[];return yr(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Dc(s,o),sn(on(s,Rc(n,e,t,r,i+1)),l)):(s&&sn(on(s,Si(n,e,i+1)),l),yr(e,t,i,l),o&&sn(on(o,Si(t,r,i+1)),l)),yr(r,null,i,l),new L(l)}function Si(n,e,t){let r=[];if(yr(null,n,t,r),n.depth>t){let i=xo(n,e,t+1);sn(on(i,Si(n,e,t+1)),r)}return yr(e,null,t,r),new L(r)}function Wm(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(L.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}let vc=class hc{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ue.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ki(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new hc(t,r,s)}static resolveCached(e,t){for(let i=0;i<Co.length;i++){let s=Co[i];if(s.pos==t&&s.doc==e)return s}let r=Co[To]=hc.resolve(e,t);return To=(To+1)%_m,r}},Co=[],To=0,_m=12,ki=class{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const Km=Object.create(null);let Ic=class pc{constructor(e,t,r,i=ue.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||L.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&bi(this.attrs,t||e.defaultAttrs||Km)&&ue.sameSet(this.marks,r||ue.none)}copy(e=null){return e==this.content?this:new pc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return q.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new q(c,i.depth-o,s.depth-o)}replace(e,t,r){return jm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return vc.resolveCached(this,e)}resolveNoCache(e){return vc.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),qm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=L.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=ue.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!ue.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=L.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Ic.prototype.text=void 0;function qm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}let Jm=class mc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new zc(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new zc(this,t,!0);return r.addAll(e,t.from,t.to),q.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ym(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Bc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Bc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mc(e,mc.schemaRules(e)))}};const Pc={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Um={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$c={ol:!0,ul:!0},xi=1,Ci=2,br=4;function Lc(n,e,t){return e!=null?(e?xi:0)|(e==="full"?Ci:0):n&&n.whitespace=="pre"?xi|Ci:t&~br}let Ti=class{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=ue.none,this.stashMarks=[],this.match=o||(l&br?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&xi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):Qm(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Pc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},zc=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,s,o=Lc(null,t.preserveWhitespace,0)|(r?br:0);i?s=new Ti(i.type,i.attrs,ue.none,ue.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Ti(null,null,ue.none,ue.none,!0,null,o):s=new Ti(e.schema.topNodeType,null,ue.none,ue.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let i=this.readStyles(Xm(r));if(!i)return;let[s,o]=i,l=this.top;for(let a=0;a<o.length;a++)this.removePendingMark(o[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a]);t();for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<o.length;a++)this.addPendingMark(o[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Ci||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&xi)r.options&Ci?t=t.replace(/\r\n?/g,`
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;$c.hasOwnProperty(r)&&this.parser.normalizeLists&&Gm(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(s?s.ignore:Um.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,l=this.top,a=this.needsBlock;if(Pc.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=ue.none,r=ue.none;for(let i=0;i<e.length;i+=2)for(let s=void 0;;){let o=this.parser.matchStyle(e[i],e[i+1],this,s);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{o.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=Lc(e,i,s.options);s.options&br&&s.content.length==0&&(o|=br),this.nodes.push(new Ti(e,t,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=Zm(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}};function Gm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$c.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ym(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Xm(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function Bc(n){let e={};for(let t in n)e[t]=n[t];return e}function Qm(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}function Zm(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}let Fc=class pi{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Eo(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=pi.renderSpec(Eo(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&pi.renderSpec(Eo(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<t.length;u++){let f=t[u];if(f===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:d,contentDOM:h}=pi.renderSpec(e,f,r);if(l.appendChild(d),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Vc(e.marks)}};function Vc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Eo(n){return n.document||window.document}function Hc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Hc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function jc(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=jc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}let K=class Ie{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Ie(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new Ie(r,i)}cutByIndex(e,t){return e==t?Ie.empty:e==0&&t==this.content.length?this:new Ie(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new Ie(i,s)}addToStart(e){return new Ie([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ie(this.content.co